Alternative 1 | |
---|---|
Error | 0.6 |
Cost | 7744 |
\[\frac{0.0625}{w \cdot w} \cdot \sqrt{\left(k + 3\right) \cdot \left(\left(k + 4\right) \cdot \left(\left(k + 2\right) \cdot \left(k + 1\right)\right)\right)}
\]
(FPCore (w k) :precision binary64 (* (/ 1.0 (* 16.0 (pow w 2.0))) (sqrt (* (* (* (+ k 1.0) (+ k 2.0)) (+ k 3.0)) (+ k 4.0)))))
(FPCore (w k) :precision binary64 (* (/ (/ 0.0625 w) (/ w (sqrt (+ k 3.0)))) (sqrt (* (+ k 2.0) (* (+ k 4.0) (+ k 1.0))))))
double code(double w, double k) { return (1.0 / (16.0 * pow(w, 2.0))) * sqrt(((((k + 1.0) * (k + 2.0)) * (k + 3.0)) * (k + 4.0))); }
double code(double w, double k) { return ((0.0625 / w) / (w / sqrt((k + 3.0)))) * sqrt(((k + 2.0) * ((k + 4.0) * (k + 1.0)))); }
real(8) function code(w, k) real(8), intent (in) :: w real(8), intent (in) :: k code = (1.0d0 / (16.0d0 * (w ** 2.0d0))) * sqrt(((((k + 1.0d0) * (k + 2.0d0)) * (k + 3.0d0)) * (k + 4.0d0))) end function
real(8) function code(w, k) real(8), intent (in) :: w real(8), intent (in) :: k code = ((0.0625d0 / w) / (w / sqrt((k + 3.0d0)))) * sqrt(((k + 2.0d0) * ((k + 4.0d0) * (k + 1.0d0)))) end function
public static double code(double w, double k) { return (1.0 / (16.0 * Math.pow(w, 2.0))) * Math.sqrt(((((k + 1.0) * (k + 2.0)) * (k + 3.0)) * (k + 4.0))); }
public static double code(double w, double k) { return ((0.0625 / w) / (w / Math.sqrt((k + 3.0)))) * Math.sqrt(((k + 2.0) * ((k + 4.0) * (k + 1.0)))); }
def code(w, k): return (1.0 / (16.0 * math.pow(w, 2.0))) * math.sqrt(((((k + 1.0) * (k + 2.0)) * (k + 3.0)) * (k + 4.0)))
def code(w, k): return ((0.0625 / w) / (w / math.sqrt((k + 3.0)))) * math.sqrt(((k + 2.0) * ((k + 4.0) * (k + 1.0))))
function code(w, k) return Float64(Float64(1.0 / Float64(16.0 * (w ^ 2.0))) * sqrt(Float64(Float64(Float64(Float64(k + 1.0) * Float64(k + 2.0)) * Float64(k + 3.0)) * Float64(k + 4.0)))) end
function code(w, k) return Float64(Float64(Float64(0.0625 / w) / Float64(w / sqrt(Float64(k + 3.0)))) * sqrt(Float64(Float64(k + 2.0) * Float64(Float64(k + 4.0) * Float64(k + 1.0))))) end
function tmp = code(w, k) tmp = (1.0 / (16.0 * (w ^ 2.0))) * sqrt(((((k + 1.0) * (k + 2.0)) * (k + 3.0)) * (k + 4.0))); end
function tmp = code(w, k) tmp = ((0.0625 / w) / (w / sqrt((k + 3.0)))) * sqrt(((k + 2.0) * ((k + 4.0) * (k + 1.0)))); end
code[w_, k_] := N[(N[(1.0 / N[(16.0 * N[Power[w, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(N[(N[(k + 1.0), $MachinePrecision] * N[(k + 2.0), $MachinePrecision]), $MachinePrecision] * N[(k + 3.0), $MachinePrecision]), $MachinePrecision] * N[(k + 4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[w_, k_] := N[(N[(N[(0.0625 / w), $MachinePrecision] / N[(w / N[Sqrt[N[(k + 3.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(k + 2.0), $MachinePrecision] * N[(N[(k + 4.0), $MachinePrecision] * N[(k + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\frac{1}{16 \cdot {w}^{2}} \cdot \sqrt{\left(\left(\left(k + 1\right) \cdot \left(k + 2\right)\right) \cdot \left(k + 3\right)\right) \cdot \left(k + 4\right)}
\frac{\frac{0.0625}{w}}{\frac{w}{\sqrt{k + 3}}} \cdot \sqrt{\left(k + 2\right) \cdot \left(\left(k + 4\right) \cdot \left(k + 1\right)\right)}
Results
Initial program 0.6
Simplified0.6
[Start]0.6 | \[ \frac{1}{16 \cdot {w}^{2}} \cdot \sqrt{\left(\left(\left(k + 1\right) \cdot \left(k + 2\right)\right) \cdot \left(k + 3\right)\right) \cdot \left(k + 4\right)}
\] |
---|---|
associate-/r* [=>]0.6 | \[ \color{blue}{\frac{\frac{1}{16}}{{w}^{2}}} \cdot \sqrt{\left(\left(\left(k + 1\right) \cdot \left(k + 2\right)\right) \cdot \left(k + 3\right)\right) \cdot \left(k + 4\right)}
\] |
metadata-eval [=>]0.6 | \[ \frac{\color{blue}{0.0625}}{{w}^{2}} \cdot \sqrt{\left(\left(\left(k + 1\right) \cdot \left(k + 2\right)\right) \cdot \left(k + 3\right)\right) \cdot \left(k + 4\right)}
\] |
unpow2 [=>]0.6 | \[ \frac{0.0625}{\color{blue}{w \cdot w}} \cdot \sqrt{\left(\left(\left(k + 1\right) \cdot \left(k + 2\right)\right) \cdot \left(k + 3\right)\right) \cdot \left(k + 4\right)}
\] |
*-commutative [=>]0.6 | \[ \frac{0.0625}{w \cdot w} \cdot \sqrt{\color{blue}{\left(\left(k + 3\right) \cdot \left(\left(k + 1\right) \cdot \left(k + 2\right)\right)\right)} \cdot \left(k + 4\right)}
\] |
associate-*l* [=>]0.6 | \[ \frac{0.0625}{w \cdot w} \cdot \sqrt{\color{blue}{\left(k + 3\right) \cdot \left(\left(\left(k + 1\right) \cdot \left(k + 2\right)\right) \cdot \left(k + 4\right)\right)}}
\] |
+-commutative [=>]0.6 | \[ \frac{0.0625}{w \cdot w} \cdot \sqrt{\left(k + 3\right) \cdot \left(\left(\color{blue}{\left(1 + k\right)} \cdot \left(k + 2\right)\right) \cdot \left(k + 4\right)\right)}
\] |
+-commutative [=>]0.6 | \[ \frac{0.0625}{w \cdot w} \cdot \sqrt{\left(k + 3\right) \cdot \left(\left(\left(1 + k\right) \cdot \color{blue}{\left(2 + k\right)}\right) \cdot \left(k + 4\right)\right)}
\] |
Applied egg-rr0.6
Applied egg-rr0.5
Final simplification0.5
Alternative 1 | |
---|---|
Error | 0.6 |
Cost | 7744 |
Alternative 2 | |
---|---|
Error | 1.9 |
Cost | 7616 |
Alternative 3 | |
---|---|
Error | 1.9 |
Cost | 7360 |
Alternative 4 | |
---|---|
Error | 1.9 |
Cost | 7104 |
Alternative 5 | |
---|---|
Error | 2.3 |
Cost | 6912 |
Alternative 6 | |
---|---|
Error | 2.3 |
Cost | 6912 |
Alternative 7 | |
---|---|
Error | 2.7 |
Cost | 6848 |
Alternative 8 | |
---|---|
Error | 2.5 |
Cost | 6848 |
Alternative 9 | |
---|---|
Error | 2.5 |
Cost | 6848 |
Alternative 10 | |
---|---|
Error | 61.3 |
Cost | 576 |
herbie shell --seed 1
(FPCore (w k)
:name " (1/(16*w^2))*sqrt((k+1)*(k+2)*(k+3)*(k+4))"
:precision binary64
:pre (and (and (<= 0.0 w) (<= w 10.0)) (and (<= 0.0 k) (<= k 10000.0)))
(* (/ 1.0 (* 16.0 (pow w 2.0))) (sqrt (* (* (* (+ k 1.0) (+ k 2.0)) (+ k 3.0)) (+ k 4.0)))))