?

Average Error: 0.2 → 0.1
Time: 12.0s
Precision: binary64
Cost: 576

?

\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right) \]
\[3 + x \cdot \left(x \cdot 9 - 12\right) \]
(FPCore (x) :precision binary64 (* 3.0 (+ (- (* (* x 3.0) x) (* x 4.0)) 1.0)))
(FPCore (x) :precision binary64 (+ 3.0 (* x (- (* x 9.0) 12.0))))
double code(double x) {
	return 3.0 * ((((x * 3.0) * x) - (x * 4.0)) + 1.0);
}
double code(double x) {
	return 3.0 + (x * ((x * 9.0) - 12.0));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = 3.0d0 * ((((x * 3.0d0) * x) - (x * 4.0d0)) + 1.0d0)
end function
real(8) function code(x)
    real(8), intent (in) :: x
    code = 3.0d0 + (x * ((x * 9.0d0) - 12.0d0))
end function
public static double code(double x) {
	return 3.0 * ((((x * 3.0) * x) - (x * 4.0)) + 1.0);
}
public static double code(double x) {
	return 3.0 + (x * ((x * 9.0) - 12.0));
}
def code(x):
	return 3.0 * ((((x * 3.0) * x) - (x * 4.0)) + 1.0)
def code(x):
	return 3.0 + (x * ((x * 9.0) - 12.0))
function code(x)
	return Float64(3.0 * Float64(Float64(Float64(Float64(x * 3.0) * x) - Float64(x * 4.0)) + 1.0))
end
function code(x)
	return Float64(3.0 + Float64(x * Float64(Float64(x * 9.0) - 12.0)))
end
function tmp = code(x)
	tmp = 3.0 * ((((x * 3.0) * x) - (x * 4.0)) + 1.0);
end
function tmp = code(x)
	tmp = 3.0 + (x * ((x * 9.0) - 12.0));
end
code[x_] := N[(3.0 * N[(N[(N[(N[(x * 3.0), $MachinePrecision] * x), $MachinePrecision] - N[(x * 4.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
code[x_] := N[(3.0 + N[(x * N[(N[(x * 9.0), $MachinePrecision] - 12.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
3 + x \cdot \left(x \cdot 9 - 12\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.2
Target0.1
Herbie0.1
\[3 + \left(\left(9 \cdot x\right) \cdot x - 12 \cdot x\right) \]

Derivation?

  1. Initial program 0.2

    \[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right) \]
  2. Applied egg-rr0.2

    \[\leadsto \color{blue}{x \cdot \left(x \cdot 3 + -4\right) + \left(\left(x \cdot \left(x \cdot 3 + -4\right) + 1\right) + \left(x \cdot \left(x \cdot 3 + -4\right) + 2\right)\right)} \]
  3. Simplified0.1

    \[\leadsto \color{blue}{3 + x \cdot \left(3 \cdot \left(-4 + 3 \cdot x\right)\right)} \]
    Proof

    [Start]0.2

    \[ x \cdot \left(x \cdot 3 + -4\right) + \left(\left(x \cdot \left(x \cdot 3 + -4\right) + 1\right) + \left(x \cdot \left(x \cdot 3 + -4\right) + 2\right)\right) \]

    rational.json-simplify-41 [=>]0.2

    \[ \color{blue}{\left(x \cdot \left(x \cdot 3 + -4\right) + 1\right) + \left(\left(x \cdot \left(x \cdot 3 + -4\right) + 2\right) + x \cdot \left(x \cdot 3 + -4\right)\right)} \]

    rational.json-simplify-1 [=>]0.2

    \[ \left(x \cdot \left(x \cdot 3 + -4\right) + 1\right) + \color{blue}{\left(x \cdot \left(x \cdot 3 + -4\right) + \left(x \cdot \left(x \cdot 3 + -4\right) + 2\right)\right)} \]

    rational.json-simplify-41 [<=]0.1

    \[ \left(x \cdot \left(x \cdot 3 + -4\right) + 1\right) + \color{blue}{\left(2 + \left(x \cdot \left(x \cdot 3 + -4\right) + x \cdot \left(x \cdot 3 + -4\right)\right)\right)} \]

    rational.json-simplify-7 [<=]0.1

    \[ \left(x \cdot \left(x \cdot 3 + -4\right) + 1\right) + \left(2 + \left(x \cdot \left(x \cdot 3 + -4\right) + \color{blue}{\frac{x \cdot \left(x \cdot 3 + -4\right)}{1}}\right)\right) \]

    rational.json-simplify-30 [<=]0.1

    \[ \left(x \cdot \left(x \cdot 3 + -4\right) + 1\right) + \left(2 + \color{blue}{\left(1 + 1\right) \cdot \frac{x \cdot \left(x \cdot 3 + -4\right)}{1}}\right) \]

    metadata-eval [=>]0.1

    \[ \left(x \cdot \left(x \cdot 3 + -4\right) + 1\right) + \left(2 + \color{blue}{2} \cdot \frac{x \cdot \left(x \cdot 3 + -4\right)}{1}\right) \]

    rational.json-simplify-7 [=>]0.1

    \[ \left(x \cdot \left(x \cdot 3 + -4\right) + 1\right) + \left(2 + 2 \cdot \color{blue}{\left(x \cdot \left(x \cdot 3 + -4\right)\right)}\right) \]

    rational.json-simplify-2 [<=]0.1

    \[ \left(x \cdot \left(x \cdot 3 + -4\right) + 1\right) + \left(2 + 2 \cdot \color{blue}{\left(\left(x \cdot 3 + -4\right) \cdot x\right)}\right) \]

    rational.json-simplify-43 [<=]0.1

    \[ \left(x \cdot \left(x \cdot 3 + -4\right) + 1\right) + \left(2 + \color{blue}{x \cdot \left(2 \cdot \left(x \cdot 3 + -4\right)\right)}\right) \]

    rational.json-simplify-41 [=>]0.1

    \[ \color{blue}{2 + \left(x \cdot \left(2 \cdot \left(x \cdot 3 + -4\right)\right) + \left(x \cdot \left(x \cdot 3 + -4\right) + 1\right)\right)} \]

    rational.json-simplify-1 [=>]0.1

    \[ 2 + \left(x \cdot \left(2 \cdot \left(x \cdot 3 + -4\right)\right) + \color{blue}{\left(1 + x \cdot \left(x \cdot 3 + -4\right)\right)}\right) \]

    rational.json-simplify-41 [=>]0.1

    \[ 2 + \color{blue}{\left(1 + \left(x \cdot \left(x \cdot 3 + -4\right) + x \cdot \left(2 \cdot \left(x \cdot 3 + -4\right)\right)\right)\right)} \]

    rational.json-simplify-17 [=>]0.1

    \[ 2 + \color{blue}{\left(\left(x \cdot \left(x \cdot 3 + -4\right) + x \cdot \left(2 \cdot \left(x \cdot 3 + -4\right)\right)\right) - -1\right)} \]
  4. Taylor expanded in x around 0 0.1

    \[\leadsto 3 + x \cdot \color{blue}{\left(9 \cdot x - 12\right)} \]
  5. Simplified0.1

    \[\leadsto 3 + x \cdot \color{blue}{\left(x \cdot 9 - 12\right)} \]
    Proof

    [Start]0.1

    \[ 3 + x \cdot \left(9 \cdot x - 12\right) \]

    rational.json-simplify-2 [=>]0.1

    \[ 3 + x \cdot \left(\color{blue}{x \cdot 9} - 12\right) \]
  6. Final simplification0.1

    \[\leadsto 3 + x \cdot \left(x \cdot 9 - 12\right) \]

Alternatives

Alternative 1
Error2.2
Cost448
\[3 + x \cdot \left(x \cdot 9\right) \]
Alternative 2
Error20.9
Cost320
\[-12 \cdot x + 3 \]
Alternative 3
Error21.2
Cost64
\[3 \]

Error

Reproduce?

herbie shell --seed 2023064 
(FPCore (x)
  :name "Diagrams.Tangent:$catParam from diagrams-lib-1.3.0.3, D"
  :precision binary64

  :herbie-target
  (+ 3.0 (- (* (* 9.0 x) x) (* 12.0 x)))

  (* 3.0 (+ (- (* (* x 3.0) x) (* x 4.0)) 1.0)))