| Alternative 1 | |
|---|---|
| Error | 4.1 |
| Cost | 20352 |
\[\left|\left(2 + \left(x \cdot x\right) \cdot \left(0.6666666666666666 + 0.2 \cdot \left(x \cdot x\right)\right)\right) \cdot \left(x \cdot \frac{1}{\sqrt{\pi}}\right)\right|
\]
(FPCore (x)
:precision binary64
(fabs
(*
(/ 1.0 (sqrt PI))
(+
(+
(+ (* 2.0 (fabs x)) (* (/ 2.0 3.0) (* (* (fabs x) (fabs x)) (fabs x))))
(*
(/ 1.0 5.0)
(* (* (* (* (fabs x) (fabs x)) (fabs x)) (fabs x)) (fabs x))))
(*
(/ 1.0 21.0)
(*
(* (* (* (* (* (fabs x) (fabs x)) (fabs x)) (fabs x)) (fabs x)) (fabs x))
(fabs x)))))))(FPCore (x)
:precision binary64
(fabs
(*
x
(/
(+
2.0
(*
x
(*
x
(+
0.6666666666666666
(* (+ 0.2 (* 0.047619047619047616 (* x x))) (* x x))))))
(sqrt PI)))))double code(double x) {
return fabs(((1.0 / sqrt(((double) M_PI))) * ((((2.0 * fabs(x)) + ((2.0 / 3.0) * ((fabs(x) * fabs(x)) * fabs(x)))) + ((1.0 / 5.0) * ((((fabs(x) * fabs(x)) * fabs(x)) * fabs(x)) * fabs(x)))) + ((1.0 / 21.0) * ((((((fabs(x) * fabs(x)) * fabs(x)) * fabs(x)) * fabs(x)) * fabs(x)) * fabs(x))))));
}
double code(double x) {
return fabs((x * ((2.0 + (x * (x * (0.6666666666666666 + ((0.2 + (0.047619047619047616 * (x * x))) * (x * x)))))) / sqrt(((double) M_PI)))));
}
public static double code(double x) {
return Math.abs(((1.0 / Math.sqrt(Math.PI)) * ((((2.0 * Math.abs(x)) + ((2.0 / 3.0) * ((Math.abs(x) * Math.abs(x)) * Math.abs(x)))) + ((1.0 / 5.0) * ((((Math.abs(x) * Math.abs(x)) * Math.abs(x)) * Math.abs(x)) * Math.abs(x)))) + ((1.0 / 21.0) * ((((((Math.abs(x) * Math.abs(x)) * Math.abs(x)) * Math.abs(x)) * Math.abs(x)) * Math.abs(x)) * Math.abs(x))))));
}
public static double code(double x) {
return Math.abs((x * ((2.0 + (x * (x * (0.6666666666666666 + ((0.2 + (0.047619047619047616 * (x * x))) * (x * x)))))) / Math.sqrt(Math.PI))));
}
def code(x): return math.fabs(((1.0 / math.sqrt(math.pi)) * ((((2.0 * math.fabs(x)) + ((2.0 / 3.0) * ((math.fabs(x) * math.fabs(x)) * math.fabs(x)))) + ((1.0 / 5.0) * ((((math.fabs(x) * math.fabs(x)) * math.fabs(x)) * math.fabs(x)) * math.fabs(x)))) + ((1.0 / 21.0) * ((((((math.fabs(x) * math.fabs(x)) * math.fabs(x)) * math.fabs(x)) * math.fabs(x)) * math.fabs(x)) * math.fabs(x))))))
def code(x): return math.fabs((x * ((2.0 + (x * (x * (0.6666666666666666 + ((0.2 + (0.047619047619047616 * (x * x))) * (x * x)))))) / math.sqrt(math.pi))))
function code(x) return abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(Float64(Float64(Float64(2.0 * abs(x)) + Float64(Float64(2.0 / 3.0) * Float64(Float64(abs(x) * abs(x)) * abs(x)))) + Float64(Float64(1.0 / 5.0) * Float64(Float64(Float64(Float64(abs(x) * abs(x)) * abs(x)) * abs(x)) * abs(x)))) + Float64(Float64(1.0 / 21.0) * Float64(Float64(Float64(Float64(Float64(Float64(abs(x) * abs(x)) * abs(x)) * abs(x)) * abs(x)) * abs(x)) * abs(x)))))) end
function code(x) return abs(Float64(x * Float64(Float64(2.0 + Float64(x * Float64(x * Float64(0.6666666666666666 + Float64(Float64(0.2 + Float64(0.047619047619047616 * Float64(x * x))) * Float64(x * x)))))) / sqrt(pi)))) end
function tmp = code(x) tmp = abs(((1.0 / sqrt(pi)) * ((((2.0 * abs(x)) + ((2.0 / 3.0) * ((abs(x) * abs(x)) * abs(x)))) + ((1.0 / 5.0) * ((((abs(x) * abs(x)) * abs(x)) * abs(x)) * abs(x)))) + ((1.0 / 21.0) * ((((((abs(x) * abs(x)) * abs(x)) * abs(x)) * abs(x)) * abs(x)) * abs(x)))))); end
function tmp = code(x) tmp = abs((x * ((2.0 + (x * (x * (0.6666666666666666 + ((0.2 + (0.047619047619047616 * (x * x))) * (x * x)))))) / sqrt(pi)))); end
code[x_] := N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(2.0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 / 3.0), $MachinePrecision] * N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 5.0), $MachinePrecision] * N[(N[(N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 21.0), $MachinePrecision] * N[(N[(N[(N[(N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[x_] := N[Abs[N[(x * N[(N[(2.0 + N[(x * N[(x * N[(0.6666666666666666 + N[(N[(0.2 + N[(0.047619047619047616 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right|
\left|x \cdot \frac{2 + x \cdot \left(x \cdot \left(0.6666666666666666 + \left(0.2 + 0.047619047619047616 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)}{\sqrt{\pi}}\right|
Results
Initial program 0.2
Simplified0.6
[Start]0.2 | \[ \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right|
\] |
|---|---|
rational.json-simplify-19 [=>]29.3 | \[ \color{blue}{\frac{\left(\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right) \cdot \left(\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right)}{\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right|}}
\] |
Applied egg-rr0.6
Simplified0.1
[Start]0.6 | \[ \left|\frac{x \cdot \left(2 + \left(x \cdot \left(x \cdot 0.6666666666666666\right) + \left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(0.2 + x \cdot \left(x \cdot 0.047619047619047616\right)\right)\right)\right)\right)}{\sqrt{\pi}}\right| + 0
\] |
|---|---|
rational.json-simplify-4 [=>]0.6 | \[ \color{blue}{\left|\frac{x \cdot \left(2 + \left(x \cdot \left(x \cdot 0.6666666666666666\right) + \left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(0.2 + x \cdot \left(x \cdot 0.047619047619047616\right)\right)\right)\right)\right)}{\sqrt{\pi}}\right|}
\] |
rational.json-simplify-2 [=>]0.6 | \[ \left|\frac{\color{blue}{\left(2 + \left(x \cdot \left(x \cdot 0.6666666666666666\right) + \left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(0.2 + x \cdot \left(x \cdot 0.047619047619047616\right)\right)\right)\right)\right) \cdot x}}{\sqrt{\pi}}\right|
\] |
rational.json-simplify-49 [=>]0.1 | \[ \left|\color{blue}{x \cdot \frac{2 + \left(x \cdot \left(x \cdot 0.6666666666666666\right) + \left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(0.2 + x \cdot \left(x \cdot 0.047619047619047616\right)\right)\right)\right)}{\sqrt{\pi}}}\right|
\] |
Applied egg-rr0.1
Simplified0.1
[Start]0.1 | \[ \left|x \cdot \frac{2 + \left(\left(x \cdot x\right) \cdot \left(0.6666666666666666 + \left(0.2 + x \cdot \left(x \cdot 0.047619047619047616\right)\right) \cdot \left(x \cdot x\right)\right) + 0\right)}{\sqrt{\pi}}\right|
\] |
|---|---|
rational.json-simplify-4 [=>]0.1 | \[ \left|x \cdot \frac{2 + \color{blue}{\left(x \cdot x\right) \cdot \left(0.6666666666666666 + \left(0.2 + x \cdot \left(x \cdot 0.047619047619047616\right)\right) \cdot \left(x \cdot x\right)\right)}}{\sqrt{\pi}}\right|
\] |
rational.json-simplify-2 [=>]0.1 | \[ \left|x \cdot \frac{2 + \color{blue}{\left(0.6666666666666666 + \left(0.2 + x \cdot \left(x \cdot 0.047619047619047616\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)}}{\sqrt{\pi}}\right|
\] |
rational.json-simplify-43 [=>]0.1 | \[ \left|x \cdot \frac{2 + \color{blue}{x \cdot \left(x \cdot \left(0.6666666666666666 + \left(0.2 + x \cdot \left(x \cdot 0.047619047619047616\right)\right) \cdot \left(x \cdot x\right)\right)\right)}}{\sqrt{\pi}}\right|
\] |
rational.json-simplify-43 [<=]0.1 | \[ \left|x \cdot \frac{2 + x \cdot \left(x \cdot \left(0.6666666666666666 + \left(0.2 + \color{blue}{0.047619047619047616 \cdot \left(x \cdot x\right)}\right) \cdot \left(x \cdot x\right)\right)\right)}{\sqrt{\pi}}\right|
\] |
Final simplification0.1
| Alternative 1 | |
|---|---|
| Error | 4.1 |
| Cost | 20352 |
| Alternative 2 | |
|---|---|
| Error | 4.1 |
| Cost | 20224 |
| Alternative 3 | |
|---|---|
| Error | 4.2 |
| Cost | 19840 |
| Alternative 4 | |
|---|---|
| Error | 4.6 |
| Cost | 19584 |
herbie shell --seed 2023073
(FPCore (x)
:name "Jmat.Real.erfi, branch x less than or equal to 0.5"
:precision binary64
:pre (<= x 0.5)
(fabs (* (/ 1.0 (sqrt PI)) (+ (+ (+ (* 2.0 (fabs x)) (* (/ 2.0 3.0) (* (* (fabs x) (fabs x)) (fabs x)))) (* (/ 1.0 5.0) (* (* (* (* (fabs x) (fabs x)) (fabs x)) (fabs x)) (fabs x)))) (* (/ 1.0 21.0) (* (* (* (* (* (* (fabs x) (fabs x)) (fabs x)) (fabs x)) (fabs x)) (fabs x)) (fabs x)))))))