Radioactive exchange between two surfaces

?

Percentage Accurate: 85.9% → 93.6%
Time: 3.7s
Precision: binary64
Cost: 960

?

\[{x}^{4} - {y}^{4} \]
\[\left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - y \cdot y\right) \]
(FPCore (x y) :precision binary64 (- (pow x 4.0) (pow y 4.0)))
(FPCore (x y) :precision binary64 (* (+ (* x x) (* y y)) (- (* x x) (* y y))))
double code(double x, double y) {
	return pow(x, 4.0) - pow(y, 4.0);
}
double code(double x, double y) {
	return ((x * x) + (y * y)) * ((x * x) - (y * y));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (x ** 4.0d0) - (y ** 4.0d0)
end function
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = ((x * x) + (y * y)) * ((x * x) - (y * y))
end function
public static double code(double x, double y) {
	return Math.pow(x, 4.0) - Math.pow(y, 4.0);
}
public static double code(double x, double y) {
	return ((x * x) + (y * y)) * ((x * x) - (y * y));
}
def code(x, y):
	return math.pow(x, 4.0) - math.pow(y, 4.0)
def code(x, y):
	return ((x * x) + (y * y)) * ((x * x) - (y * y))
function code(x, y)
	return Float64((x ^ 4.0) - (y ^ 4.0))
end
function code(x, y)
	return Float64(Float64(Float64(x * x) + Float64(y * y)) * Float64(Float64(x * x) - Float64(y * y)))
end
function tmp = code(x, y)
	tmp = (x ^ 4.0) - (y ^ 4.0);
end
function tmp = code(x, y)
	tmp = ((x * x) + (y * y)) * ((x * x) - (y * y));
end
code[x_, y_] := N[(N[Power[x, 4.0], $MachinePrecision] - N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]
code[x_, y_] := N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] - N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
{x}^{4} - {y}^{4}
\left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - y \cdot y\right)

Local Percentage Accuracy?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 89.5%

    \[{x}^{4} - {y}^{4} \]
  2. Applied egg-rr96.3%

    \[\leadsto \color{blue}{\left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - y \cdot y\right)} \]
    Step-by-step derivation

    [Start]89.5

    \[ {x}^{4} - {y}^{4} \]

    sqr-pow [=>]89.4

    \[ \color{blue}{{x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)}} - {y}^{4} \]

    sqr-pow [=>]89.3

    \[ {x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)} - \color{blue}{{y}^{\left(\frac{4}{2}\right)} \cdot {y}^{\left(\frac{4}{2}\right)}} \]

    difference-of-squares [=>]96.3

    \[ \color{blue}{\left({x}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right)} \]

    metadata-eval [=>]96.3

    \[ \left({x}^{\color{blue}{2}} + {y}^{\left(\frac{4}{2}\right)}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]

    pow2 [<=]96.3

    \[ \left(\color{blue}{x \cdot x} + {y}^{\left(\frac{4}{2}\right)}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]

    metadata-eval [=>]96.3

    \[ \left(x \cdot x + {y}^{\color{blue}{2}}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]

    pow2 [<=]96.3

    \[ \left(x \cdot x + \color{blue}{y \cdot y}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]

    metadata-eval [=>]96.3

    \[ \left(x \cdot x + y \cdot y\right) \cdot \left({x}^{\color{blue}{2}} - {y}^{\left(\frac{4}{2}\right)}\right) \]

    pow2 [<=]96.3

    \[ \left(x \cdot x + y \cdot y\right) \cdot \left(\color{blue}{x \cdot x} - {y}^{\left(\frac{4}{2}\right)}\right) \]

    metadata-eval [=>]96.3

    \[ \left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - {y}^{\color{blue}{2}}\right) \]

    pow2 [<=]96.3

    \[ \left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - \color{blue}{y \cdot y}\right) \]
  3. Final simplification96.3%

    \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - y \cdot y\right) \]

Alternatives

Alternative 1
Accuracy81.6%
Cost1033
\[\begin{array}{l} \mathbf{if}\;y \leq -2.55 \cdot 10^{+62} \lor \neg \left(y \leq 4.4 \cdot 10^{+60}\right):\\ \;\;\;\;\left(y \cdot y\right) \cdot \left(\left(-y \cdot y\right) - x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(x \cdot x + y \cdot y\right)\\ \end{array} \]
Alternative 2
Accuracy70.1%
Cost969
\[\begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{+109} \lor \neg \left(y \leq 6 \cdot 10^{+101}\right):\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(-y \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(x \cdot x + y \cdot y\right)\\ \end{array} \]
Alternative 3
Accuracy45.0%
Cost777
\[\begin{array}{l} \mathbf{if}\;y \leq -9 \cdot 10^{+110} \lor \neg \left(y \leq 1.2 \cdot 10^{+105}\right):\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(-y \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(y \cdot y\right)\\ \end{array} \]
Alternative 4
Accuracy32.6%
Cost448
\[\left(x \cdot x\right) \cdot \left(y \cdot y\right) \]

Error

Reproduce?

herbie shell --seed 2023160 
(FPCore (x y)
  :name "Radioactive exchange between two surfaces"
  :precision binary64
  (- (pow x 4.0) (pow y 4.0)))