Alternative 1 | |
---|---|
Error | 0.1 |
Cost | 19840 |
\[\sqrt{8 \cdot {x}^{3}} + \sqrt{x \cdot \left(3 - x\right)}
\]
(FPCore (x) :precision binary64 (+ (sqrt (- (* 3.0 x) (pow x 2.0))) (sqrt (* 8.0 (pow x 3.0)))))
(FPCore (x) :precision binary64 (+ (sqrt (- (* 3.0 x) (* x x))) (sqrt (* 8.0 (pow x 3.0)))))
double code(double x) { return sqrt(((3.0 * x) - pow(x, 2.0))) + sqrt((8.0 * pow(x, 3.0))); }
double code(double x) { return sqrt(((3.0 * x) - (x * x))) + sqrt((8.0 * pow(x, 3.0))); }
real(8) function code(x) real(8), intent (in) :: x code = sqrt(((3.0d0 * x) - (x ** 2.0d0))) + sqrt((8.0d0 * (x ** 3.0d0))) end function
real(8) function code(x) real(8), intent (in) :: x code = sqrt(((3.0d0 * x) - (x * x))) + sqrt((8.0d0 * (x ** 3.0d0))) end function
public static double code(double x) { return Math.sqrt(((3.0 * x) - Math.pow(x, 2.0))) + Math.sqrt((8.0 * Math.pow(x, 3.0))); }
public static double code(double x) { return Math.sqrt(((3.0 * x) - (x * x))) + Math.sqrt((8.0 * Math.pow(x, 3.0))); }
def code(x): return math.sqrt(((3.0 * x) - math.pow(x, 2.0))) + math.sqrt((8.0 * math.pow(x, 3.0)))
def code(x): return math.sqrt(((3.0 * x) - (x * x))) + math.sqrt((8.0 * math.pow(x, 3.0)))
function code(x) return Float64(sqrt(Float64(Float64(3.0 * x) - (x ^ 2.0))) + sqrt(Float64(8.0 * (x ^ 3.0)))) end
function code(x) return Float64(sqrt(Float64(Float64(3.0 * x) - Float64(x * x))) + sqrt(Float64(8.0 * (x ^ 3.0)))) end
function tmp = code(x) tmp = sqrt(((3.0 * x) - (x ^ 2.0))) + sqrt((8.0 * (x ^ 3.0))); end
function tmp = code(x) tmp = sqrt(((3.0 * x) - (x * x))) + sqrt((8.0 * (x ^ 3.0))); end
code[x_] := N[(N[Sqrt[N[(N[(3.0 * x), $MachinePrecision] - N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(8.0 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x_] := N[(N[Sqrt[N[(N[(3.0 * x), $MachinePrecision] - N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(8.0 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\sqrt{3 \cdot x - {x}^{2}} + \sqrt{8 \cdot {x}^{3}}
\sqrt{3 \cdot x - x \cdot x} + \sqrt{8 \cdot {x}^{3}}
Results
Initial program 0.1
Simplified0.1
[Start]0.1 | \[ \sqrt{3 \cdot x - {x}^{2}} + \sqrt{8 \cdot {x}^{3}}
\] |
---|---|
unpow2 [=>]0.1 | \[ \sqrt{3 \cdot x - \color{blue}{x \cdot x}} + \sqrt{8 \cdot {x}^{3}}
\] |
Final simplification0.1
Alternative 1 | |
---|---|
Error | 0.1 |
Cost | 19840 |
Alternative 2 | |
---|---|
Error | 1.3 |
Cost | 19712 |
herbie shell --seed 1
(FPCore (x)
:name "sqrt(3*x - x^2) + sqrt(8*x^3)"
:precision binary64
:pre (and (<= 0.0 x) (<= x 100.0))
(+ (sqrt (- (* 3.0 x) (pow x 2.0))) (sqrt (* 8.0 (pow x 3.0)))))