?

Average Accuracy: 35.9% → 91.4%
Time: 1.2min
Precision: binary64
Cost: 7172

?

\[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} \cdot \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{y-scale}}{y-scale} \]
\[\begin{array}{l} t_0 := \frac{a}{\frac{x-scale \cdot y-scale}{b}}\\ \mathbf{if}\;x-scale \leq 1.22 \cdot 10^{+172}:\\ \;\;\;\;-4 \cdot {\left(\frac{\frac{a}{y-scale}}{\frac{x-scale}{b}}\right)}^{2}\\ \mathbf{elif}\;x-scale \leq 4.5 \cdot 10^{+256}:\\ \;\;\;\;-4 \cdot \left(\left(b \cdot \frac{\frac{a}{x-scale}}{y-scale}\right) \cdot \left(\frac{a}{x-scale} \cdot \frac{b}{y-scale}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-4 \cdot \left(t_0 \cdot t_0\right)\\ \end{array} \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (-
  (*
   (/
    (/
     (*
      (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* (/ angle 180.0) PI)))
      (cos (* (/ angle 180.0) PI)))
     x-scale)
    y-scale)
   (/
    (/
     (*
      (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* (/ angle 180.0) PI)))
      (cos (* (/ angle 180.0) PI)))
     x-scale)
    y-scale))
  (*
   (*
    4.0
    (/
     (/
      (+
       (pow (* a (sin (* (/ angle 180.0) PI))) 2.0)
       (pow (* b (cos (* (/ angle 180.0) PI))) 2.0))
      x-scale)
     x-scale))
   (/
    (/
     (+
      (pow (* a (cos (* (/ angle 180.0) PI))) 2.0)
      (pow (* b (sin (* (/ angle 180.0) PI))) 2.0))
     y-scale)
    y-scale))))
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (let* ((t_0 (/ a (/ (* x-scale y-scale) b))))
   (if (<= x-scale 1.22e+172)
     (* -4.0 (pow (/ (/ a y-scale) (/ x-scale b)) 2.0))
     (if (<= x-scale 4.5e+256)
       (*
        -4.0
        (* (* b (/ (/ a x-scale) y-scale)) (* (/ a x-scale) (/ b y-scale))))
       (* -4.0 (* t_0 t_0))))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	return ((((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin(((angle / 180.0) * ((double) M_PI)))) * cos(((angle / 180.0) * ((double) M_PI)))) / x_45_scale) / y_45_scale) * (((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin(((angle / 180.0) * ((double) M_PI)))) * cos(((angle / 180.0) * ((double) M_PI)))) / x_45_scale) / y_45_scale)) - ((4.0 * (((pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * cos(((angle / 180.0) * ((double) M_PI)))), 2.0)) / x_45_scale) / x_45_scale)) * (((pow((a * cos(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * sin(((angle / 180.0) * ((double) M_PI)))), 2.0)) / y_45_scale) / y_45_scale));
}
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = a / ((x_45_scale * y_45_scale) / b);
	double tmp;
	if (x_45_scale <= 1.22e+172) {
		tmp = -4.0 * pow(((a / y_45_scale) / (x_45_scale / b)), 2.0);
	} else if (x_45_scale <= 4.5e+256) {
		tmp = -4.0 * ((b * ((a / x_45_scale) / y_45_scale)) * ((a / x_45_scale) * (b / y_45_scale)));
	} else {
		tmp = -4.0 * (t_0 * t_0);
	}
	return tmp;
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	return ((((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * Math.sin(((angle / 180.0) * Math.PI))) * Math.cos(((angle / 180.0) * Math.PI))) / x_45_scale) / y_45_scale) * (((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * Math.sin(((angle / 180.0) * Math.PI))) * Math.cos(((angle / 180.0) * Math.PI))) / x_45_scale) / y_45_scale)) - ((4.0 * (((Math.pow((a * Math.sin(((angle / 180.0) * Math.PI))), 2.0) + Math.pow((b * Math.cos(((angle / 180.0) * Math.PI))), 2.0)) / x_45_scale) / x_45_scale)) * (((Math.pow((a * Math.cos(((angle / 180.0) * Math.PI))), 2.0) + Math.pow((b * Math.sin(((angle / 180.0) * Math.PI))), 2.0)) / y_45_scale) / y_45_scale));
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = a / ((x_45_scale * y_45_scale) / b);
	double tmp;
	if (x_45_scale <= 1.22e+172) {
		tmp = -4.0 * Math.pow(((a / y_45_scale) / (x_45_scale / b)), 2.0);
	} else if (x_45_scale <= 4.5e+256) {
		tmp = -4.0 * ((b * ((a / x_45_scale) / y_45_scale)) * ((a / x_45_scale) * (b / y_45_scale)));
	} else {
		tmp = -4.0 * (t_0 * t_0);
	}
	return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale):
	return ((((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * math.sin(((angle / 180.0) * math.pi))) * math.cos(((angle / 180.0) * math.pi))) / x_45_scale) / y_45_scale) * (((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * math.sin(((angle / 180.0) * math.pi))) * math.cos(((angle / 180.0) * math.pi))) / x_45_scale) / y_45_scale)) - ((4.0 * (((math.pow((a * math.sin(((angle / 180.0) * math.pi))), 2.0) + math.pow((b * math.cos(((angle / 180.0) * math.pi))), 2.0)) / x_45_scale) / x_45_scale)) * (((math.pow((a * math.cos(((angle / 180.0) * math.pi))), 2.0) + math.pow((b * math.sin(((angle / 180.0) * math.pi))), 2.0)) / y_45_scale) / y_45_scale))
