?

Average Error: 0.2 → 0.0
Time: 6.3s
Precision: binary64
Cost: 26688

?

\[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
\[\left({a}^{4} + \left({b}^{4} + \left(4 + 2 \cdot {a}^{2}\right) \cdot {b}^{2}\right)\right) - 1 \]
(FPCore (a b)
 :precision binary64
 (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (* b b))) 1.0))
(FPCore (a b)
 :precision binary64
 (-
  (+ (pow a 4.0) (+ (pow b 4.0) (* (+ 4.0 (* 2.0 (pow a 2.0))) (pow b 2.0))))
  1.0))
double code(double a, double b) {
	return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0;
}
double code(double a, double b) {
	return (pow(a, 4.0) + (pow(b, 4.0) + ((4.0 + (2.0 * pow(a, 2.0))) * pow(b, 2.0)))) - 1.0;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = ((((a * a) + (b * b)) ** 2.0d0) + (4.0d0 * (b * b))) - 1.0d0
end function
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = ((a ** 4.0d0) + ((b ** 4.0d0) + ((4.0d0 + (2.0d0 * (a ** 2.0d0))) * (b ** 2.0d0)))) - 1.0d0
end function
public static double code(double a, double b) {
	return (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0;
}
public static double code(double a, double b) {
	return (Math.pow(a, 4.0) + (Math.pow(b, 4.0) + ((4.0 + (2.0 * Math.pow(a, 2.0))) * Math.pow(b, 2.0)))) - 1.0;
}
def code(a, b):
	return (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0
def code(a, b):
	return (math.pow(a, 4.0) + (math.pow(b, 4.0) + ((4.0 + (2.0 * math.pow(a, 2.0))) * math.pow(b, 2.0)))) - 1.0
function code(a, b)
	return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(b * b))) - 1.0)
end
function code(a, b)
	return Float64(Float64((a ^ 4.0) + Float64((b ^ 4.0) + Float64(Float64(4.0 + Float64(2.0 * (a ^ 2.0))) * (b ^ 2.0)))) - 1.0)
end
function tmp = code(a, b)
	tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (b * b))) - 1.0;
end
function tmp = code(a, b)
	tmp = ((a ^ 4.0) + ((b ^ 4.0) + ((4.0 + (2.0 * (a ^ 2.0))) * (b ^ 2.0)))) - 1.0;
end
code[a_, b_] := N[(N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
code[a_, b_] := N[(N[(N[Power[a, 4.0], $MachinePrecision] + N[(N[Power[b, 4.0], $MachinePrecision] + N[(N[(4.0 + N[(2.0 * N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1
\left({a}^{4} + \left({b}^{4} + \left(4 + 2 \cdot {a}^{2}\right) \cdot {b}^{2}\right)\right) - 1

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.2

    \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
  2. Simplified0.2

    \[\leadsto \color{blue}{b \cdot \left(4 \cdot b\right) + \left({\left(a \cdot a + b \cdot b\right)}^{2} - 1\right)} \]
    Proof

    [Start]0.2

    \[ \left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]

    rational_best_oopsla_all_46_json_45_simplify-107 [=>]0.2

    \[ \color{blue}{4 \cdot \left(b \cdot b\right) + \left({\left(a \cdot a + b \cdot b\right)}^{2} - 1\right)} \]

    rational_best_oopsla_all_46_json_45_simplify-7 [=>]0.2

    \[ \color{blue}{b \cdot \left(4 \cdot b\right)} + \left({\left(a \cdot a + b \cdot b\right)}^{2} - 1\right) \]
  3. Taylor expanded in b around inf 0.0

    \[\leadsto \color{blue}{\left({a}^{4} + \left({b}^{4} + \left(4 + 2 \cdot {a}^{2}\right) \cdot {b}^{2}\right)\right) - 1} \]
  4. Final simplification0.0

    \[\leadsto \left({a}^{4} + \left({b}^{4} + \left(4 + 2 \cdot {a}^{2}\right) \cdot {b}^{2}\right)\right) - 1 \]

Alternatives

Alternative 1
Error0.2
Cost7424
\[b \cdot \left(4 \cdot b\right) + \left({\left(a \cdot a + b \cdot b\right)}^{2} - 1\right) \]
Alternative 2
Error2.1
Cost7304
\[\begin{array}{l} \mathbf{if}\;b \leq -16000000:\\ \;\;\;\;{b}^{4}\\ \mathbf{elif}\;b \leq 550:\\ \;\;\;\;b \cdot \left(4 \cdot b\right) + \left({a}^{4} - 1\right)\\ \mathbf{else}:\\ \;\;\;\;{b}^{4}\\ \end{array} \]
Alternative 3
Error1.8
Cost7304
\[\begin{array}{l} t_0 := b \cdot \left(4 \cdot b\right)\\ t_1 := {a}^{4} - 1\\ \mathbf{if}\;a \leq -0.00065:\\ \;\;\;\;t_0 + t_1\\ \mathbf{elif}\;a \leq 4.7 \cdot 10^{-29}:\\ \;\;\;\;t_0 + \left({b}^{4} - 1\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error2.5
Cost6920
\[\begin{array}{l} \mathbf{if}\;b \leq -18500000:\\ \;\;\;\;{b}^{4}\\ \mathbf{elif}\;b \leq 250:\\ \;\;\;\;{a}^{4} - 1\\ \mathbf{else}:\\ \;\;\;\;{b}^{4}\\ \end{array} \]
Alternative 5
Error11.7
Cost6792
\[\begin{array}{l} \mathbf{if}\;a \leq -23:\\ \;\;\;\;{a}^{4}\\ \mathbf{elif}\;a \leq 1:\\ \;\;\;\;b \cdot \left(4 \cdot b\right) + -1\\ \mathbf{else}:\\ \;\;\;\;{a}^{4}\\ \end{array} \]
Alternative 6
Error23.4
Cost448
\[b \cdot \left(4 \cdot b\right) + -1 \]
Alternative 7
Error24.5
Cost64
\[-1 \]

Error

Reproduce?

herbie shell --seed 2023090 
(FPCore (a b)
  :name "Bouland and Aaronson, Equation (26)"
  :precision binary64
  (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (* b b))) 1.0))