?

Average Error: 0.2 → 0.0
Time: 9.7s
Precision: binary64
Cost: 15040

?

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

    \[\leadsto \left(\color{blue}{\left(e^{\mathsf{log1p}\left({\left({\left(\mathsf{hypot}\left(b, a\right)\right)}^{2}\right)}^{2}\right)} - 1\right)} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
  3. Simplified0.0

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

    [Start]2.1

    \[ \left(\left(e^{\mathsf{log1p}\left({\left({\left(\mathsf{hypot}\left(b, a\right)\right)}^{2}\right)}^{2}\right)} - 1\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]

    expm1-def [=>]2.1

    \[ \left(\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left({\left(\mathsf{hypot}\left(b, a\right)\right)}^{2}\right)}^{2}\right)\right)} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]

    expm1-log1p [=>]0.2

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

    unpow2 [=>]0.2

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

    pow-sqr [=>]0.0

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

    metadata-eval [=>]0.0

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

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

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

    [Start]0.0

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

    associate-+r+ [=>]0.0

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

    +-commutative [=>]0.0

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

    metadata-eval [<=]0.0

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

    pow-sqr [<=]0.1

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

    associate-*r* [=>]0.1

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

    distribute-rgt-out [=>]0.1

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

    fma-def [=>]0.1

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

    unpow2 [=>]0.1

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

    +-commutative [=>]0.1

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

    fma-def [=>]0.1

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

    unpow2 [=>]0.1

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

    unpow2 [=>]0.1

    \[ \left(\mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(2, a \cdot a, \color{blue}{b \cdot b}\right), {a}^{4}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
  6. Applied egg-rr0.0

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

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

Alternatives

Alternative 1
Error0.0
Cost14272
\[\left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(a + 3\right)\right) + {\left(\mathsf{hypot}\left(b, a\right)\right)}^{4}\right) + -1 \]
Alternative 2
Error0.2
Cost8192
\[\left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(a + 3\right)\right) + {\left(b \cdot b + a \cdot a\right)}^{2}\right) + -1 \]
Alternative 3
Error0.9
Cost7688
\[\begin{array}{l} \mathbf{if}\;b \leq -4.3 \cdot 10^{-7}:\\ \;\;\;\;\left(b \cdot b\right) \cdot \left(4 \cdot \left(a + 3\right)\right) + \left({b}^{4} + -1\right)\\ \mathbf{elif}\;b \leq 10^{-23}:\\ \;\;\;\;-1 + \left({a}^{4} + 4 \cdot \left(a \cdot \left(a \cdot \left(1 - a\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + \left({\left(b \cdot b + a \cdot a\right)}^{2} + \left(b \cdot b\right) \cdot 12\right)\\ \end{array} \]
Alternative 4
Error1.1
Cost7680
\[\left({\left(b \cdot b + a \cdot a\right)}^{2} + \left(1 - a\right) \cdot \left(\left(a \cdot a\right) \cdot 4\right)\right) + -1 \]
Alternative 5
Error1.6
Cost7560
\[\begin{array}{l} t_0 := {b}^{4} + -1\\ \mathbf{if}\;b \leq -8 \cdot 10^{-7}:\\ \;\;\;\;\left(b \cdot b\right) \cdot \left(4 \cdot \left(a + 3\right)\right) + t_0\\ \mathbf{elif}\;b \leq 0.145:\\ \;\;\;\;-1 + \left({a}^{4} + 4 \cdot \left(a \cdot \left(a \cdot \left(1 - a\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0 + b \cdot \left(b \cdot 12\right)\\ \end{array} \]
Alternative 6
Error2.4
Cost7433
\[\begin{array}{l} \mathbf{if}\;b \leq -2.6 \cdot 10^{-8} \lor \neg \left(b \leq 0.145\right):\\ \;\;\;\;\left({b}^{4} + -1\right) + b \cdot \left(b \cdot 12\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + \left({a}^{4} + -4 \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\\ \end{array} \]
Alternative 7
Error2.4
Cost7432
\[\begin{array}{l} t_0 := {b}^{4} + -1\\ \mathbf{if}\;b \leq -6.5 \cdot 10^{-7}:\\ \;\;\;\;\left(b \cdot b\right) \cdot \left(4 \cdot \left(a + 3\right)\right) + t_0\\ \mathbf{elif}\;b \leq 0.145:\\ \;\;\;\;-1 + \left({a}^{4} + -4 \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0 + b \cdot \left(b \cdot 12\right)\\ \end{array} \]
Alternative 8
Error2.4
Cost7305
\[\begin{array}{l} \mathbf{if}\;b \leq -9.2 \cdot 10^{-7} \lor \neg \left(b \leq 0.145\right):\\ \;\;\;\;\left({b}^{4} + -1\right) + b \cdot \left(b \cdot 12\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + {a}^{3} \cdot \left(a + -4\right)\\ \end{array} \]
Alternative 9
Error3.0
Cost7176
\[\begin{array}{l} \mathbf{if}\;b \leq -3 \cdot 10^{-6}:\\ \;\;\;\;{b}^{4} + -1\\ \mathbf{elif}\;b \leq 13:\\ \;\;\;\;-1 + {a}^{3} \cdot \left(a + -4\right)\\ \mathbf{else}:\\ \;\;\;\;{b}^{4}\\ \end{array} \]
Alternative 10
Error3.4
Cost6920
\[\begin{array}{l} \mathbf{if}\;b \leq -350:\\ \;\;\;\;{b}^{4}\\ \mathbf{elif}\;b \leq 31:\\ \;\;\;\;{a}^{4} + -1\\ \mathbf{else}:\\ \;\;\;\;{b}^{4}\\ \end{array} \]
Alternative 11
Error3.5
Cost6920
\[\begin{array}{l} \mathbf{if}\;b \leq -3 \cdot 10^{-6}:\\ \;\;\;\;{b}^{4} + -1\\ \mathbf{elif}\;b \leq 0.29:\\ \;\;\;\;{a}^{4} + -1\\ \mathbf{else}:\\ \;\;\;\;{b}^{4}\\ \end{array} \]
Alternative 12
Error12.4
Cost6792
\[\begin{array}{l} \mathbf{if}\;b \leq -0.29:\\ \;\;\;\;{b}^{4}\\ \mathbf{elif}\;b \leq 0.14:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;{b}^{4}\\ \end{array} \]
Alternative 13
Error23.5
Cost64
\[-1 \]

Error

Reproduce?

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