?

Average Error: 0.2 → 0.1
Time: 5.4s
Precision: binary64
Cost: 53568

?

\[x \leq 0.5\]
\[\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|x\right| \cdot \left(0.2 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) + \left(\left|x\right| \cdot \left(0.047619047619047616 \cdot \left({x}^{4} \cdot \left(x \cdot x\right)\right)\right) + \left(2 \cdot \left|x\right| + \left|x\right| \cdot \left(0.6666666666666666 \cdot \left(x \cdot x\right)\right)\right)\right)\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
  (*
   (/ 1.0 (sqrt PI))
   (+
    (* (fabs x) (* 0.2 (* (* x x) (* x x))))
    (+
     (* (fabs x) (* 0.047619047619047616 (* (pow x 4.0) (* x x))))
     (+ (* 2.0 (fabs x)) (* (fabs x) (* 0.6666666666666666 (* x x)))))))))
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(((1.0 / sqrt(((double) M_PI))) * ((fabs(x) * (0.2 * ((x * x) * (x * x)))) + ((fabs(x) * (0.047619047619047616 * (pow(x, 4.0) * (x * x)))) + ((2.0 * fabs(x)) + (fabs(x) * (0.6666666666666666 * (x * x))))))));
}
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(((1.0 / Math.sqrt(Math.PI)) * ((Math.abs(x) * (0.2 * ((x * x) * (x * x)))) + ((Math.abs(x) * (0.047619047619047616 * (Math.pow(x, 4.0) * (x * x)))) + ((2.0 * Math.abs(x)) + (Math.abs(x) * (0.6666666666666666 * (x * x))))))));
}
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(((1.0 / math.sqrt(math.pi)) * ((math.fabs(x) * (0.2 * ((x * x) * (x * x)))) + ((math.fabs(x) * (0.047619047619047616 * (math.pow(x, 4.0) * (x * x)))) + ((2.0 * math.fabs(x)) + (math.fabs(x) * (0.6666666666666666 * (x * x))))))))
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(Float64(1.0 / sqrt(pi)) * Float64(Float64(abs(x) * Float64(0.2 * Float64(Float64(x * x) * Float64(x * x)))) + Float64(Float64(abs(x) * Float64(0.047619047619047616 * Float64((x ^ 4.0) * Float64(x * x)))) + Float64(Float64(2.0 * abs(x)) + Float64(abs(x) * Float64(0.6666666666666666 * Float64(x * x))))))))
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(((1.0 / sqrt(pi)) * ((abs(x) * (0.2 * ((x * x) * (x * x)))) + ((abs(x) * (0.047619047619047616 * ((x ^ 4.0) * (x * x)))) + ((2.0 * abs(x)) + (abs(x) * (0.6666666666666666 * (x * x))))))));
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[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Abs[x], $MachinePrecision] * N[(0.2 * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Abs[x], $MachinePrecision] * N[(0.047619047619047616 * N[(N[Power[x, 4.0], $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] + N[(N[Abs[x], $MachinePrecision] * N[(0.6666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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|\frac{1}{\sqrt{\pi}} \cdot \left(\left|x\right| \cdot \left(0.2 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) + \left(\left|x\right| \cdot \left(0.047619047619047616 \cdot \left({x}^{4} \cdot \left(x \cdot x\right)\right)\right) + \left(2 \cdot \left|x\right| + \left|x\right| \cdot \left(0.6666666666666666 \cdot \left(x \cdot x\right)\right)\right)\right)\right)\right|

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 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| \]
  2. Simplified0.1

    \[\leadsto \color{blue}{\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left|x\right| \cdot \left(0.2 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) + \left(\left|x\right| \cdot \left(0.047619047619047616 \cdot \left(\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right) + \left(2 \cdot \left|x\right| + \left|x\right| \cdot \left(0.6666666666666666 \cdot \left(x \cdot x\right)\right)\right)\right)\right)\right|} \]
    Proof

    [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_best_oopsla_all_46_json_45_simplify-35 [=>]0.2

    \[ \left|\frac{1}{\sqrt{\pi}} \cdot \color{blue}{\left(\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) + \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)\right)}\right| \]
  3. Taylor expanded in x around 0 0.1

    \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left|x\right| \cdot \left(0.2 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) + \left(\left|x\right| \cdot \left(0.047619047619047616 \cdot \left(\color{blue}{{x}^{4}} \cdot \left(x \cdot x\right)\right)\right) + \left(2 \cdot \left|x\right| + \left|x\right| \cdot \left(0.6666666666666666 \cdot \left(x \cdot x\right)\right)\right)\right)\right)\right| \]
  4. Final simplification0.1

    \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left|x\right| \cdot \left(0.2 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) + \left(\left|x\right| \cdot \left(0.047619047619047616 \cdot \left({x}^{4} \cdot \left(x \cdot x\right)\right)\right) + \left(2 \cdot \left|x\right| + \left|x\right| \cdot \left(0.6666666666666666 \cdot \left(x \cdot x\right)\right)\right)\right)\right)\right| \]

Alternatives

Alternative 1
Error0.1
Cost40960
\[\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left|x\right| \cdot \left(2 + x \cdot \left(0.6666666666666666 \cdot x\right)\right) + \left(x \cdot x\right) \cdot \left(\left(\left|x\right| \cdot 0.2\right) \cdot \left(x \cdot x\right)\right)\right) + \left|x\right| \cdot \left(\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right) \cdot \left(x \cdot \left(x \cdot 0.047619047619047616\right)\right)\right)\right)\right| \]
Alternative 2
Error0.1
Cost33920
\[\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left|x\right| \cdot \left(2 + x \cdot \left(x \cdot 0.6666666666666666\right)\right) + \left(x \cdot \left(x \cdot \left(x \cdot \left(x \cdot \left|x\right|\right)\right)\right)\right) \cdot \left(0.2 + \left(x \cdot x\right) \cdot 0.047619047619047616\right)\right)\right| \]

Error

Reproduce?

herbie shell --seed 2023090 
(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)))))))