| Alternative 1 | |
|---|---|
| Error | 16.2 |
| Cost | 584 |
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.06 \cdot 10^{-34}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{+34}:\\
\;\;\;\;-4 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
(FPCore (x y z) :precision binary64 (- x (* (* y 4.0) z)))
(FPCore (x y z) :precision binary64 (- (+ (* 4.0 (* y z)) x) (* z (* y 8.0))))
double code(double x, double y, double z) {
return x - ((y * 4.0) * z);
}
double code(double x, double y, double z) {
return ((4.0 * (y * z)) + x) - (z * (y * 8.0));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x - ((y * 4.0d0) * z)
end function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((4.0d0 * (y * z)) + x) - (z * (y * 8.0d0))
end function
public static double code(double x, double y, double z) {
return x - ((y * 4.0) * z);
}
public static double code(double x, double y, double z) {
return ((4.0 * (y * z)) + x) - (z * (y * 8.0));
}
def code(x, y, z): return x - ((y * 4.0) * z)
def code(x, y, z): return ((4.0 * (y * z)) + x) - (z * (y * 8.0))
function code(x, y, z) return Float64(x - Float64(Float64(y * 4.0) * z)) end
function code(x, y, z) return Float64(Float64(Float64(4.0 * Float64(y * z)) + x) - Float64(z * Float64(y * 8.0))) end
function tmp = code(x, y, z) tmp = x - ((y * 4.0) * z); end
function tmp = code(x, y, z) tmp = ((4.0 * (y * z)) + x) - (z * (y * 8.0)); end
code[x_, y_, z_] := N[(x - N[(N[(y * 4.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(N[(N[(4.0 * N[(y * z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision] - N[(z * N[(y * 8.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x - \left(y \cdot 4\right) \cdot z
\left(4 \cdot \left(y \cdot z\right) + x\right) - z \cdot \left(y \cdot 8\right)
Results
Initial program 0.1
Applied egg-rr0.1
Simplified0.1
[Start]0.1 | \[ \left(x + y \cdot \left(4 \cdot z\right)\right) + \left(-y \cdot \left(z \cdot 8\right)\right)
\] |
|---|---|
rational_best.json-simplify-2 [=>]0.1 | \[ \left(x + y \cdot \color{blue}{\left(z \cdot 4\right)}\right) + \left(-y \cdot \left(z \cdot 8\right)\right)
\] |
Taylor expanded in x around 0 0.1
Simplified0.1
[Start]0.1 | \[ \left(4 \cdot \left(y \cdot z\right) + x\right) - 8 \cdot \left(y \cdot z\right)
\] |
|---|---|
rational_best.json-simplify-44 [=>]0.1 | \[ \left(4 \cdot \left(y \cdot z\right) + x\right) - \color{blue}{y \cdot \left(8 \cdot z\right)}
\] |
rational_best.json-simplify-2 [=>]0.1 | \[ \left(4 \cdot \left(y \cdot z\right) + x\right) - y \cdot \color{blue}{\left(z \cdot 8\right)}
\] |
rational_best.json-simplify-44 [=>]0.1 | \[ \left(4 \cdot \left(y \cdot z\right) + x\right) - \color{blue}{z \cdot \left(y \cdot 8\right)}
\] |
Final simplification0.1
| Alternative 1 | |
|---|---|
| Error | 16.2 |
| Cost | 584 |
| Alternative 2 | |
|---|---|
| Error | 0.1 |
| Cost | 448 |
| Alternative 3 | |
|---|---|
| Error | 27.2 |
| Cost | 64 |
herbie shell --seed 2023088
(FPCore (x y z)
:name "Diagrams.Solve.Polynomial:quadForm from diagrams-solve-0.1, A"
:precision binary64
(- x (* (* y 4.0) z)))