def code(a, b, angle, x_45_scale, y_45_scale):
	t_0 = a / ((x_45_scale * y_45_scale) / b)
	tmp = 0
	if x_45_scale <= 1.22e+172:
		tmp = -4.0 * math.pow(((a / y_45_scale) / (x_45_scale / b)), 2.0)
	elif x_45_scale <= 4.5e+256:
		tmp = -4.0 * ((b * ((a / x_45_scale) / y_45_scale)) * ((a / x_45_scale) * (b / y_45_scale)))
	else:
		tmp = -4.0 * (t_0 * t_0)
	return tmp
function code(a, b, angle, x_45_scale, y_45_scale)
	return Float64(Float64(Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(Float64(Float64(angle / 180.0) * pi))) * cos(Float64(Float64(angle / 180.0) * pi))) / x_45_scale) / y_45_scale) * Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(Float64(Float64(angle / 180.0) * pi))) * cos(Float64(Float64(angle / 180.0) * pi))) / x_45_scale) / y_45_scale)) - Float64(Float64(4.0 * Float64(Float64(Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0)) / x_45_scale) / x_45_scale)) * Float64(Float64(Float64((Float64(a * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0)) / y_45_scale) / y_45_scale)))
end
function code(a, b, angle, x_45_scale, y_45_scale)
	t_0 = Float64(a / Float64(Float64(x_45_scale * y_45_scale) / b))
	tmp = 0.0
	if (x_45_scale <= 1.22e+172)
		tmp = Float64(-4.0 * (Float64(Float64(a / y_45_scale) / Float64(x_45_scale / b)) ^ 2.0));
	elseif (x_45_scale <= 4.5e+256)
		tmp = Float64(-4.0 * Float64(Float64(b * Float64(Float64(a / x_45_scale) / y_45_scale)) * Float64(Float64(a / x_45_scale) * Float64(b / y_45_scale))));
	else
		tmp = Float64(-4.0 * Float64(t_0 * t_0));
	end
	return tmp
end
function tmp = code(a, b, angle, x_45_scale, y_45_scale)
	tmp = ((((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * sin(((angle / 180.0) * pi))) * cos(((angle / 180.0) * pi))) / x_45_scale) / y_45_scale) * (((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * sin(((angle / 180.0) * pi))) * cos(((angle / 180.0) * pi))) / x_45_scale) / y_45_scale)) - ((4.0 * (((((a * sin(((angle / 180.0) * pi))) ^ 2.0) + ((b * cos(((angle / 180.0) * pi))) ^ 2.0)) / x_45_scale) / x_45_scale)) * (((((a * cos(((angle / 180.0) * pi))) ^ 2.0) + ((b * sin(((angle / 180.0) * pi))) ^ 2.0)) / y_45_scale) / y_45_scale));
