| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 7424 |
\[b \cdot \left(4 \cdot b\right) + \left({\left(a \cdot a + b \cdot b\right)}^{2} - 1\right)
\]
(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
Results
Initial program 0.2
Simplified0.2
[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)
\] |
Taylor expanded in b around inf 0.0
Final simplification0.0
| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 7424 |
| Alternative 2 | |
|---|---|
| Error | 2.1 |
| Cost | 7304 |
| Alternative 3 | |
|---|---|
| Error | 1.8 |
| Cost | 7304 |
| Alternative 4 | |
|---|---|
| Error | 2.5 |
| Cost | 6920 |
| Alternative 5 | |
|---|---|
| Error | 11.7 |
| Cost | 6792 |
| Alternative 6 | |
|---|---|
| Error | 23.4 |
| Cost | 448 |
| Alternative 7 | |
|---|---|
| Error | 24.5 |
| Cost | 64 |
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))