end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale)
	t_0 = a / ((x_45_scale * y_45_scale) / b);
	tmp = 0.0;
	if (x_45_scale <= 1.22e+172)
		tmp = -4.0 * (((a / y_45_scale) / (x_45_scale / b)) ^ 2.0);
	elseif (x_45_scale <= 4.5e+256)
		tmp = -4.0 * ((b * ((a / x_45_scale) / y_45_scale)) * ((a / x_45_scale) * (b / y_45_scale)));
	else
		tmp = -4.0 * (t_0 * t_0);
	end
	tmp_2 = tmp;
end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[(N[(N[(N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision] * N[(N[(N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision] - N[(N[(4.0 * N[(N[(N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[Power[N[(a * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(a / N[(N[(x$45$scale * y$45$scale), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$45$scale, 1.22e+172], N[(-4.0 * N[Power[N[(N[(a / y$45$scale), $MachinePrecision] / N[(x$45$scale / b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$45$scale, 4.5e+256], N[(-4.0 * N[(N[(b * N[(N[(a / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(a / x$45$scale), $MachinePrecision] * N[(b / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} \cdot \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{y-scale}}{y-scale}
\begin{array}{l}
t_0 := \frac{a}{\frac{x-scale \cdot y-scale}{b}}\\
\mathbf{if}\;x-scale \leq 1.22 \cdot 10^{+172}:\\
\;\;\;\;-4 \cdot {\left(\frac{\frac{a}{y-scale}}{\frac{x-scale}{b}}\right)}^{2}\\

\mathbf{elif}\;x-scale \leq 4.5 \cdot 10^{+256}:\\
\;\;\;\;-4 \cdot \left(\left(b \cdot \frac{\frac{a}{x-scale}}{y-scale}\right) \cdot \left(\frac{a}{x-scale} \cdot \frac{b}{y-scale}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(t_0 \cdot t_0\right)\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 3 regimes
  2. if x-scale < 1.21999999999999999e172

    1. Initial program 34.5%

      \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} \cdot \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{y-scale}}{y-scale} \]
    2. Taylor expanded in angle around 0 37.2%

      \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{y-scale}^{2} \cdot {x-scale}^{2}}} \]
    3. Simplified68.0%

      \[\leadsto \color{blue}{\left(\frac{a}{y-scale} \cdot \frac{a}{y-scale}\right) \cdot \left(\left(\frac{b}{x-scale} \cdot \frac{b}{x-scale}\right) \cdot -4\right)} \]
      Proof

      [Start]37.2

      \[ -4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{y-scale}^{2} \cdot {x-scale}^{2}} \]

      *-commutative [=>]37.2

      \[ \color{blue}{\frac{{a}^{2} \cdot {b}^{2}}{{y-scale}^{2} \cdot {x-scale}^{2}} \cdot -4} \]

      times-frac [=>]37.3

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

      associate-*l* [=>]37.3

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

      unpow2 [=>]37.3

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

      unpow2 [=>]37.3

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

      times-frac [=>]49.4

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

      unpow2 [=>]49.4

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

      unpow2 [=>]49.4

      \[ \left(\frac{a}{y-scale} \cdot \frac{a}{y-scale}\right) \cdot \left(\frac{b \cdot b}{\color{blue}{x-scale \cdot x-scale}} \cdot -4\right) \]

      times-frac [=>]68.0

      \[ \left(\frac{a}{y-scale} \cdot \frac{a}{y-scale}\right) \cdot \left(\color{blue}{\left(\frac{b}{x-scale} \cdot \frac{b}{x-scale}\right)} \cdot -4\right) \]
    4. Taylor expanded in a around 0 37.2%

      \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
    5. Simplified91.2%

      \[\leadsto \color{blue}{-4 \cdot {\left(\frac{\frac{a}{y-scale}}{\frac{x-scale}{b}}\right)}^{2}} \]
      Proof

      [Start]37.2

      \[ -4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}} \]

      unpow2 [=>]37.2

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

      unpow2 [=>]37.2

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

      unpow2 [=>]37.2

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

      unpow2 [=>]37.2

      \[ -4 \cdot \frac{\left(a \cdot a\right) \cdot \left(b \cdot b\right)}{\left(x-scale \cdot x-scale\right) \cdot \color{blue}{\left(y-scale \cdot y-scale\right)}} \]

      *-commutative [=>]37.2

      \[ -4 \cdot \frac{\left(a \cdot a\right) \cdot \left(b \cdot b\right)}{\color{blue}{\left(y-scale \cdot y-scale\right) \cdot \left(x-scale \cdot x-scale\right)}} \]

      times-frac [=>]37.3

      \[ -4 \cdot \color{blue}{\left(\frac{a \cdot a}{y-scale \cdot y-scale} \cdot \frac{b \cdot b}{x-scale \cdot x-scale}\right)} \]

      times-frac [=>]49.4

      \[ -4 \cdot \left(\color{blue}{\left(\frac{a}{y-scale} \cdot \frac{a}{y-scale}\right)} \cdot \frac{b \cdot b}{x-scale \cdot x-scale}\right) \]

      times-frac [=>]68.0

      \[ -4 \cdot \left(\left(\frac{a}{y-scale} \cdot \frac{a}{y-scale}\right) \cdot \color{blue}{\left(\frac{b}{x-scale} \cdot \frac{b}{x-scale}\right)}\right) \]

      swap-sqr [<=]91.0

      \[ -4 \cdot \color{blue}{\left(\left(\frac{a}{y-scale} \cdot \frac{b}{x-scale}\right) \cdot \left(\frac{a}{y-scale} \cdot \frac{b}{x-scale}\right)\right)} \]

      unpow2 [<=]91.0

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

      associate-*r/ [=>]91.5

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

      associate-/l* [=>]91.2

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

    if 1.21999999999999999e172 < x-scale < 4.4999999999999998e256

    1. Initial program 43.8%

      \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} \cdot \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{y-scale}}{y-scale} \]
    2. Taylor expanded in angle around 0 43.2%

      \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{y-scale}^{2} \cdot {x-scale}^{2}}} \]
    3. Simplified90.7%

      \[\leadsto \color{blue}{-4 \cdot \left(\left(\frac{a}{y-scale} \cdot \frac{b}{x-scale}\right) \cdot \left(\frac{a}{y-scale} \cdot \frac{b}{x-scale}\right)\right)} \]
      Proof

      [Start]43.2

      \[ -4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{y-scale}^{2} \cdot {x-scale}^{2}} \]

      times-frac [=>]42.6

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

      unpow2 [=>]42.6

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

      unpow2 [=>]42.6

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

      times-frac [=>]54.3

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

      unpow2 [=>]54.3

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

      unpow2 [=>]54.3

      \[ -4 \cdot \left(\left(\frac{a}{y-scale} \cdot \frac{a}{y-scale}\right) \cdot \frac{b \cdot b}{\color{blue}{x-scale \cdot x-scale}}\right) \]

      times-frac [=>]75.5

      \[ -4 \cdot \left(\left(\frac{a}{y-scale} \cdot \frac{a}{y-scale}\right) \cdot \color{blue}{\left(\frac{b}{x-scale} \cdot \frac{b}{x-scale}\right)}\right) \]

      unswap-sqr [=>]90.7

      \[ -4 \cdot \color{blue}{\left(\left(\frac{a}{y-scale} \cdot \frac{b}{x-scale}\right) \cdot \left(\frac{a}{y-scale} \cdot \frac{b}{x-scale}\right)\right)} \]
    4. Taylor expanded in a around 0 82.7%

      \[\leadsto -4 \cdot \left(\left(\frac{a}{y-scale} \cdot \frac{b}{x-scale}\right) \cdot \color{blue}{\frac{a \cdot b}{x-scale \cdot y-scale}}\right) \]
    5. Simplified83.9%

      \[\leadsto -4 \cdot \left(\left(\frac{a}{y-scale} \cdot \frac{b}{x-scale}\right) \cdot \color{blue}{\left(\frac{a}{x-scale} \cdot \frac{b}{y-scale}\right)}\right) \]
      Proof

      [Start]82.7

      \[ -4 \cdot \left(\left(\frac{a}{y-scale} \cdot \frac{b}{x-scale}\right) \cdot \frac{a \cdot b}{x-scale \cdot y-scale}\right) \]

      times-frac [=>]83.9

      \[ -4 \cdot \left(\left(\frac{a}{y-scale} \cdot \frac{b}{x-scale}\right) \cdot \color{blue}{\left(\frac{a}{x-scale} \cdot \frac{b}{y-scale}\right)}\right) \]
    6. Taylor expanded in a around 0 84.7%

      \[\leadsto -4 \cdot \left(\color{blue}{\frac{a \cdot b}{x-scale \cdot y-scale}} \cdot \left(\frac{a}{x-scale} \cdot \frac{b}{y-scale}\right)\right) \]
    7. Simplified91.5%

      \[\leadsto -4 \cdot \left(\color{blue}{\left(b \cdot \frac{\frac{a}{x-scale}}{y-scale}\right)} \cdot \left(\frac{a}{x-scale} \cdot \frac{b}{y-scale}\right)\right) \]
      Proof

      [Start]84.7

      \[ -4 \cdot \left(\frac{a \cdot b}{x-scale \cdot y-scale} \cdot \left(\frac{a}{x-scale} \cdot \frac{b}{y-scale}\right)\right) \]

      *-commutative [=>]84.7

      \[ -4 \cdot \left(\frac{a \cdot b}{\color{blue}{y-scale \cdot x-scale}} \cdot \left(\frac{a}{x-scale} \cdot \frac{b}{y-scale}\right)\right) \]

      associate-*l/ [<=]86.5

      \[ -4 \cdot \left(\color{blue}{\left(\frac{a}{y-scale \cdot x-scale} \cdot b\right)} \cdot \left(\frac{a}{x-scale} \cdot \frac{b}{y-scale}\right)\right) \]

      *-commutative [=>]86.5

      \[ -4 \cdot \left(\color{blue}{\left(b \cdot \frac{a}{y-scale \cdot x-scale}\right)} \cdot \left(\frac{a}{x-scale} \cdot \frac{b}{y-scale}\right)\right) \]

      *-commutative [<=]86.5

      \[ -4 \cdot \left(\left(b \cdot \frac{a}{\color{blue}{x-scale \cdot y-scale}}\right) \cdot \left(\frac{a}{x-scale} \cdot \frac{b}{y-scale}\right)\right) \]

      associate-/r* [=>]91.5

      \[ -4 \cdot \left(\left(b \cdot \color{blue}{\frac{\frac{a}{x-scale}}{y-scale}}\right) \cdot \left(\frac{a}{x-scale} \cdot \frac{b}{y-scale}\right)\right) \]

    if 4.4999999999999998e256 < x-scale

    1. Initial program 44.5%

      \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} \cdot \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{y-scale}}{y-scale} \]
    2. Taylor expanded in angle around 0 43.2%

      \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{y-scale}^{2} \cdot {x-scale}^{2}}} \]
    3. Simplified76.5%

      \[\leadsto \color{blue}{\left(\frac{a}{y-scale} \cdot \frac{a}{y-scale}\right) \cdot \left(\left(\frac{b}{x-scale} \cdot \frac{b}{x-scale}\right) \cdot -4\right)} \]
      Proof

      [Start]43.2

      \[ -4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{y-scale}^{2} \cdot {x-scale}^{2}} \]

      *-commutative [=>]43.2

      \[ \color{blue}{\frac{{a}^{2} \cdot {b}^{2}}{{y-scale}^{2} \cdot {x-scale}^{2}} \cdot -4} \]

      times-frac [=>]42.5

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

      associate-*l* [=>]42.5

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

      unpow2 [=>]42.5

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

      unpow2 [=>]42.5

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

      times-frac [=>]56.5

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

      unpow2 [=>]56.5

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

      unpow2 [=>]56.5

      \[ \left(\frac{a}{y-scale} \cdot \frac{a}{y-scale}\right) \cdot \left(\frac{b \cdot b}{\color{blue}{x-scale \cdot x-scale}} \cdot -4\right) \]

      times-frac [=>]76.5

      \[ \left(\frac{a}{y-scale} \cdot \frac{a}{y-scale}\right) \cdot \left(\color{blue}{\left(\frac{b}{x-scale} \cdot \frac{b}{x-scale}\right)} \cdot -4\right) \]
    4. Taylor expanded in a around 0 43.2%

      \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
    5. Simplified90.8%

      \[\leadsto \color{blue}{-4 \cdot {\left(\frac{\frac{a}{y-scale}}{\frac{x-scale}{b}}\right)}^{2}} \]
      Proof

      [Start]43.2

      \[ -4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}} \]

      unpow2 [=>]43.2

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

      unpow2 [=>]43.2

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

      unpow2 [=>]43.2

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

      unpow2 [=>]43.2

      \[ -4 \cdot \frac{\left(a \cdot a\right) \cdot \left(b \cdot b\right)}{\left(x-scale \cdot x-scale\right) \cdot \color{blue}{\left(y-scale \cdot y-scale\right)}} \]

      *-commutative [=>]43.2

      \[ -4 \cdot \frac{\left(a \cdot a\right) \cdot \left(b \cdot b\right)}{\color{blue}{\left(y-scale \cdot y-scale\right) \cdot \left(x-scale \cdot x-scale\right)}} \]

      times-frac [=>]42.5

      \[ -4 \cdot \color{blue}{\left(\frac{a \cdot a}{y-scale \cdot y-scale} \cdot \frac{b \cdot b}{x-scale \cdot x-scale}\right)} \]

      times-frac [=>]56.5

      \[ -4 \cdot \left(\color{blue}{\left(\frac{a}{y-scale} \cdot \frac{a}{y-scale}\right)} \cdot \frac{b \cdot b}{x-scale \cdot x-scale}\right) \]

      times-frac [=>]76.5

      \[ -4 \cdot \left(\left(\frac{a}{y-scale} \cdot \frac{a}{y-scale}\right) \cdot \color{blue}{\left(\frac{b}{x-scale} \cdot \frac{b}{x-scale}\right)}\right) \]

      swap-sqr [<=]90.9

      \[ -4 \cdot \color{blue}{\left(\left(\frac{a}{y-scale} \cdot \frac{b}{x-scale}\right) \cdot \left(\frac{a}{y-scale} \cdot \frac{b}{x-scale}\right)\right)} \]

      unpow2 [<=]90.9

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

      associate-*r/ [=>]86.9

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

      associate-/l* [=>]90.8

      \[ -4 \cdot {\color{blue}{\left(\frac{\frac{a}{y-scale}}{\frac{x-scale}{b}}\right)}}^{2} \]
    6. Applied egg-rr93.3%

      \[\leadsto -4 \cdot \color{blue}{\left(\frac{a}{\frac{x-scale \cdot y-scale}{b}} \cdot \frac{a}{\frac{x-scale \cdot y-scale}{b}}\right)} \]
      Proof

      [Start]90.8

      \[ -4 \cdot {\left(\frac{\frac{a}{y-scale}}{\frac{x-scale}{b}}\right)}^{2} \]

      unpow2 [=>]90.8

      \[ -4 \cdot \color{blue}{\left(\frac{\frac{a}{y-scale}}{\frac{x-scale}{b}} \cdot \frac{\frac{a}{y-scale}}{\frac{x-scale}{b}}\right)} \]

      associate-/l/ [=>]90.0

      \[ -4 \cdot \left(\color{blue}{\frac{a}{\frac{x-scale}{b} \cdot y-scale}} \cdot \frac{\frac{a}{y-scale}}{\frac{x-scale}{b}}\right) \]

      associate-*l/ [=>]85.1

      \[ -4 \cdot \left(\frac{a}{\color{blue}{\frac{x-scale \cdot y-scale}{b}}} \cdot \frac{\frac{a}{y-scale}}{\frac{x-scale}{b}}\right) \]

      associate-/l/ [=>]86.4

      \[ -4 \cdot \left(\frac{a}{\frac{x-scale \cdot y-scale}{b}} \cdot \color{blue}{\frac{a}{\frac{x-scale}{b} \cdot y-scale}}\right) \]

      associate-*l/ [=>]93.3

      \[ -4 \cdot \left(\frac{a}{\frac{x-scale \cdot y-scale}{b}} \cdot \frac{a}{\color{blue}{\frac{x-scale \cdot y-scale}{b}}}\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification91.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x-scale \leq 1.22 \cdot 10^{+172}:\\ \;\;\;\;-4 \cdot {\left(\frac{\frac{a}{y-scale}}{\frac{x-scale}{b}}\right)}^{2}\\ \mathbf{elif}\;x-scale \leq 4.5 \cdot 10^{+256}:\\ \;\;\;\;-4 \cdot \left(\left(b \cdot \frac{\frac{a}{x-scale}}{y-scale}\right) \cdot \left(\frac{a}{x-scale} \cdot \frac{b}{y-scale}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-4 \cdot \left(\frac{a}{\frac{x-scale \cdot y-scale}{b}} \cdot \frac{a}{\frac{x-scale \cdot y-scale}{b}}\right)\\ \end{array} \]

Alternatives

Alternative 1
Accuracy91.1%
Cost1353
\[\begin{array}{l} t_0 := \frac{a}{y-scale} \cdot \frac{b}{x-scale}\\ \mathbf{if}\;x-scale \leq 5 \cdot 10^{+170} \lor \neg \left(x-scale \leq 9 \cdot 10^{+255}\right):\\ \;\;\;\;-4 \cdot \left(t_0 \cdot t_0\right)\\ \mathbf{else}:\\ \;\;\;\;-4 \cdot \left(\left(b \cdot \frac{\frac{a}{x-scale}}{y-scale}\right) \cdot \left(\frac{a}{x-scale} \cdot \frac{b}{y-scale}\right)\right)\\ \end{array} \]
Alternative 2
Accuracy90.6%
Cost1353
\[\begin{array}{l} t_0 := \frac{a}{y-scale} \cdot \frac{b}{x-scale}\\ t_1 := \frac{a}{\frac{x-scale \cdot y-scale}{b}}\\ \mathbf{if}\;y-scale \leq -2.85 \cdot 10^{-306} \lor \neg \left(y-scale \leq 2.8 \cdot 10^{-179}\right):\\ \;\;\;\;-4 \cdot \left(t_0 \cdot t_0\right)\\ \mathbf{else}:\\ \;\;\;\;-4 \cdot \left(t_1 \cdot t_1\right)\\ \end{array} \]
Alternative 3
Accuracy91.2%
Cost1352
\[\begin{array}{l} t_0 := \frac{a}{\frac{x-scale \cdot y-scale}{b}}\\ \mathbf{if}\;x-scale \leq 5 \cdot 10^{+170}:\\ \;\;\;\;-4 \cdot \left(\frac{\frac{a}{y-scale}}{\frac{x-scale}{b}} \cdot \left(\frac{a}{y-scale} \cdot \frac{b}{x-scale}\right)\right)\\ \mathbf{elif}\;x-scale \leq 2 \cdot 10^{+256}:\\ \;\;\;\;-4 \cdot \left(\left(b \cdot \frac{\frac{a}{x-scale}}{y-scale}\right) \cdot \left(\frac{a}{x-scale} \cdot \frac{b}{y-scale}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-4 \cdot \left(t_0 \cdot t_0\right)\\ \end{array} \]
Alternative 4
Accuracy91.2%
Cost1220
\[\begin{array}{l} t_0 := \frac{a \cdot b}{x-scale \cdot y-scale}\\ t_1 := \frac{a}{y-scale} \cdot \frac{b}{x-scale}\\ \mathbf{if}\;a \leq 5 \cdot 10^{+63}:\\ \;\;\;\;-4 \cdot \left(t_1 \cdot t_1\right)\\ \mathbf{else}:\\ \;\;\;\;-4 \cdot \left(t_0 \cdot t_0\right)\\ \end{array} \]
Alternative 5
Accuracy88.8%
Cost1088
\[-4 \cdot \left(\left(b \cdot \frac{\frac{a}{x-scale}}{y-scale}\right) \cdot \left(\frac{a}{x-scale} \cdot \frac{b}{y-scale}\right)\right) \]
Alternative 6
Accuracy52.6%
Cost64
\[0 \]

Error

Reproduce?

herbie shell --seed 2023151 
(FPCore (a b angle x-scale y-scale)
  :name "Simplification of discriminant from scale-rotated-ellipse"
  :precision binary64
  (- (* (/ (/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* (/ angle 180.0) PI))) (cos (* (/ angle 180.0) PI))) x-scale) y-scale) (/ (/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* (/ angle 180.0) PI))) (cos (* (/ angle 180.0) PI))) x-scale) y-scale)) (* (* 4.0 (/ (/ (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (cos (* (/ angle 180.0) PI))) 2.0)) x-scale) x-scale)) (/ (/ (+ (pow (* a (cos (* (/ angle 180.0) PI))) 2.0) (pow (* b (sin (* (/ angle 180.0) PI))) 2.0)) y-scale) y-scale))))