Simplification of discriminant from scale-rotated-ellipse

Percentage Accurate: 25.1% → 86.5%
Time: 25.9s
Alternatives: 7
Speedup: 99.6×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{angle}{180} \cdot \pi\\ t_1 := \sin t\_0\\ t_2 := \cos t\_0\\ t_3 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_1\right) \cdot t\_2}{x-scale}}{y-scale}\\ t\_3 \cdot t\_3 - \left(4 \cdot \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{y-scale}}{y-scale} \end{array} \end{array} \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (let* ((t_0 (* (/ angle 180.0) PI))
        (t_1 (sin t_0))
        (t_2 (cos t_0))
        (t_3
         (/
          (/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_1) t_2) x-scale)
          y-scale)))
   (-
    (* t_3 t_3)
    (*
     (*
      4.0
      (/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) x-scale) x-scale))
     (/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) y-scale) y-scale)))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = (angle / 180.0) * ((double) M_PI);
	double t_1 = sin(t_0);
	double t_2 = cos(t_0);
	double t_3 = ((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
	return (t_3 * t_3) - ((4.0 * (((pow((a * t_1), 2.0) + pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((pow((a * t_2), 2.0) + pow((b * t_1), 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 = (angle / 180.0) * Math.PI;
	double t_1 = Math.sin(t_0);
	double t_2 = Math.cos(t_0);
	double t_3 = ((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
	return (t_3 * t_3) - ((4.0 * (((Math.pow((a * t_1), 2.0) + Math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((Math.pow((a * t_2), 2.0) + Math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale));
}
def code(a, b, angle, x_45_scale, y_45_scale):
	t_0 = (angle / 180.0) * math.pi
	t_1 = math.sin(t_0)
	t_2 = math.cos(t_0)
	t_3 = ((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale
	return (t_3 * t_3) - ((4.0 * (((math.pow((a * t_1), 2.0) + math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((math.pow((a * t_2), 2.0) + math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale))
function code(a, b, angle, x_45_scale, y_45_scale)
	t_0 = Float64(Float64(angle / 180.0) * pi)
	t_1 = sin(t_0)
	t_2 = cos(t_0)
	t_3 = Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale)
	return Float64(Float64(t_3 * t_3) - Float64(Float64(4.0 * Float64(Float64(Float64((Float64(a * t_1) ^ 2.0) + (Float64(b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale)) * Float64(Float64(Float64((Float64(a * t_2) ^ 2.0) + (Float64(b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale)))
end
function tmp = code(a, b, angle, x_45_scale, y_45_scale)
	t_0 = (angle / 180.0) * pi;
	t_1 = sin(t_0);
	t_2 = cos(t_0);
	t_3 = ((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
	tmp = (t_3 * t_3) - ((4.0 * (((((a * t_1) ^ 2.0) + ((b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale)) * (((((a * t_2) ^ 2.0) + ((b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale));
end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$1 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Cos[t$95$0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(N[(4.0 * N[(N[(N[(N[Power[N[(a * t$95$1), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$2), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[Power[N[(a * t$95$2), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$1), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
t_1 := \sin t\_0\\
t_2 := \cos t\_0\\
t_3 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_1\right) \cdot t\_2}{x-scale}}{y-scale}\\
t\_3 \cdot t\_3 - \left(4 \cdot \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{y-scale}}{y-scale}
\end{array}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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.

Accuracy vs Speed?

Herbie found 7 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 25.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{angle}{180} \cdot \pi\\ t_1 := \sin t\_0\\ t_2 := \cos t\_0\\ t_3 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_1\right) \cdot t\_2}{x-scale}}{y-scale}\\ t\_3 \cdot t\_3 - \left(4 \cdot \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{y-scale}}{y-scale} \end{array} \end{array} \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (let* ((t_0 (* (/ angle 180.0) PI))
        (t_1 (sin t_0))
        (t_2 (cos t_0))
        (t_3
         (/
          (/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_1) t_2) x-scale)
          y-scale)))
   (-
    (* t_3 t_3)
    (*
     (*
      4.0
      (/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) x-scale) x-scale))
     (/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) y-scale) y-scale)))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = (angle / 180.0) * ((double) M_PI);
	double t_1 = sin(t_0);
	double t_2 = cos(t_0);
	double t_3 = ((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
	return (t_3 * t_3) - ((4.0 * (((pow((a * t_1), 2.0) + pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((pow((a * t_2), 2.0) + pow((b * t_1), 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 = (angle / 180.0) * Math.PI;
	double t_1 = Math.sin(t_0);
	double t_2 = Math.cos(t_0);
	double t_3 = ((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
	return (t_3 * t_3) - ((4.0 * (((Math.pow((a * t_1), 2.0) + Math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((Math.pow((a * t_2), 2.0) + Math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale));
}
def code(a, b, angle, x_45_scale, y_45_scale):
	t_0 = (angle / 180.0) * math.pi
	t_1 = math.sin(t_0)
	t_2 = math.cos(t_0)
	t_3 = ((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale
	return (t_3 * t_3) - ((4.0 * (((math.pow((a * t_1), 2.0) + math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((math.pow((a * t_2), 2.0) + math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale))
function code(a, b, angle, x_45_scale, y_45_scale)
	t_0 = Float64(Float64(angle / 180.0) * pi)
	t_1 = sin(t_0)
	t_2 = cos(t_0)
	t_3 = Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale)
	return Float64(Float64(t_3 * t_3) - Float64(Float64(4.0 * Float64(Float64(Float64((Float64(a * t_1) ^ 2.0) + (Float64(b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale)) * Float64(Float64(Float64((Float64(a * t_2) ^ 2.0) + (Float64(b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale)))
end
function tmp = code(a, b, angle, x_45_scale, y_45_scale)
	t_0 = (angle / 180.0) * pi;
	t_1 = sin(t_0);
	t_2 = cos(t_0);
	t_3 = ((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
	tmp = (t_3 * t_3) - ((4.0 * (((((a * t_1) ^ 2.0) + ((b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale)) * (((((a * t_2) ^ 2.0) + ((b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale));
end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$1 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Cos[t$95$0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(N[(4.0 * N[(N[(N[(N[Power[N[(a * t$95$1), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$2), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[Power[N[(a * t$95$2), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$1), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
t_1 := \sin t\_0\\
t_2 := \cos t\_0\\
t_3 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_1\right) \cdot t\_2}{x-scale}}{y-scale}\\
t\_3 \cdot t\_3 - \left(4 \cdot \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{y-scale}}{y-scale}
\end{array}
\end{array}

Alternative 1: 86.5% accurate, 76.9× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ \begin{array}{l} t_0 := \frac{-4 \cdot a}{\frac{x-scale}{b\_m}}\\ \mathbf{if}\;b\_m \leq 3.8 \cdot 10^{-147}:\\ \;\;\;\;a \cdot \frac{t\_0}{\frac{y-scale}{\frac{\frac{b\_m}{x-scale}}{y-scale}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_0 \cdot \frac{\frac{b\_m}{y-scale}}{\frac{x-scale}{a}}}{y-scale}\\ \end{array} \end{array} \]
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
 :precision binary64
 (let* ((t_0 (/ (* -4.0 a) (/ x-scale b_m))))
   (if (<= b_m 3.8e-147)
     (* a (/ t_0 (/ y-scale (/ (/ b_m x-scale) y-scale))))
     (/ (* t_0 (/ (/ b_m y-scale) (/ x-scale a))) y-scale))))
b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = (-4.0 * a) / (x_45_scale / b_m);
	double tmp;
	if (b_m <= 3.8e-147) {
		tmp = a * (t_0 / (y_45_scale / ((b_m / x_45_scale) / y_45_scale)));
	} else {
		tmp = (t_0 * ((b_m / y_45_scale) / (x_45_scale / a))) / y_45_scale;
	}
	return tmp;
}
b_m = abs(b)
real(8) function code(a, b_m, angle, x_45scale, y_45scale)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: angle
    real(8), intent (in) :: x_45scale
    real(8), intent (in) :: y_45scale
    real(8) :: t_0
    real(8) :: tmp
    t_0 = ((-4.0d0) * a) / (x_45scale / b_m)
    if (b_m <= 3.8d-147) then
        tmp = a * (t_0 / (y_45scale / ((b_m / x_45scale) / y_45scale)))
    else
        tmp = (t_0 * ((b_m / y_45scale) / (x_45scale / a))) / y_45scale
    end if
    code = tmp
end function
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = (-4.0 * a) / (x_45_scale / b_m);
	double tmp;
	if (b_m <= 3.8e-147) {
		tmp = a * (t_0 / (y_45_scale / ((b_m / x_45_scale) / y_45_scale)));
	} else {
		tmp = (t_0 * ((b_m / y_45_scale) / (x_45_scale / a))) / y_45_scale;
	}
	return tmp;
}
b_m = math.fabs(b)
def code(a, b_m, angle, x_45_scale, y_45_scale):
	t_0 = (-4.0 * a) / (x_45_scale / b_m)
	tmp = 0
	if b_m <= 3.8e-147:
		tmp = a * (t_0 / (y_45_scale / ((b_m / x_45_scale) / y_45_scale)))
	else:
		tmp = (t_0 * ((b_m / y_45_scale) / (x_45_scale / a))) / y_45_scale
	return tmp
b_m = abs(b)
function code(a, b_m, angle, x_45_scale, y_45_scale)
	t_0 = Float64(Float64(-4.0 * a) / Float64(x_45_scale / b_m))
	tmp = 0.0
	if (b_m <= 3.8e-147)
		tmp = Float64(a * Float64(t_0 / Float64(y_45_scale / Float64(Float64(b_m / x_45_scale) / y_45_scale))));
	else
		tmp = Float64(Float64(t_0 * Float64(Float64(b_m / y_45_scale) / Float64(x_45_scale / a))) / y_45_scale);
	end
	return tmp
end
b_m = abs(b);
function tmp_2 = code(a, b_m, angle, x_45_scale, y_45_scale)
	t_0 = (-4.0 * a) / (x_45_scale / b_m);
	tmp = 0.0;
	if (b_m <= 3.8e-147)
		tmp = a * (t_0 / (y_45_scale / ((b_m / x_45_scale) / y_45_scale)));
	else
		tmp = (t_0 * ((b_m / y_45_scale) / (x_45_scale / a))) / y_45_scale;
	end
	tmp_2 = tmp;
end
b_m = N[Abs[b], $MachinePrecision]
code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(-4.0 * a), $MachinePrecision] / N[(x$45$scale / b$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b$95$m, 3.8e-147], N[(a * N[(t$95$0 / N[(y$45$scale / N[(N[(b$95$m / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(N[(b$95$m / y$45$scale), $MachinePrecision] / N[(x$45$scale / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision]]]
\begin{array}{l}
b_m = \left|b\right|

\\
\begin{array}{l}
t_0 := \frac{-4 \cdot a}{\frac{x-scale}{b\_m}}\\
\mathbf{if}\;b\_m \leq 3.8 \cdot 10^{-147}:\\
\;\;\;\;a \cdot \frac{t\_0}{\frac{y-scale}{\frac{\frac{b\_m}{x-scale}}{y-scale}}}\\

\mathbf{else}:\\
\;\;\;\;\frac{t\_0 \cdot \frac{\frac{b\_m}{y-scale}}{\frac{x-scale}{a}}}{y-scale}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 3.80000000000000028e-147

    1. Initial program 24.9%

      \[\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. Simplified18.2%

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

      \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
    5. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto -4 \cdot \left({a}^{2} \cdot \color{blue}{\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}}\right) \]
      2. associate-*r*N/A

        \[\leadsto \left(-4 \cdot {a}^{2}\right) \cdot \color{blue}{\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(-4 \cdot {a}^{2}\right), \color{blue}{\left(\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)}\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \left({a}^{2}\right)\right), \left(\frac{\color{blue}{{b}^{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \left(a \cdot a\right)\right), \left(\frac{{b}^{\color{blue}{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{{b}^{\color{blue}{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\color{blue}{{x-scale}^{2}} \cdot {y-scale}^{2}}\right)\right) \]
      8. times-fracN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b}{{x-scale}^{2}} \cdot \color{blue}{\frac{b}{{y-scale}^{2}}}\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\left(\frac{b}{{x-scale}^{2}}\right), \color{blue}{\left(\frac{b}{{y-scale}^{2}}\right)}\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \left({x-scale}^{2}\right)\right), \left(\frac{\color{blue}{b}}{{y-scale}^{2}}\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \left(x-scale \cdot x-scale\right)\right), \left(\frac{b}{{y-scale}^{2}}\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \left(\frac{b}{{y-scale}^{2}}\right)\right)\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \color{blue}{\left({y-scale}^{2}\right)}\right)\right)\right) \]
      14. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \left(y-scale \cdot \color{blue}{y-scale}\right)\right)\right)\right) \]
      15. *-lowering-*.f6450.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(y-scale, \color{blue}{y-scale}\right)\right)\right)\right) \]
    6. Simplified50.2%

      \[\leadsto \color{blue}{\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(\frac{b}{x-scale \cdot x-scale} \cdot \frac{b}{y-scale \cdot y-scale}\right)} \]
    7. Step-by-step derivation
      1. frac-timesN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\color{blue}{\left(x-scale \cdot x-scale\right) \cdot \left(y-scale \cdot y-scale\right)}}\right)\right) \]
      2. swap-sqrN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\left(x-scale \cdot y-scale\right) \cdot \color{blue}{\left(x-scale \cdot y-scale\right)}}\right)\right) \]
      3. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{x-scale \cdot \color{blue}{\left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}}\right)\right) \]
      4. associate-/l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(b \cdot \color{blue}{\frac{b}{x-scale \cdot \left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}}\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \color{blue}{\left(\frac{b}{x-scale \cdot \left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}\right)}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \color{blue}{\left(x-scale \cdot \left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)\right)}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \color{blue}{\left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}\right)\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \left(\left(x-scale \cdot y-scale\right) \cdot \color{blue}{y-scale}\right)\right)\right)\right)\right) \]
      9. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \left(x-scale \cdot \color{blue}{\left(y-scale \cdot y-scale\right)}\right)\right)\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \mathsf{*.f64}\left(x-scale, \color{blue}{\left(y-scale \cdot y-scale\right)}\right)\right)\right)\right)\right) \]
      11. *-lowering-*.f6452.6%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \mathsf{*.f64}\left(x-scale, \mathsf{*.f64}\left(y-scale, \color{blue}{y-scale}\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr52.6%

      \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \color{blue}{\left(b \cdot \frac{b}{x-scale \cdot \left(x-scale \cdot \left(y-scale \cdot y-scale\right)\right)}\right)} \]
    9. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\color{blue}{x-scale \cdot \left(x-scale \cdot \left(y-scale \cdot y-scale\right)\right)}}\right)\right) \]
      2. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{\frac{b \cdot b}{x-scale}}{\color{blue}{x-scale \cdot \left(y-scale \cdot y-scale\right)}}\right)\right) \]
      3. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{\frac{b \cdot b}{x-scale}}{\left(x-scale \cdot y-scale\right) \cdot \color{blue}{y-scale}}\right)\right) \]
      4. associate-/l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{\frac{\frac{b \cdot b}{x-scale}}{y-scale}}{\color{blue}{x-scale \cdot y-scale}}\right)\right) \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{\frac{b \cdot b}{x-scale \cdot y-scale}}{\color{blue}{x-scale} \cdot y-scale}\right)\right) \]
      6. associate-/l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot \frac{b}{x-scale \cdot y-scale}}{\color{blue}{x-scale} \cdot y-scale}\right)\right) \]
      7. times-fracN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b}{x-scale} \cdot \color{blue}{\frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}}\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\left(\frac{b}{x-scale}\right), \color{blue}{\left(\frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}\right)}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), \left(\frac{\color{blue}{\frac{b}{x-scale \cdot y-scale}}}{y-scale}\right)\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), \mathsf{/.f64}\left(\left(\frac{b}{x-scale \cdot y-scale}\right), \color{blue}{y-scale}\right)\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(b, \left(x-scale \cdot y-scale\right)\right), y-scale\right)\right)\right) \]
      12. *-lowering-*.f6470.1%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, y-scale\right)\right), y-scale\right)\right)\right) \]
    10. Applied egg-rr70.1%

      \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \color{blue}{\left(\frac{b}{x-scale} \cdot \frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}\right)} \]
    11. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{b}{x-scale}\right) \cdot \color{blue}{\frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}} \]
      2. *-commutativeN/A

        \[\leadsto \left(\left(\left(a \cdot a\right) \cdot -4\right) \cdot \frac{b}{x-scale}\right) \cdot \frac{\frac{\color{blue}{b}}{x-scale \cdot y-scale}}{y-scale} \]
      3. associate-*r*N/A

        \[\leadsto \left(\left(a \cdot \left(a \cdot -4\right)\right) \cdot \frac{b}{x-scale}\right) \cdot \frac{\frac{\color{blue}{b}}{x-scale \cdot y-scale}}{y-scale} \]
      4. associate-*l*N/A

        \[\leadsto \left(a \cdot \left(\left(a \cdot -4\right) \cdot \frac{b}{x-scale}\right)\right) \cdot \frac{\color{blue}{\frac{b}{x-scale \cdot y-scale}}}{y-scale} \]
      5. associate-*l*N/A

        \[\leadsto a \cdot \color{blue}{\left(\left(\left(a \cdot -4\right) \cdot \frac{b}{x-scale}\right) \cdot \frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}\right)} \]
      6. *-commutativeN/A

        \[\leadsto \left(\left(\left(a \cdot -4\right) \cdot \frac{b}{x-scale}\right) \cdot \frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}\right) \cdot \color{blue}{a} \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\left(\left(a \cdot -4\right) \cdot \frac{b}{x-scale}\right) \cdot \frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}\right), \color{blue}{a}\right) \]
    12. Applied egg-rr83.4%

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

    if 3.80000000000000028e-147 < b

    1. Initial program 19.4%

      \[\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. Simplified18.4%

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

      \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
    5. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto -4 \cdot \left({a}^{2} \cdot \color{blue}{\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}}\right) \]
      2. associate-*r*N/A

        \[\leadsto \left(-4 \cdot {a}^{2}\right) \cdot \color{blue}{\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(-4 \cdot {a}^{2}\right), \color{blue}{\left(\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)}\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \left({a}^{2}\right)\right), \left(\frac{\color{blue}{{b}^{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \left(a \cdot a\right)\right), \left(\frac{{b}^{\color{blue}{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{{b}^{\color{blue}{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\color{blue}{{x-scale}^{2}} \cdot {y-scale}^{2}}\right)\right) \]
      8. times-fracN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b}{{x-scale}^{2}} \cdot \color{blue}{\frac{b}{{y-scale}^{2}}}\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\left(\frac{b}{{x-scale}^{2}}\right), \color{blue}{\left(\frac{b}{{y-scale}^{2}}\right)}\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \left({x-scale}^{2}\right)\right), \left(\frac{\color{blue}{b}}{{y-scale}^{2}}\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \left(x-scale \cdot x-scale\right)\right), \left(\frac{b}{{y-scale}^{2}}\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \left(\frac{b}{{y-scale}^{2}}\right)\right)\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \color{blue}{\left({y-scale}^{2}\right)}\right)\right)\right) \]
      14. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \left(y-scale \cdot \color{blue}{y-scale}\right)\right)\right)\right) \]
      15. *-lowering-*.f6460.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(y-scale, \color{blue}{y-scale}\right)\right)\right)\right) \]
    6. Simplified60.5%

      \[\leadsto \color{blue}{\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(\frac{b}{x-scale \cdot x-scale} \cdot \frac{b}{y-scale \cdot y-scale}\right)} \]
    7. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{b}{x-scale \cdot x-scale}\right) \cdot \color{blue}{\frac{b}{y-scale \cdot y-scale}} \]
      2. associate-/r*N/A

        \[\leadsto \left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{b}{x-scale \cdot x-scale}\right) \cdot \frac{\frac{b}{y-scale}}{\color{blue}{y-scale}} \]
      3. associate-*r/N/A

        \[\leadsto \frac{\left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{b}{x-scale \cdot x-scale}\right) \cdot \frac{b}{y-scale}}{\color{blue}{y-scale}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{b}{x-scale \cdot x-scale}\right) \cdot \frac{b}{y-scale}\right), \color{blue}{y-scale}\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{b}{x-scale \cdot x-scale}\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\left(\left(a \cdot a\right) \cdot -4\right) \cdot \frac{b}{x-scale \cdot x-scale}\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
      7. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\left(a \cdot a\right) \cdot \left(-4 \cdot \frac{b}{x-scale \cdot x-scale}\right)\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(a \cdot a\right), \left(-4 \cdot \frac{b}{x-scale \cdot x-scale}\right)\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(a, a\right), \left(-4 \cdot \frac{b}{x-scale \cdot x-scale}\right)\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(-4, \left(\frac{b}{x-scale \cdot x-scale}\right)\right)\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(-4, \mathsf{/.f64}\left(b, \left(x-scale \cdot x-scale\right)\right)\right)\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(-4, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right)\right)\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
      13. /-lowering-/.f6468.4%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(-4, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right)\right)\right), \mathsf{/.f64}\left(b, y-scale\right)\right), y-scale\right) \]
    8. Applied egg-rr68.4%

      \[\leadsto \color{blue}{\frac{\left(\left(a \cdot a\right) \cdot \left(-4 \cdot \frac{b}{x-scale \cdot x-scale}\right)\right) \cdot \frac{b}{y-scale}}{y-scale}} \]
    9. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\left(\left(a \cdot a\right) \cdot -4\right) \cdot \frac{b}{x-scale \cdot x-scale}\right), \mathsf{/.f64}\left(b, y-scale\right)\right), y-scale\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{b}{x-scale \cdot x-scale}\right), \mathsf{/.f64}\left(b, y-scale\right)\right), y-scale\right) \]
      3. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\left(\left(-4 \cdot a\right) \cdot a\right) \cdot \frac{b}{x-scale \cdot x-scale}\right), \mathsf{/.f64}\left(b, y-scale\right)\right), y-scale\right) \]
      4. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\left(-4 \cdot a\right) \cdot \left(a \cdot \frac{b}{x-scale \cdot x-scale}\right)\right), \mathsf{/.f64}\left(b, y-scale\right)\right), y-scale\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(-4 \cdot a\right), \left(a \cdot \frac{b}{x-scale \cdot x-scale}\right)\right), \mathsf{/.f64}\left(b, y-scale\right)\right), y-scale\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(a \cdot -4\right), \left(a \cdot \frac{b}{x-scale \cdot x-scale}\right)\right), \mathsf{/.f64}\left(b, y-scale\right)\right), y-scale\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(a, -4\right), \left(a \cdot \frac{b}{x-scale \cdot x-scale}\right)\right), \mathsf{/.f64}\left(b, y-scale\right)\right), y-scale\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(a, -4\right), \mathsf{*.f64}\left(a, \left(\frac{b}{x-scale \cdot x-scale}\right)\right)\right), \mathsf{/.f64}\left(b, y-scale\right)\right), y-scale\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(a, -4\right), \mathsf{*.f64}\left(a, \mathsf{/.f64}\left(b, \left(x-scale \cdot x-scale\right)\right)\right)\right), \mathsf{/.f64}\left(b, y-scale\right)\right), y-scale\right) \]
      10. *-lowering-*.f6472.1%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(a, -4\right), \mathsf{*.f64}\left(a, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right)\right)\right), \mathsf{/.f64}\left(b, y-scale\right)\right), y-scale\right) \]
    10. Applied egg-rr72.1%

      \[\leadsto \frac{\color{blue}{\left(\left(a \cdot -4\right) \cdot \left(a \cdot \frac{b}{x-scale \cdot x-scale}\right)\right)} \cdot \frac{b}{y-scale}}{y-scale} \]
    11. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{b}{y-scale} \cdot \left(\left(a \cdot -4\right) \cdot \left(a \cdot \frac{b}{x-scale \cdot x-scale}\right)\right)\right), y-scale\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{b}{y-scale} \cdot \left(\left(\left(a \cdot -4\right) \cdot a\right) \cdot \frac{b}{x-scale \cdot x-scale}\right)\right), y-scale\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{b}{y-scale} \cdot \left(\left(a \cdot \left(a \cdot -4\right)\right) \cdot \frac{b}{x-scale \cdot x-scale}\right)\right), y-scale\right) \]
      4. associate-/r*N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{b}{y-scale} \cdot \left(\left(a \cdot \left(a \cdot -4\right)\right) \cdot \frac{\frac{b}{x-scale}}{x-scale}\right)\right), y-scale\right) \]
      5. associate-/l*N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{b}{y-scale} \cdot \frac{\left(a \cdot \left(a \cdot -4\right)\right) \cdot \frac{b}{x-scale}}{x-scale}\right), y-scale\right) \]
      6. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{b}{y-scale} \cdot \frac{1}{\frac{x-scale}{\left(a \cdot \left(a \cdot -4\right)\right) \cdot \frac{b}{x-scale}}}\right), y-scale\right) \]
      7. un-div-invN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{b}{y-scale}}{\frac{x-scale}{\left(a \cdot \left(a \cdot -4\right)\right) \cdot \frac{b}{x-scale}}}\right), y-scale\right) \]
      8. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{b}{y-scale}}{\frac{x-scale}{a \cdot \left(\left(a \cdot -4\right) \cdot \frac{b}{x-scale}\right)}}\right), y-scale\right) \]
      9. associate-/r*N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{b}{y-scale}}{\frac{\frac{x-scale}{a}}{\left(a \cdot -4\right) \cdot \frac{b}{x-scale}}}\right), y-scale\right) \]
      10. associate-/r/N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{b}{y-scale}}{\frac{x-scale}{a}} \cdot \left(\left(a \cdot -4\right) \cdot \frac{b}{x-scale}\right)\right), y-scale\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\frac{\frac{b}{y-scale}}{\frac{x-scale}{a}}\right), \left(\left(a \cdot -4\right) \cdot \frac{b}{x-scale}\right)\right), y-scale\right) \]
      12. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{b}{y-scale}\right), \left(\frac{x-scale}{a}\right)\right), \left(\left(a \cdot -4\right) \cdot \frac{b}{x-scale}\right)\right), y-scale\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(b, y-scale\right), \left(\frac{x-scale}{a}\right)\right), \left(\left(a \cdot -4\right) \cdot \frac{b}{x-scale}\right)\right), y-scale\right) \]
      14. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(b, y-scale\right), \mathsf{/.f64}\left(x-scale, a\right)\right), \left(\left(a \cdot -4\right) \cdot \frac{b}{x-scale}\right)\right), y-scale\right) \]
      15. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(b, y-scale\right), \mathsf{/.f64}\left(x-scale, a\right)\right), \left(\left(a \cdot -4\right) \cdot \frac{1}{\frac{x-scale}{b}}\right)\right), y-scale\right) \]
      16. un-div-invN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(b, y-scale\right), \mathsf{/.f64}\left(x-scale, a\right)\right), \left(\frac{a \cdot -4}{\frac{x-scale}{b}}\right)\right), y-scale\right) \]
      17. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(b, y-scale\right), \mathsf{/.f64}\left(x-scale, a\right)\right), \mathsf{/.f64}\left(\left(a \cdot -4\right), \left(\frac{x-scale}{b}\right)\right)\right), y-scale\right) \]
      18. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(b, y-scale\right), \mathsf{/.f64}\left(x-scale, a\right)\right), \mathsf{/.f64}\left(\left(-4 \cdot a\right), \left(\frac{x-scale}{b}\right)\right)\right), y-scale\right) \]
      19. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(b, y-scale\right), \mathsf{/.f64}\left(x-scale, a\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(-4, a\right), \left(\frac{x-scale}{b}\right)\right)\right), y-scale\right) \]
      20. /-lowering-/.f6489.1%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(b, y-scale\right), \mathsf{/.f64}\left(x-scale, a\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(-4, a\right), \mathsf{/.f64}\left(x-scale, b\right)\right)\right), y-scale\right) \]
    12. Applied egg-rr89.1%

      \[\leadsto \frac{\color{blue}{\frac{\frac{b}{y-scale}}{\frac{x-scale}{a}} \cdot \frac{-4 \cdot a}{\frac{x-scale}{b}}}}{y-scale} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification85.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 3.8 \cdot 10^{-147}:\\ \;\;\;\;a \cdot \frac{\frac{-4 \cdot a}{\frac{x-scale}{b}}}{\frac{y-scale}{\frac{\frac{b}{x-scale}}{y-scale}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-4 \cdot a}{\frac{x-scale}{b}} \cdot \frac{\frac{b}{y-scale}}{\frac{x-scale}{a}}}{y-scale}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 84.3% accurate, 76.9× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ \begin{array}{l} t_0 := \frac{\frac{b\_m}{x-scale}}{y-scale}\\ \mathbf{if}\;y-scale \leq 2.7 \cdot 10^{+216}:\\ \;\;\;\;a \cdot \frac{\frac{-4 \cdot a}{\frac{x-scale}{b\_m}}}{\frac{y-scale}{t\_0}}\\ \mathbf{else}:\\ \;\;\;\;\frac{a \cdot \left(b\_m \cdot \left(-4 \cdot a\right)\right)}{y-scale} \cdot \frac{t\_0}{x-scale}\\ \end{array} \end{array} \]
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
 :precision binary64
 (let* ((t_0 (/ (/ b_m x-scale) y-scale)))
   (if (<= y-scale 2.7e+216)
     (* a (/ (/ (* -4.0 a) (/ x-scale b_m)) (/ y-scale t_0)))
     (* (/ (* a (* b_m (* -4.0 a))) y-scale) (/ t_0 x-scale)))))
b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = (b_m / x_45_scale) / y_45_scale;
	double tmp;
	if (y_45_scale <= 2.7e+216) {
		tmp = a * (((-4.0 * a) / (x_45_scale / b_m)) / (y_45_scale / t_0));
	} else {
		tmp = ((a * (b_m * (-4.0 * a))) / y_45_scale) * (t_0 / x_45_scale);
	}
	return tmp;
}
b_m = abs(b)
real(8) function code(a, b_m, angle, x_45scale, y_45scale)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: angle
    real(8), intent (in) :: x_45scale
    real(8), intent (in) :: y_45scale
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (b_m / x_45scale) / y_45scale
    if (y_45scale <= 2.7d+216) then
        tmp = a * ((((-4.0d0) * a) / (x_45scale / b_m)) / (y_45scale / t_0))
    else
        tmp = ((a * (b_m * ((-4.0d0) * a))) / y_45scale) * (t_0 / x_45scale)
    end if
    code = tmp
end function
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = (b_m / x_45_scale) / y_45_scale;
	double tmp;
	if (y_45_scale <= 2.7e+216) {
		tmp = a * (((-4.0 * a) / (x_45_scale / b_m)) / (y_45_scale / t_0));
	} else {
		tmp = ((a * (b_m * (-4.0 * a))) / y_45_scale) * (t_0 / x_45_scale);
	}
	return tmp;
}
b_m = math.fabs(b)
def code(a, b_m, angle, x_45_scale, y_45_scale):
	t_0 = (b_m / x_45_scale) / y_45_scale
	tmp = 0
	if y_45_scale <= 2.7e+216:
		tmp = a * (((-4.0 * a) / (x_45_scale / b_m)) / (y_45_scale / t_0))
	else:
		tmp = ((a * (b_m * (-4.0 * a))) / y_45_scale) * (t_0 / x_45_scale)
	return tmp
b_m = abs(b)
function code(a, b_m, angle, x_45_scale, y_45_scale)
	t_0 = Float64(Float64(b_m / x_45_scale) / y_45_scale)
	tmp = 0.0
	if (y_45_scale <= 2.7e+216)
		tmp = Float64(a * Float64(Float64(Float64(-4.0 * a) / Float64(x_45_scale / b_m)) / Float64(y_45_scale / t_0)));
	else
		tmp = Float64(Float64(Float64(a * Float64(b_m * Float64(-4.0 * a))) / y_45_scale) * Float64(t_0 / x_45_scale));
	end
	return tmp
end
b_m = abs(b);
function tmp_2 = code(a, b_m, angle, x_45_scale, y_45_scale)
	t_0 = (b_m / x_45_scale) / y_45_scale;
	tmp = 0.0;
	if (y_45_scale <= 2.7e+216)
		tmp = a * (((-4.0 * a) / (x_45_scale / b_m)) / (y_45_scale / t_0));
	else
		tmp = ((a * (b_m * (-4.0 * a))) / y_45_scale) * (t_0 / x_45_scale);
	end
	tmp_2 = tmp;
end
b_m = N[Abs[b], $MachinePrecision]
code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(b$95$m / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, If[LessEqual[y$45$scale, 2.7e+216], N[(a * N[(N[(N[(-4.0 * a), $MachinePrecision] / N[(x$45$scale / b$95$m), $MachinePrecision]), $MachinePrecision] / N[(y$45$scale / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a * N[(b$95$m * N[(-4.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] * N[(t$95$0 / x$45$scale), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
b_m = \left|b\right|

\\
\begin{array}{l}
t_0 := \frac{\frac{b\_m}{x-scale}}{y-scale}\\
\mathbf{if}\;y-scale \leq 2.7 \cdot 10^{+216}:\\
\;\;\;\;a \cdot \frac{\frac{-4 \cdot a}{\frac{x-scale}{b\_m}}}{\frac{y-scale}{t\_0}}\\

\mathbf{else}:\\
\;\;\;\;\frac{a \cdot \left(b\_m \cdot \left(-4 \cdot a\right)\right)}{y-scale} \cdot \frac{t\_0}{x-scale}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y-scale < 2.7000000000000001e216

    1. Initial program 21.7%

      \[\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. Simplified16.8%

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

      \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
    5. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto -4 \cdot \left({a}^{2} \cdot \color{blue}{\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}}\right) \]
      2. associate-*r*N/A

        \[\leadsto \left(-4 \cdot {a}^{2}\right) \cdot \color{blue}{\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(-4 \cdot {a}^{2}\right), \color{blue}{\left(\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)}\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \left({a}^{2}\right)\right), \left(\frac{\color{blue}{{b}^{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \left(a \cdot a\right)\right), \left(\frac{{b}^{\color{blue}{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{{b}^{\color{blue}{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\color{blue}{{x-scale}^{2}} \cdot {y-scale}^{2}}\right)\right) \]
      8. times-fracN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b}{{x-scale}^{2}} \cdot \color{blue}{\frac{b}{{y-scale}^{2}}}\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\left(\frac{b}{{x-scale}^{2}}\right), \color{blue}{\left(\frac{b}{{y-scale}^{2}}\right)}\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \left({x-scale}^{2}\right)\right), \left(\frac{\color{blue}{b}}{{y-scale}^{2}}\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \left(x-scale \cdot x-scale\right)\right), \left(\frac{b}{{y-scale}^{2}}\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \left(\frac{b}{{y-scale}^{2}}\right)\right)\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \color{blue}{\left({y-scale}^{2}\right)}\right)\right)\right) \]
      14. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \left(y-scale \cdot \color{blue}{y-scale}\right)\right)\right)\right) \]
      15. *-lowering-*.f6455.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(y-scale, \color{blue}{y-scale}\right)\right)\right)\right) \]
    6. Simplified55.0%

      \[\leadsto \color{blue}{\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(\frac{b}{x-scale \cdot x-scale} \cdot \frac{b}{y-scale \cdot y-scale}\right)} \]
    7. Step-by-step derivation
      1. frac-timesN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\color{blue}{\left(x-scale \cdot x-scale\right) \cdot \left(y-scale \cdot y-scale\right)}}\right)\right) \]
      2. swap-sqrN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\left(x-scale \cdot y-scale\right) \cdot \color{blue}{\left(x-scale \cdot y-scale\right)}}\right)\right) \]
      3. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{x-scale \cdot \color{blue}{\left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}}\right)\right) \]
      4. associate-/l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(b \cdot \color{blue}{\frac{b}{x-scale \cdot \left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}}\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \color{blue}{\left(\frac{b}{x-scale \cdot \left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}\right)}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \color{blue}{\left(x-scale \cdot \left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)\right)}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \color{blue}{\left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}\right)\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \left(\left(x-scale \cdot y-scale\right) \cdot \color{blue}{y-scale}\right)\right)\right)\right)\right) \]
      9. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \left(x-scale \cdot \color{blue}{\left(y-scale \cdot y-scale\right)}\right)\right)\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \mathsf{*.f64}\left(x-scale, \color{blue}{\left(y-scale \cdot y-scale\right)}\right)\right)\right)\right)\right) \]
      11. *-lowering-*.f6459.1%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \mathsf{*.f64}\left(x-scale, \mathsf{*.f64}\left(y-scale, \color{blue}{y-scale}\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr59.1%

      \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \color{blue}{\left(b \cdot \frac{b}{x-scale \cdot \left(x-scale \cdot \left(y-scale \cdot y-scale\right)\right)}\right)} \]
    9. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\color{blue}{x-scale \cdot \left(x-scale \cdot \left(y-scale \cdot y-scale\right)\right)}}\right)\right) \]
      2. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{\frac{b \cdot b}{x-scale}}{\color{blue}{x-scale \cdot \left(y-scale \cdot y-scale\right)}}\right)\right) \]
      3. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{\frac{b \cdot b}{x-scale}}{\left(x-scale \cdot y-scale\right) \cdot \color{blue}{y-scale}}\right)\right) \]
      4. associate-/l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{\frac{\frac{b \cdot b}{x-scale}}{y-scale}}{\color{blue}{x-scale \cdot y-scale}}\right)\right) \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{\frac{b \cdot b}{x-scale \cdot y-scale}}{\color{blue}{x-scale} \cdot y-scale}\right)\right) \]
      6. associate-/l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot \frac{b}{x-scale \cdot y-scale}}{\color{blue}{x-scale} \cdot y-scale}\right)\right) \]
      7. times-fracN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b}{x-scale} \cdot \color{blue}{\frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}}\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\left(\frac{b}{x-scale}\right), \color{blue}{\left(\frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}\right)}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), \left(\frac{\color{blue}{\frac{b}{x-scale \cdot y-scale}}}{y-scale}\right)\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), \mathsf{/.f64}\left(\left(\frac{b}{x-scale \cdot y-scale}\right), \color{blue}{y-scale}\right)\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(b, \left(x-scale \cdot y-scale\right)\right), y-scale\right)\right)\right) \]
      12. *-lowering-*.f6474.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, y-scale\right)\right), y-scale\right)\right)\right) \]
    10. Applied egg-rr74.0%

      \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \color{blue}{\left(\frac{b}{x-scale} \cdot \frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}\right)} \]
    11. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{b}{x-scale}\right) \cdot \color{blue}{\frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}} \]
      2. *-commutativeN/A

        \[\leadsto \left(\left(\left(a \cdot a\right) \cdot -4\right) \cdot \frac{b}{x-scale}\right) \cdot \frac{\frac{\color{blue}{b}}{x-scale \cdot y-scale}}{y-scale} \]
      3. associate-*r*N/A

        \[\leadsto \left(\left(a \cdot \left(a \cdot -4\right)\right) \cdot \frac{b}{x-scale}\right) \cdot \frac{\frac{\color{blue}{b}}{x-scale \cdot y-scale}}{y-scale} \]
      4. associate-*l*N/A

        \[\leadsto \left(a \cdot \left(\left(a \cdot -4\right) \cdot \frac{b}{x-scale}\right)\right) \cdot \frac{\color{blue}{\frac{b}{x-scale \cdot y-scale}}}{y-scale} \]
      5. associate-*l*N/A

        \[\leadsto a \cdot \color{blue}{\left(\left(\left(a \cdot -4\right) \cdot \frac{b}{x-scale}\right) \cdot \frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}\right)} \]
      6. *-commutativeN/A

        \[\leadsto \left(\left(\left(a \cdot -4\right) \cdot \frac{b}{x-scale}\right) \cdot \frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}\right) \cdot \color{blue}{a} \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\left(\left(a \cdot -4\right) \cdot \frac{b}{x-scale}\right) \cdot \frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}\right), \color{blue}{a}\right) \]
    12. Applied egg-rr86.8%

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

    if 2.7000000000000001e216 < y-scale

    1. Initial program 35.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. Simplified35.4%

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

      \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
    5. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto -4 \cdot \left({a}^{2} \cdot \color{blue}{\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}}\right) \]
      2. associate-*r*N/A

        \[\leadsto \left(-4 \cdot {a}^{2}\right) \cdot \color{blue}{\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(-4 \cdot {a}^{2}\right), \color{blue}{\left(\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)}\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \left({a}^{2}\right)\right), \left(\frac{\color{blue}{{b}^{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \left(a \cdot a\right)\right), \left(\frac{{b}^{\color{blue}{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{{b}^{\color{blue}{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\color{blue}{{x-scale}^{2}} \cdot {y-scale}^{2}}\right)\right) \]
      8. times-fracN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b}{{x-scale}^{2}} \cdot \color{blue}{\frac{b}{{y-scale}^{2}}}\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\left(\frac{b}{{x-scale}^{2}}\right), \color{blue}{\left(\frac{b}{{y-scale}^{2}}\right)}\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \left({x-scale}^{2}\right)\right), \left(\frac{\color{blue}{b}}{{y-scale}^{2}}\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \left(x-scale \cdot x-scale\right)\right), \left(\frac{b}{{y-scale}^{2}}\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \left(\frac{b}{{y-scale}^{2}}\right)\right)\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \color{blue}{\left({y-scale}^{2}\right)}\right)\right)\right) \]
      14. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \left(y-scale \cdot \color{blue}{y-scale}\right)\right)\right)\right) \]
      15. *-lowering-*.f6445.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(y-scale, \color{blue}{y-scale}\right)\right)\right)\right) \]
    6. Simplified45.8%

      \[\leadsto \color{blue}{\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(\frac{b}{x-scale \cdot x-scale} \cdot \frac{b}{y-scale \cdot y-scale}\right)} \]
    7. Step-by-step derivation
      1. frac-timesN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\color{blue}{\left(x-scale \cdot x-scale\right) \cdot \left(y-scale \cdot y-scale\right)}}\right)\right) \]
      2. swap-sqrN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\left(x-scale \cdot y-scale\right) \cdot \color{blue}{\left(x-scale \cdot y-scale\right)}}\right)\right) \]
      3. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{x-scale \cdot \color{blue}{\left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}}\right)\right) \]
      4. associate-/l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(b \cdot \color{blue}{\frac{b}{x-scale \cdot \left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}}\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \color{blue}{\left(\frac{b}{x-scale \cdot \left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}\right)}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \color{blue}{\left(x-scale \cdot \left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)\right)}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \color{blue}{\left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}\right)\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \left(\left(x-scale \cdot y-scale\right) \cdot \color{blue}{y-scale}\right)\right)\right)\right)\right) \]
      9. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \left(x-scale \cdot \color{blue}{\left(y-scale \cdot y-scale\right)}\right)\right)\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \mathsf{*.f64}\left(x-scale, \color{blue}{\left(y-scale \cdot y-scale\right)}\right)\right)\right)\right)\right) \]
      11. *-lowering-*.f6446.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \mathsf{*.f64}\left(x-scale, \mathsf{*.f64}\left(y-scale, \color{blue}{y-scale}\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr46.2%

      \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \color{blue}{\left(b \cdot \frac{b}{x-scale \cdot \left(x-scale \cdot \left(y-scale \cdot y-scale\right)\right)}\right)} \]
    9. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\color{blue}{x-scale \cdot \left(x-scale \cdot \left(y-scale \cdot y-scale\right)\right)}}\right)\right) \]
      2. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{\frac{b \cdot b}{x-scale}}{\color{blue}{x-scale \cdot \left(y-scale \cdot y-scale\right)}}\right)\right) \]
      3. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{\frac{b \cdot b}{x-scale}}{\left(x-scale \cdot y-scale\right) \cdot \color{blue}{y-scale}}\right)\right) \]
      4. associate-/l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{\frac{\frac{b \cdot b}{x-scale}}{y-scale}}{\color{blue}{x-scale \cdot y-scale}}\right)\right) \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{\frac{b \cdot b}{x-scale \cdot y-scale}}{\color{blue}{x-scale} \cdot y-scale}\right)\right) \]
      6. associate-/l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot \frac{b}{x-scale \cdot y-scale}}{\color{blue}{x-scale} \cdot y-scale}\right)\right) \]
      7. times-fracN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b}{x-scale} \cdot \color{blue}{\frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}}\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\left(\frac{b}{x-scale}\right), \color{blue}{\left(\frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}\right)}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), \left(\frac{\color{blue}{\frac{b}{x-scale \cdot y-scale}}}{y-scale}\right)\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), \mathsf{/.f64}\left(\left(\frac{b}{x-scale \cdot y-scale}\right), \color{blue}{y-scale}\right)\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(b, \left(x-scale \cdot y-scale\right)\right), y-scale\right)\right)\right) \]
      12. *-lowering-*.f6451.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, y-scale\right)\right), y-scale\right)\right)\right) \]
    10. Applied egg-rr51.0%

      \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \color{blue}{\left(\frac{b}{x-scale} \cdot \frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}\right)} \]
    11. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(\frac{\frac{b}{x-scale \cdot y-scale}}{y-scale} \cdot \color{blue}{\frac{b}{x-scale}}\right) \]
      2. associate-/l/N/A

        \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(\frac{b}{y-scale \cdot \left(x-scale \cdot y-scale\right)} \cdot \frac{\color{blue}{b}}{x-scale}\right) \]
      3. associate-*l/N/A

        \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{b \cdot \frac{b}{x-scale}}{\color{blue}{y-scale \cdot \left(x-scale \cdot y-scale\right)}} \]
      4. associate-*r/N/A

        \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(b \cdot \color{blue}{\frac{\frac{b}{x-scale}}{y-scale \cdot \left(x-scale \cdot y-scale\right)}}\right) \]
      5. associate-/l/N/A

        \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(b \cdot \frac{\frac{\frac{b}{x-scale}}{x-scale \cdot y-scale}}{\color{blue}{y-scale}}\right) \]
      6. associate-*r*N/A

        \[\leadsto \left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot b\right) \cdot \color{blue}{\frac{\frac{\frac{b}{x-scale}}{x-scale \cdot y-scale}}{y-scale}} \]
      7. clear-numN/A

        \[\leadsto \left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot b\right) \cdot \frac{1}{\color{blue}{\frac{y-scale}{\frac{\frac{b}{x-scale}}{x-scale \cdot y-scale}}}} \]
      8. un-div-invN/A

        \[\leadsto \frac{\left(-4 \cdot \left(a \cdot a\right)\right) \cdot b}{\color{blue}{\frac{y-scale}{\frac{\frac{b}{x-scale}}{x-scale \cdot y-scale}}}} \]
      9. associate-/r/N/A

        \[\leadsto \frac{\left(-4 \cdot \left(a \cdot a\right)\right) \cdot b}{y-scale} \cdot \color{blue}{\frac{\frac{b}{x-scale}}{x-scale \cdot y-scale}} \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{\left(-4 \cdot \left(a \cdot a\right)\right) \cdot b}{y-scale}\right), \color{blue}{\left(\frac{\frac{b}{x-scale}}{x-scale \cdot y-scale}\right)}\right) \]
    12. Applied egg-rr74.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y-scale \leq 2.7 \cdot 10^{+216}:\\ \;\;\;\;a \cdot \frac{\frac{-4 \cdot a}{\frac{x-scale}{b}}}{\frac{y-scale}{\frac{\frac{b}{x-scale}}{y-scale}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{a \cdot \left(b \cdot \left(-4 \cdot a\right)\right)}{y-scale} \cdot \frac{\frac{\frac{b}{x-scale}}{y-scale}}{x-scale}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 79.5% accurate, 76.9× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ \begin{array}{l} t_0 := \frac{\frac{b\_m}{x-scale}}{y-scale}\\ \mathbf{if}\;angle \leq 1.25 \cdot 10^{-17}:\\ \;\;\;\;\frac{a \cdot \left(b\_m \cdot \left(-4 \cdot a\right)\right)}{y-scale} \cdot \frac{t\_0}{x-scale}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(\left(-4 \cdot a\right) \cdot \frac{t\_0}{\frac{x-scale}{\frac{b\_m}{y-scale}}}\right)\\ \end{array} \end{array} \]
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
 :precision binary64
 (let* ((t_0 (/ (/ b_m x-scale) y-scale)))
   (if (<= angle 1.25e-17)
     (* (/ (* a (* b_m (* -4.0 a))) y-scale) (/ t_0 x-scale))
     (* a (* (* -4.0 a) (/ t_0 (/ x-scale (/ b_m y-scale))))))))
b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = (b_m / x_45_scale) / y_45_scale;
	double tmp;
	if (angle <= 1.25e-17) {
		tmp = ((a * (b_m * (-4.0 * a))) / y_45_scale) * (t_0 / x_45_scale);
	} else {
		tmp = a * ((-4.0 * a) * (t_0 / (x_45_scale / (b_m / y_45_scale))));
	}
	return tmp;
}
b_m = abs(b)
real(8) function code(a, b_m, angle, x_45scale, y_45scale)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: angle
    real(8), intent (in) :: x_45scale
    real(8), intent (in) :: y_45scale
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (b_m / x_45scale) / y_45scale
    if (angle <= 1.25d-17) then
        tmp = ((a * (b_m * ((-4.0d0) * a))) / y_45scale) * (t_0 / x_45scale)
    else
        tmp = a * (((-4.0d0) * a) * (t_0 / (x_45scale / (b_m / y_45scale))))
    end if
    code = tmp
end function
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = (b_m / x_45_scale) / y_45_scale;
	double tmp;
	if (angle <= 1.25e-17) {
		tmp = ((a * (b_m * (-4.0 * a))) / y_45_scale) * (t_0 / x_45_scale);
	} else {
		tmp = a * ((-4.0 * a) * (t_0 / (x_45_scale / (b_m / y_45_scale))));
	}
	return tmp;
}
b_m = math.fabs(b)
def code(a, b_m, angle, x_45_scale, y_45_scale):
	t_0 = (b_m / x_45_scale) / y_45_scale
	tmp = 0
	if angle <= 1.25e-17:
		tmp = ((a * (b_m * (-4.0 * a))) / y_45_scale) * (t_0 / x_45_scale)
	else:
		tmp = a * ((-4.0 * a) * (t_0 / (x_45_scale / (b_m / y_45_scale))))
	return tmp
b_m = abs(b)
function code(a, b_m, angle, x_45_scale, y_45_scale)
	t_0 = Float64(Float64(b_m / x_45_scale) / y_45_scale)
	tmp = 0.0
	if (angle <= 1.25e-17)
		tmp = Float64(Float64(Float64(a * Float64(b_m * Float64(-4.0 * a))) / y_45_scale) * Float64(t_0 / x_45_scale));
	else
		tmp = Float64(a * Float64(Float64(-4.0 * a) * Float64(t_0 / Float64(x_45_scale / Float64(b_m / y_45_scale)))));
	end
	return tmp
end
b_m = abs(b);
function tmp_2 = code(a, b_m, angle, x_45_scale, y_45_scale)
	t_0 = (b_m / x_45_scale) / y_45_scale;
	tmp = 0.0;
	if (angle <= 1.25e-17)
		tmp = ((a * (b_m * (-4.0 * a))) / y_45_scale) * (t_0 / x_45_scale);
	else
		tmp = a * ((-4.0 * a) * (t_0 / (x_45_scale / (b_m / y_45_scale))));
	end
	tmp_2 = tmp;
end
b_m = N[Abs[b], $MachinePrecision]
code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(b$95$m / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, If[LessEqual[angle, 1.25e-17], N[(N[(N[(a * N[(b$95$m * N[(-4.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] * N[(t$95$0 / x$45$scale), $MachinePrecision]), $MachinePrecision], N[(a * N[(N[(-4.0 * a), $MachinePrecision] * N[(t$95$0 / N[(x$45$scale / N[(b$95$m / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
b_m = \left|b\right|

\\
\begin{array}{l}
t_0 := \frac{\frac{b\_m}{x-scale}}{y-scale}\\
\mathbf{if}\;angle \leq 1.25 \cdot 10^{-17}:\\
\;\;\;\;\frac{a \cdot \left(b\_m \cdot \left(-4 \cdot a\right)\right)}{y-scale} \cdot \frac{t\_0}{x-scale}\\

\mathbf{else}:\\
\;\;\;\;a \cdot \left(\left(-4 \cdot a\right) \cdot \frac{t\_0}{\frac{x-scale}{\frac{b\_m}{y-scale}}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if angle < 1.25e-17

    1. Initial program 25.7%

      \[\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. Simplified19.7%

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

      \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
    5. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto -4 \cdot \left({a}^{2} \cdot \color{blue}{\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}}\right) \]
      2. associate-*r*N/A

        \[\leadsto \left(-4 \cdot {a}^{2}\right) \cdot \color{blue}{\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(-4 \cdot {a}^{2}\right), \color{blue}{\left(\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)}\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \left({a}^{2}\right)\right), \left(\frac{\color{blue}{{b}^{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \left(a \cdot a\right)\right), \left(\frac{{b}^{\color{blue}{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{{b}^{\color{blue}{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\color{blue}{{x-scale}^{2}} \cdot {y-scale}^{2}}\right)\right) \]
      8. times-fracN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b}{{x-scale}^{2}} \cdot \color{blue}{\frac{b}{{y-scale}^{2}}}\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\left(\frac{b}{{x-scale}^{2}}\right), \color{blue}{\left(\frac{b}{{y-scale}^{2}}\right)}\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \left({x-scale}^{2}\right)\right), \left(\frac{\color{blue}{b}}{{y-scale}^{2}}\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \left(x-scale \cdot x-scale\right)\right), \left(\frac{b}{{y-scale}^{2}}\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \left(\frac{b}{{y-scale}^{2}}\right)\right)\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \color{blue}{\left({y-scale}^{2}\right)}\right)\right)\right) \]
      14. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \left(y-scale \cdot \color{blue}{y-scale}\right)\right)\right)\right) \]
      15. *-lowering-*.f6454.7%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(y-scale, \color{blue}{y-scale}\right)\right)\right)\right) \]
    6. Simplified54.7%

      \[\leadsto \color{blue}{\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(\frac{b}{x-scale \cdot x-scale} \cdot \frac{b}{y-scale \cdot y-scale}\right)} \]
    7. Step-by-step derivation
      1. frac-timesN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\color{blue}{\left(x-scale \cdot x-scale\right) \cdot \left(y-scale \cdot y-scale\right)}}\right)\right) \]
      2. swap-sqrN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\left(x-scale \cdot y-scale\right) \cdot \color{blue}{\left(x-scale \cdot y-scale\right)}}\right)\right) \]
      3. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{x-scale \cdot \color{blue}{\left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}}\right)\right) \]
      4. associate-/l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(b \cdot \color{blue}{\frac{b}{x-scale \cdot \left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}}\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \color{blue}{\left(\frac{b}{x-scale \cdot \left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}\right)}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \color{blue}{\left(x-scale \cdot \left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)\right)}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \color{blue}{\left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}\right)\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \left(\left(x-scale \cdot y-scale\right) \cdot \color{blue}{y-scale}\right)\right)\right)\right)\right) \]
      9. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \left(x-scale \cdot \color{blue}{\left(y-scale \cdot y-scale\right)}\right)\right)\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \mathsf{*.f64}\left(x-scale, \color{blue}{\left(y-scale \cdot y-scale\right)}\right)\right)\right)\right)\right) \]
      11. *-lowering-*.f6460.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \mathsf{*.f64}\left(x-scale, \mathsf{*.f64}\left(y-scale, \color{blue}{y-scale}\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr60.2%

      \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \color{blue}{\left(b \cdot \frac{b}{x-scale \cdot \left(x-scale \cdot \left(y-scale \cdot y-scale\right)\right)}\right)} \]
    9. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\color{blue}{x-scale \cdot \left(x-scale \cdot \left(y-scale \cdot y-scale\right)\right)}}\right)\right) \]
      2. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{\frac{b \cdot b}{x-scale}}{\color{blue}{x-scale \cdot \left(y-scale \cdot y-scale\right)}}\right)\right) \]
      3. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{\frac{b \cdot b}{x-scale}}{\left(x-scale \cdot y-scale\right) \cdot \color{blue}{y-scale}}\right)\right) \]
      4. associate-/l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{\frac{\frac{b \cdot b}{x-scale}}{y-scale}}{\color{blue}{x-scale \cdot y-scale}}\right)\right) \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{\frac{b \cdot b}{x-scale \cdot y-scale}}{\color{blue}{x-scale} \cdot y-scale}\right)\right) \]
      6. associate-/l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot \frac{b}{x-scale \cdot y-scale}}{\color{blue}{x-scale} \cdot y-scale}\right)\right) \]
      7. times-fracN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b}{x-scale} \cdot \color{blue}{\frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}}\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\left(\frac{b}{x-scale}\right), \color{blue}{\left(\frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}\right)}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), \left(\frac{\color{blue}{\frac{b}{x-scale \cdot y-scale}}}{y-scale}\right)\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), \mathsf{/.f64}\left(\left(\frac{b}{x-scale \cdot y-scale}\right), \color{blue}{y-scale}\right)\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(b, \left(x-scale \cdot y-scale\right)\right), y-scale\right)\right)\right) \]
      12. *-lowering-*.f6472.4%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, y-scale\right)\right), y-scale\right)\right)\right) \]
    10. Applied egg-rr72.4%

      \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \color{blue}{\left(\frac{b}{x-scale} \cdot \frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}\right)} \]
    11. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(\frac{\frac{b}{x-scale \cdot y-scale}}{y-scale} \cdot \color{blue}{\frac{b}{x-scale}}\right) \]
      2. associate-/l/N/A

        \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(\frac{b}{y-scale \cdot \left(x-scale \cdot y-scale\right)} \cdot \frac{\color{blue}{b}}{x-scale}\right) \]
      3. associate-*l/N/A

        \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{b \cdot \frac{b}{x-scale}}{\color{blue}{y-scale \cdot \left(x-scale \cdot y-scale\right)}} \]
      4. associate-*r/N/A

        \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(b \cdot \color{blue}{\frac{\frac{b}{x-scale}}{y-scale \cdot \left(x-scale \cdot y-scale\right)}}\right) \]
      5. associate-/l/N/A

        \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(b \cdot \frac{\frac{\frac{b}{x-scale}}{x-scale \cdot y-scale}}{\color{blue}{y-scale}}\right) \]
      6. associate-*r*N/A

        \[\leadsto \left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot b\right) \cdot \color{blue}{\frac{\frac{\frac{b}{x-scale}}{x-scale \cdot y-scale}}{y-scale}} \]
      7. clear-numN/A

        \[\leadsto \left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot b\right) \cdot \frac{1}{\color{blue}{\frac{y-scale}{\frac{\frac{b}{x-scale}}{x-scale \cdot y-scale}}}} \]
      8. un-div-invN/A

        \[\leadsto \frac{\left(-4 \cdot \left(a \cdot a\right)\right) \cdot b}{\color{blue}{\frac{y-scale}{\frac{\frac{b}{x-scale}}{x-scale \cdot y-scale}}}} \]
      9. associate-/r/N/A

        \[\leadsto \frac{\left(-4 \cdot \left(a \cdot a\right)\right) \cdot b}{y-scale} \cdot \color{blue}{\frac{\frac{b}{x-scale}}{x-scale \cdot y-scale}} \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{\left(-4 \cdot \left(a \cdot a\right)\right) \cdot b}{y-scale}\right), \color{blue}{\left(\frac{\frac{b}{x-scale}}{x-scale \cdot y-scale}\right)}\right) \]
    12. Applied egg-rr81.5%

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

    if 1.25e-17 < angle

    1. Initial program 14.1%

      \[\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. Simplified14.1%

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

      \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
    5. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto -4 \cdot \left({a}^{2} \cdot \color{blue}{\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}}\right) \]
      2. associate-*r*N/A

        \[\leadsto \left(-4 \cdot {a}^{2}\right) \cdot \color{blue}{\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(-4 \cdot {a}^{2}\right), \color{blue}{\left(\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)}\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \left({a}^{2}\right)\right), \left(\frac{\color{blue}{{b}^{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \left(a \cdot a\right)\right), \left(\frac{{b}^{\color{blue}{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{{b}^{\color{blue}{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\color{blue}{{x-scale}^{2}} \cdot {y-scale}^{2}}\right)\right) \]
      8. times-fracN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b}{{x-scale}^{2}} \cdot \color{blue}{\frac{b}{{y-scale}^{2}}}\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\left(\frac{b}{{x-scale}^{2}}\right), \color{blue}{\left(\frac{b}{{y-scale}^{2}}\right)}\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \left({x-scale}^{2}\right)\right), \left(\frac{\color{blue}{b}}{{y-scale}^{2}}\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \left(x-scale \cdot x-scale\right)\right), \left(\frac{b}{{y-scale}^{2}}\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \left(\frac{b}{{y-scale}^{2}}\right)\right)\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \color{blue}{\left({y-scale}^{2}\right)}\right)\right)\right) \]
      14. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \left(y-scale \cdot \color{blue}{y-scale}\right)\right)\right)\right) \]
      15. *-lowering-*.f6453.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(y-scale, \color{blue}{y-scale}\right)\right)\right)\right) \]
    6. Simplified53.0%

      \[\leadsto \color{blue}{\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(\frac{b}{x-scale \cdot x-scale} \cdot \frac{b}{y-scale \cdot y-scale}\right)} \]
    7. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{b}{x-scale \cdot x-scale}\right) \cdot \color{blue}{\frac{b}{y-scale \cdot y-scale}} \]
      2. associate-/r*N/A

        \[\leadsto \left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{b}{x-scale \cdot x-scale}\right) \cdot \frac{\frac{b}{y-scale}}{\color{blue}{y-scale}} \]
      3. associate-*r/N/A

        \[\leadsto \frac{\left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{b}{x-scale \cdot x-scale}\right) \cdot \frac{b}{y-scale}}{\color{blue}{y-scale}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{b}{x-scale \cdot x-scale}\right) \cdot \frac{b}{y-scale}\right), \color{blue}{y-scale}\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{b}{x-scale \cdot x-scale}\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\left(\left(a \cdot a\right) \cdot -4\right) \cdot \frac{b}{x-scale \cdot x-scale}\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
      7. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\left(a \cdot a\right) \cdot \left(-4 \cdot \frac{b}{x-scale \cdot x-scale}\right)\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(a \cdot a\right), \left(-4 \cdot \frac{b}{x-scale \cdot x-scale}\right)\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(a, a\right), \left(-4 \cdot \frac{b}{x-scale \cdot x-scale}\right)\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(-4, \left(\frac{b}{x-scale \cdot x-scale}\right)\right)\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(-4, \mathsf{/.f64}\left(b, \left(x-scale \cdot x-scale\right)\right)\right)\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(-4, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right)\right)\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
      13. /-lowering-/.f6463.3%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(-4, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right)\right)\right), \mathsf{/.f64}\left(b, y-scale\right)\right), y-scale\right) \]
    8. Applied egg-rr63.3%

      \[\leadsto \color{blue}{\frac{\left(\left(a \cdot a\right) \cdot \left(-4 \cdot \frac{b}{x-scale \cdot x-scale}\right)\right) \cdot \frac{b}{y-scale}}{y-scale}} \]
    9. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \left(\left(a \cdot a\right) \cdot \left(-4 \cdot \frac{b}{x-scale \cdot x-scale}\right)\right) \cdot \color{blue}{\frac{\frac{b}{y-scale}}{y-scale}} \]
      2. associate-*r*N/A

        \[\leadsto \left(\left(\left(a \cdot a\right) \cdot -4\right) \cdot \frac{b}{x-scale \cdot x-scale}\right) \cdot \frac{\color{blue}{\frac{b}{y-scale}}}{y-scale} \]
      3. *-commutativeN/A

        \[\leadsto \left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{b}{x-scale \cdot x-scale}\right) \cdot \frac{\frac{\color{blue}{b}}{y-scale}}{y-scale} \]
      4. associate-*l*N/A

        \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \color{blue}{\left(\frac{b}{x-scale \cdot x-scale} \cdot \frac{\frac{b}{y-scale}}{y-scale}\right)} \]
      5. associate-/r*N/A

        \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(\frac{\frac{b}{x-scale}}{x-scale} \cdot \frac{\color{blue}{\frac{b}{y-scale}}}{y-scale}\right) \]
      6. times-fracN/A

        \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{\frac{b}{x-scale} \cdot \frac{b}{y-scale}}{\color{blue}{x-scale \cdot y-scale}} \]
      7. times-fracN/A

        \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{\frac{b \cdot b}{x-scale \cdot y-scale}}{\color{blue}{x-scale} \cdot y-scale} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\frac{b \cdot b}{x-scale \cdot y-scale}}{x-scale \cdot y-scale} \cdot \color{blue}{\left(-4 \cdot \left(a \cdot a\right)\right)} \]
      9. associate-*r*N/A

        \[\leadsto \frac{\frac{b \cdot b}{x-scale \cdot y-scale}}{x-scale \cdot y-scale} \cdot \left(\left(-4 \cdot a\right) \cdot \color{blue}{a}\right) \]
      10. associate-*r*N/A

        \[\leadsto \left(\frac{\frac{b \cdot b}{x-scale \cdot y-scale}}{x-scale \cdot y-scale} \cdot \left(-4 \cdot a\right)\right) \cdot \color{blue}{a} \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{\frac{b \cdot b}{x-scale \cdot y-scale}}{x-scale \cdot y-scale} \cdot \left(-4 \cdot a\right)\right), \color{blue}{a}\right) \]
    10. Applied egg-rr64.8%

      \[\leadsto \color{blue}{\left(\frac{\frac{\frac{b \cdot \frac{b}{y-scale}}{y-scale}}{x-scale}}{x-scale} \cdot \left(a \cdot -4\right)\right) \cdot a} \]
    11. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{\frac{b \cdot \frac{b}{y-scale}}{x-scale \cdot y-scale}}{x-scale}\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
      2. associate-/l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{b \cdot \frac{\frac{b}{y-scale}}{x-scale \cdot y-scale}}{x-scale}\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
      3. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{b \cdot \frac{b}{y-scale \cdot \left(x-scale \cdot y-scale\right)}}{x-scale}\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
      4. associate-/l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{b \cdot \frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}}{x-scale}\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
      5. associate-*l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{b}{x-scale} \cdot \frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{\frac{b}{x-scale \cdot y-scale}}{y-scale} \cdot \frac{b}{x-scale}\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
      7. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{\frac{b}{x-scale \cdot y-scale}}{y-scale} \cdot \frac{1}{\frac{x-scale}{b}}\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
      8. frac-timesN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{\frac{b}{x-scale \cdot y-scale} \cdot 1}{y-scale \cdot \frac{x-scale}{b}}\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
      9. associate-/l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{\frac{b}{x-scale \cdot y-scale} \cdot 1}{\frac{y-scale \cdot x-scale}{b}}\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{\frac{b}{x-scale \cdot y-scale} \cdot 1}{\frac{x-scale \cdot y-scale}{b}}\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
      11. *-rgt-identityN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{\frac{b}{x-scale \cdot y-scale}}{\frac{x-scale \cdot y-scale}{b}}\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
      12. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{b}{x-scale \cdot y-scale}\right), \left(\frac{x-scale \cdot y-scale}{b}\right)\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
      13. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{\frac{b}{x-scale}}{y-scale}\right), \left(\frac{x-scale \cdot y-scale}{b}\right)\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
      14. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\frac{b}{x-scale}\right), y-scale\right), \left(\frac{x-scale \cdot y-scale}{b}\right)\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
      15. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), y-scale\right), \left(\frac{x-scale \cdot y-scale}{b}\right)\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
      16. associate-/l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), y-scale\right), \left(x-scale \cdot \frac{y-scale}{b}\right)\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
      17. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), y-scale\right), \left(x-scale \cdot \frac{1}{\frac{b}{y-scale}}\right)\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
      18. un-div-invN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), y-scale\right), \left(\frac{x-scale}{\frac{b}{y-scale}}\right)\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
      19. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), y-scale\right), \mathsf{/.f64}\left(x-scale, \left(\frac{b}{y-scale}\right)\right)\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
      20. /-lowering-/.f6483.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), y-scale\right), \mathsf{/.f64}\left(x-scale, \mathsf{/.f64}\left(b, y-scale\right)\right)\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
    12. Applied egg-rr83.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;angle \leq 1.25 \cdot 10^{-17}:\\ \;\;\;\;\frac{a \cdot \left(b \cdot \left(-4 \cdot a\right)\right)}{y-scale} \cdot \frac{\frac{\frac{b}{x-scale}}{y-scale}}{x-scale}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(\left(-4 \cdot a\right) \cdot \frac{\frac{\frac{b}{x-scale}}{y-scale}}{\frac{x-scale}{\frac{b}{y-scale}}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 83.2% accurate, 99.6× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ a \cdot \left(\left(-4 \cdot a\right) \cdot \frac{\frac{\frac{b\_m}{x-scale}}{y-scale}}{\frac{x-scale}{\frac{b\_m}{y-scale}}}\right) \end{array} \]
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
 :precision binary64
 (*
  a
  (* (* -4.0 a) (/ (/ (/ b_m x-scale) y-scale) (/ x-scale (/ b_m y-scale))))))
b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
	return a * ((-4.0 * a) * (((b_m / x_45_scale) / y_45_scale) / (x_45_scale / (b_m / y_45_scale))));
}
b_m = abs(b)
real(8) function code(a, b_m, angle, x_45scale, y_45scale)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: angle
    real(8), intent (in) :: x_45scale
    real(8), intent (in) :: y_45scale
    code = a * (((-4.0d0) * a) * (((b_m / x_45scale) / y_45scale) / (x_45scale / (b_m / y_45scale))))
end function
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
	return a * ((-4.0 * a) * (((b_m / x_45_scale) / y_45_scale) / (x_45_scale / (b_m / y_45_scale))));
}
b_m = math.fabs(b)
def code(a, b_m, angle, x_45_scale, y_45_scale):
	return a * ((-4.0 * a) * (((b_m / x_45_scale) / y_45_scale) / (x_45_scale / (b_m / y_45_scale))))
b_m = abs(b)
function code(a, b_m, angle, x_45_scale, y_45_scale)
	return Float64(a * Float64(Float64(-4.0 * a) * Float64(Float64(Float64(b_m / x_45_scale) / y_45_scale) / Float64(x_45_scale / Float64(b_m / y_45_scale)))))
end
b_m = abs(b);
function tmp = code(a, b_m, angle, x_45_scale, y_45_scale)
	tmp = a * ((-4.0 * a) * (((b_m / x_45_scale) / y_45_scale) / (x_45_scale / (b_m / y_45_scale))));
end
b_m = N[Abs[b], $MachinePrecision]
code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := N[(a * N[(N[(-4.0 * a), $MachinePrecision] * N[(N[(N[(b$95$m / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision] / N[(x$45$scale / N[(b$95$m / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|

\\
a \cdot \left(\left(-4 \cdot a\right) \cdot \frac{\frac{\frac{b\_m}{x-scale}}{y-scale}}{\frac{x-scale}{\frac{b\_m}{y-scale}}}\right)
\end{array}
Derivation
  1. Initial program 22.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. Simplified18.3%

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

    \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
  5. Step-by-step derivation
    1. associate-/l*N/A

      \[\leadsto -4 \cdot \left({a}^{2} \cdot \color{blue}{\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}}\right) \]
    2. associate-*r*N/A

      \[\leadsto \left(-4 \cdot {a}^{2}\right) \cdot \color{blue}{\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(-4 \cdot {a}^{2}\right), \color{blue}{\left(\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)}\right) \]
    4. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \left({a}^{2}\right)\right), \left(\frac{\color{blue}{{b}^{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
    5. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \left(a \cdot a\right)\right), \left(\frac{{b}^{\color{blue}{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
    6. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{{b}^{\color{blue}{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
    7. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\color{blue}{{x-scale}^{2}} \cdot {y-scale}^{2}}\right)\right) \]
    8. times-fracN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b}{{x-scale}^{2}} \cdot \color{blue}{\frac{b}{{y-scale}^{2}}}\right)\right) \]
    9. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\left(\frac{b}{{x-scale}^{2}}\right), \color{blue}{\left(\frac{b}{{y-scale}^{2}}\right)}\right)\right) \]
    10. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \left({x-scale}^{2}\right)\right), \left(\frac{\color{blue}{b}}{{y-scale}^{2}}\right)\right)\right) \]
    11. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \left(x-scale \cdot x-scale\right)\right), \left(\frac{b}{{y-scale}^{2}}\right)\right)\right) \]
    12. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \left(\frac{b}{{y-scale}^{2}}\right)\right)\right) \]
    13. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \color{blue}{\left({y-scale}^{2}\right)}\right)\right)\right) \]
    14. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \left(y-scale \cdot \color{blue}{y-scale}\right)\right)\right)\right) \]
    15. *-lowering-*.f6454.2%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(y-scale, \color{blue}{y-scale}\right)\right)\right)\right) \]
  6. Simplified54.2%

    \[\leadsto \color{blue}{\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(\frac{b}{x-scale \cdot x-scale} \cdot \frac{b}{y-scale \cdot y-scale}\right)} \]
  7. Step-by-step derivation
    1. associate-*r*N/A

      \[\leadsto \left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{b}{x-scale \cdot x-scale}\right) \cdot \color{blue}{\frac{b}{y-scale \cdot y-scale}} \]
    2. associate-/r*N/A

      \[\leadsto \left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{b}{x-scale \cdot x-scale}\right) \cdot \frac{\frac{b}{y-scale}}{\color{blue}{y-scale}} \]
    3. associate-*r/N/A

      \[\leadsto \frac{\left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{b}{x-scale \cdot x-scale}\right) \cdot \frac{b}{y-scale}}{\color{blue}{y-scale}} \]
    4. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\left(\left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{b}{x-scale \cdot x-scale}\right) \cdot \frac{b}{y-scale}\right), \color{blue}{y-scale}\right) \]
    5. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{b}{x-scale \cdot x-scale}\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
    6. *-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\left(\left(a \cdot a\right) \cdot -4\right) \cdot \frac{b}{x-scale \cdot x-scale}\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
    7. associate-*l*N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\left(a \cdot a\right) \cdot \left(-4 \cdot \frac{b}{x-scale \cdot x-scale}\right)\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
    8. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(a \cdot a\right), \left(-4 \cdot \frac{b}{x-scale \cdot x-scale}\right)\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
    9. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(a, a\right), \left(-4 \cdot \frac{b}{x-scale \cdot x-scale}\right)\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
    10. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(-4, \left(\frac{b}{x-scale \cdot x-scale}\right)\right)\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
    11. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(-4, \mathsf{/.f64}\left(b, \left(x-scale \cdot x-scale\right)\right)\right)\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
    12. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(-4, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right)\right)\right), \left(\frac{b}{y-scale}\right)\right), y-scale\right) \]
    13. /-lowering-/.f6463.7%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(a, a\right), \mathsf{*.f64}\left(-4, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right)\right)\right), \mathsf{/.f64}\left(b, y-scale\right)\right), y-scale\right) \]
  8. Applied egg-rr63.7%

    \[\leadsto \color{blue}{\frac{\left(\left(a \cdot a\right) \cdot \left(-4 \cdot \frac{b}{x-scale \cdot x-scale}\right)\right) \cdot \frac{b}{y-scale}}{y-scale}} \]
  9. Step-by-step derivation
    1. associate-/l*N/A

      \[\leadsto \left(\left(a \cdot a\right) \cdot \left(-4 \cdot \frac{b}{x-scale \cdot x-scale}\right)\right) \cdot \color{blue}{\frac{\frac{b}{y-scale}}{y-scale}} \]
    2. associate-*r*N/A

      \[\leadsto \left(\left(\left(a \cdot a\right) \cdot -4\right) \cdot \frac{b}{x-scale \cdot x-scale}\right) \cdot \frac{\color{blue}{\frac{b}{y-scale}}}{y-scale} \]
    3. *-commutativeN/A

      \[\leadsto \left(\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{b}{x-scale \cdot x-scale}\right) \cdot \frac{\frac{\color{blue}{b}}{y-scale}}{y-scale} \]
    4. associate-*l*N/A

      \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \color{blue}{\left(\frac{b}{x-scale \cdot x-scale} \cdot \frac{\frac{b}{y-scale}}{y-scale}\right)} \]
    5. associate-/r*N/A

      \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(\frac{\frac{b}{x-scale}}{x-scale} \cdot \frac{\color{blue}{\frac{b}{y-scale}}}{y-scale}\right) \]
    6. times-fracN/A

      \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{\frac{b}{x-scale} \cdot \frac{b}{y-scale}}{\color{blue}{x-scale \cdot y-scale}} \]
    7. times-fracN/A

      \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{\frac{b \cdot b}{x-scale \cdot y-scale}}{\color{blue}{x-scale} \cdot y-scale} \]
    8. *-commutativeN/A

      \[\leadsto \frac{\frac{b \cdot b}{x-scale \cdot y-scale}}{x-scale \cdot y-scale} \cdot \color{blue}{\left(-4 \cdot \left(a \cdot a\right)\right)} \]
    9. associate-*r*N/A

      \[\leadsto \frac{\frac{b \cdot b}{x-scale \cdot y-scale}}{x-scale \cdot y-scale} \cdot \left(\left(-4 \cdot a\right) \cdot \color{blue}{a}\right) \]
    10. associate-*r*N/A

      \[\leadsto \left(\frac{\frac{b \cdot b}{x-scale \cdot y-scale}}{x-scale \cdot y-scale} \cdot \left(-4 \cdot a\right)\right) \cdot \color{blue}{a} \]
    11. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(\frac{\frac{b \cdot b}{x-scale \cdot y-scale}}{x-scale \cdot y-scale} \cdot \left(-4 \cdot a\right)\right), \color{blue}{a}\right) \]
  10. Applied egg-rr69.7%

    \[\leadsto \color{blue}{\left(\frac{\frac{\frac{b \cdot \frac{b}{y-scale}}{y-scale}}{x-scale}}{x-scale} \cdot \left(a \cdot -4\right)\right) \cdot a} \]
  11. Step-by-step derivation
    1. associate-/l/N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{\frac{b \cdot \frac{b}{y-scale}}{x-scale \cdot y-scale}}{x-scale}\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
    2. associate-/l*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{b \cdot \frac{\frac{b}{y-scale}}{x-scale \cdot y-scale}}{x-scale}\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
    3. associate-/r*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{b \cdot \frac{b}{y-scale \cdot \left(x-scale \cdot y-scale\right)}}{x-scale}\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
    4. associate-/l/N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{b \cdot \frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}}{x-scale}\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
    5. associate-*l/N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{b}{x-scale} \cdot \frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
    6. *-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{\frac{b}{x-scale \cdot y-scale}}{y-scale} \cdot \frac{b}{x-scale}\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
    7. clear-numN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{\frac{b}{x-scale \cdot y-scale}}{y-scale} \cdot \frac{1}{\frac{x-scale}{b}}\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
    8. frac-timesN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{\frac{b}{x-scale \cdot y-scale} \cdot 1}{y-scale \cdot \frac{x-scale}{b}}\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
    9. associate-/l*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{\frac{b}{x-scale \cdot y-scale} \cdot 1}{\frac{y-scale \cdot x-scale}{b}}\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
    10. *-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{\frac{b}{x-scale \cdot y-scale} \cdot 1}{\frac{x-scale \cdot y-scale}{b}}\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
    11. *-rgt-identityN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{\frac{b}{x-scale \cdot y-scale}}{\frac{x-scale \cdot y-scale}{b}}\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
    12. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{b}{x-scale \cdot y-scale}\right), \left(\frac{x-scale \cdot y-scale}{b}\right)\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
    13. associate-/r*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{\frac{b}{x-scale}}{y-scale}\right), \left(\frac{x-scale \cdot y-scale}{b}\right)\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
    14. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\frac{b}{x-scale}\right), y-scale\right), \left(\frac{x-scale \cdot y-scale}{b}\right)\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
    15. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), y-scale\right), \left(\frac{x-scale \cdot y-scale}{b}\right)\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
    16. associate-/l*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), y-scale\right), \left(x-scale \cdot \frac{y-scale}{b}\right)\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
    17. clear-numN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), y-scale\right), \left(x-scale \cdot \frac{1}{\frac{b}{y-scale}}\right)\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
    18. un-div-invN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), y-scale\right), \left(\frac{x-scale}{\frac{b}{y-scale}}\right)\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
    19. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), y-scale\right), \mathsf{/.f64}\left(x-scale, \left(\frac{b}{y-scale}\right)\right)\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
    20. /-lowering-/.f6480.7%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), y-scale\right), \mathsf{/.f64}\left(x-scale, \mathsf{/.f64}\left(b, y-scale\right)\right)\right), \mathsf{*.f64}\left(a, -4\right)\right), a\right) \]
  12. Applied egg-rr80.7%

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

    \[\leadsto a \cdot \left(\left(-4 \cdot a\right) \cdot \frac{\frac{\frac{b}{x-scale}}{y-scale}}{\frac{x-scale}{\frac{b}{y-scale}}}\right) \]
  14. Add Preprocessing

Alternative 5: 72.7% accurate, 99.6× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(\frac{b\_m}{x-scale} \cdot \frac{\frac{b\_m}{x-scale \cdot y-scale}}{y-scale}\right) \end{array} \]
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
 :precision binary64
 (*
  (* -4.0 (* a a))
  (* (/ b_m x-scale) (/ (/ b_m (* x-scale y-scale)) y-scale))))
b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
	return (-4.0 * (a * a)) * ((b_m / x_45_scale) * ((b_m / (x_45_scale * y_45_scale)) / y_45_scale));
}
b_m = abs(b)
real(8) function code(a, b_m, angle, x_45scale, y_45scale)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: angle
    real(8), intent (in) :: x_45scale
    real(8), intent (in) :: y_45scale
    code = ((-4.0d0) * (a * a)) * ((b_m / x_45scale) * ((b_m / (x_45scale * y_45scale)) / y_45scale))
end function
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
	return (-4.0 * (a * a)) * ((b_m / x_45_scale) * ((b_m / (x_45_scale * y_45_scale)) / y_45_scale));
}
b_m = math.fabs(b)
def code(a, b_m, angle, x_45_scale, y_45_scale):
	return (-4.0 * (a * a)) * ((b_m / x_45_scale) * ((b_m / (x_45_scale * y_45_scale)) / y_45_scale))
b_m = abs(b)
function code(a, b_m, angle, x_45_scale, y_45_scale)
	return Float64(Float64(-4.0 * Float64(a * a)) * Float64(Float64(b_m / x_45_scale) * Float64(Float64(b_m / Float64(x_45_scale * y_45_scale)) / y_45_scale)))
end
b_m = abs(b);
function tmp = code(a, b_m, angle, x_45_scale, y_45_scale)
	tmp = (-4.0 * (a * a)) * ((b_m / x_45_scale) * ((b_m / (x_45_scale * y_45_scale)) / y_45_scale));
end
b_m = N[Abs[b], $MachinePrecision]
code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := N[(N[(-4.0 * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(N[(b$95$m / x$45$scale), $MachinePrecision] * N[(N[(b$95$m / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|

\\
\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(\frac{b\_m}{x-scale} \cdot \frac{\frac{b\_m}{x-scale \cdot y-scale}}{y-scale}\right)
\end{array}
Derivation
  1. Initial program 22.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. Simplified18.3%

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

    \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
  5. Step-by-step derivation
    1. associate-/l*N/A

      \[\leadsto -4 \cdot \left({a}^{2} \cdot \color{blue}{\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}}\right) \]
    2. associate-*r*N/A

      \[\leadsto \left(-4 \cdot {a}^{2}\right) \cdot \color{blue}{\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(-4 \cdot {a}^{2}\right), \color{blue}{\left(\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)}\right) \]
    4. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \left({a}^{2}\right)\right), \left(\frac{\color{blue}{{b}^{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
    5. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \left(a \cdot a\right)\right), \left(\frac{{b}^{\color{blue}{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
    6. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{{b}^{\color{blue}{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
    7. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\color{blue}{{x-scale}^{2}} \cdot {y-scale}^{2}}\right)\right) \]
    8. times-fracN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b}{{x-scale}^{2}} \cdot \color{blue}{\frac{b}{{y-scale}^{2}}}\right)\right) \]
    9. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\left(\frac{b}{{x-scale}^{2}}\right), \color{blue}{\left(\frac{b}{{y-scale}^{2}}\right)}\right)\right) \]
    10. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \left({x-scale}^{2}\right)\right), \left(\frac{\color{blue}{b}}{{y-scale}^{2}}\right)\right)\right) \]
    11. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \left(x-scale \cdot x-scale\right)\right), \left(\frac{b}{{y-scale}^{2}}\right)\right)\right) \]
    12. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \left(\frac{b}{{y-scale}^{2}}\right)\right)\right) \]
    13. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \color{blue}{\left({y-scale}^{2}\right)}\right)\right)\right) \]
    14. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \left(y-scale \cdot \color{blue}{y-scale}\right)\right)\right)\right) \]
    15. *-lowering-*.f6454.2%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(y-scale, \color{blue}{y-scale}\right)\right)\right)\right) \]
  6. Simplified54.2%

    \[\leadsto \color{blue}{\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(\frac{b}{x-scale \cdot x-scale} \cdot \frac{b}{y-scale \cdot y-scale}\right)} \]
  7. Step-by-step derivation
    1. frac-timesN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\color{blue}{\left(x-scale \cdot x-scale\right) \cdot \left(y-scale \cdot y-scale\right)}}\right)\right) \]
    2. swap-sqrN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\left(x-scale \cdot y-scale\right) \cdot \color{blue}{\left(x-scale \cdot y-scale\right)}}\right)\right) \]
    3. associate-*r*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{x-scale \cdot \color{blue}{\left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}}\right)\right) \]
    4. associate-/l*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(b \cdot \color{blue}{\frac{b}{x-scale \cdot \left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}}\right)\right) \]
    5. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \color{blue}{\left(\frac{b}{x-scale \cdot \left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}\right)}\right)\right) \]
    6. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \color{blue}{\left(x-scale \cdot \left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)\right)}\right)\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \color{blue}{\left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}\right)\right)\right)\right) \]
    8. *-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \left(\left(x-scale \cdot y-scale\right) \cdot \color{blue}{y-scale}\right)\right)\right)\right)\right) \]
    9. associate-*l*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \left(x-scale \cdot \color{blue}{\left(y-scale \cdot y-scale\right)}\right)\right)\right)\right)\right) \]
    10. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \mathsf{*.f64}\left(x-scale, \color{blue}{\left(y-scale \cdot y-scale\right)}\right)\right)\right)\right)\right) \]
    11. *-lowering-*.f6458.1%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \mathsf{*.f64}\left(x-scale, \mathsf{*.f64}\left(y-scale, \color{blue}{y-scale}\right)\right)\right)\right)\right)\right) \]
  8. Applied egg-rr58.1%

    \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \color{blue}{\left(b \cdot \frac{b}{x-scale \cdot \left(x-scale \cdot \left(y-scale \cdot y-scale\right)\right)}\right)} \]
  9. Step-by-step derivation
    1. associate-*r/N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\color{blue}{x-scale \cdot \left(x-scale \cdot \left(y-scale \cdot y-scale\right)\right)}}\right)\right) \]
    2. associate-/r*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{\frac{b \cdot b}{x-scale}}{\color{blue}{x-scale \cdot \left(y-scale \cdot y-scale\right)}}\right)\right) \]
    3. associate-*r*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{\frac{b \cdot b}{x-scale}}{\left(x-scale \cdot y-scale\right) \cdot \color{blue}{y-scale}}\right)\right) \]
    4. associate-/l/N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{\frac{\frac{b \cdot b}{x-scale}}{y-scale}}{\color{blue}{x-scale \cdot y-scale}}\right)\right) \]
    5. associate-/r*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{\frac{b \cdot b}{x-scale \cdot y-scale}}{\color{blue}{x-scale} \cdot y-scale}\right)\right) \]
    6. associate-/l*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot \frac{b}{x-scale \cdot y-scale}}{\color{blue}{x-scale} \cdot y-scale}\right)\right) \]
    7. times-fracN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b}{x-scale} \cdot \color{blue}{\frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}}\right)\right) \]
    8. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\left(\frac{b}{x-scale}\right), \color{blue}{\left(\frac{\frac{b}{x-scale \cdot y-scale}}{y-scale}\right)}\right)\right) \]
    9. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), \left(\frac{\color{blue}{\frac{b}{x-scale \cdot y-scale}}}{y-scale}\right)\right)\right) \]
    10. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), \mathsf{/.f64}\left(\left(\frac{b}{x-scale \cdot y-scale}\right), \color{blue}{y-scale}\right)\right)\right) \]
    11. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(b, \left(x-scale \cdot y-scale\right)\right), y-scale\right)\right)\right) \]
    12. *-lowering-*.f6472.2%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, y-scale\right)\right), y-scale\right)\right)\right) \]
  10. Applied egg-rr72.2%

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

Alternative 6: 71.8% accurate, 99.6× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(b\_m \cdot \frac{\frac{\frac{b\_m}{x-scale}}{x-scale \cdot y-scale}}{y-scale}\right) \end{array} \]
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
 :precision binary64
 (*
  (* -4.0 (* a a))
  (* b_m (/ (/ (/ b_m x-scale) (* x-scale y-scale)) y-scale))))
b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
	return (-4.0 * (a * a)) * (b_m * (((b_m / x_45_scale) / (x_45_scale * y_45_scale)) / y_45_scale));
}
b_m = abs(b)
real(8) function code(a, b_m, angle, x_45scale, y_45scale)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: angle
    real(8), intent (in) :: x_45scale
    real(8), intent (in) :: y_45scale
    code = ((-4.0d0) * (a * a)) * (b_m * (((b_m / x_45scale) / (x_45scale * y_45scale)) / y_45scale))
end function
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
	return (-4.0 * (a * a)) * (b_m * (((b_m / x_45_scale) / (x_45_scale * y_45_scale)) / y_45_scale));
}
b_m = math.fabs(b)
def code(a, b_m, angle, x_45_scale, y_45_scale):
	return (-4.0 * (a * a)) * (b_m * (((b_m / x_45_scale) / (x_45_scale * y_45_scale)) / y_45_scale))
b_m = abs(b)
function code(a, b_m, angle, x_45_scale, y_45_scale)
	return Float64(Float64(-4.0 * Float64(a * a)) * Float64(b_m * Float64(Float64(Float64(b_m / x_45_scale) / Float64(x_45_scale * y_45_scale)) / y_45_scale)))
end
b_m = abs(b);
function tmp = code(a, b_m, angle, x_45_scale, y_45_scale)
	tmp = (-4.0 * (a * a)) * (b_m * (((b_m / x_45_scale) / (x_45_scale * y_45_scale)) / y_45_scale));
end
b_m = N[Abs[b], $MachinePrecision]
code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := N[(N[(-4.0 * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(b$95$m * N[(N[(N[(b$95$m / x$45$scale), $MachinePrecision] / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|

\\
\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(b\_m \cdot \frac{\frac{\frac{b\_m}{x-scale}}{x-scale \cdot y-scale}}{y-scale}\right)
\end{array}
Derivation
  1. Initial program 22.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. Simplified18.3%

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

    \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
  5. Step-by-step derivation
    1. associate-/l*N/A

      \[\leadsto -4 \cdot \left({a}^{2} \cdot \color{blue}{\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}}\right) \]
    2. associate-*r*N/A

      \[\leadsto \left(-4 \cdot {a}^{2}\right) \cdot \color{blue}{\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(-4 \cdot {a}^{2}\right), \color{blue}{\left(\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)}\right) \]
    4. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \left({a}^{2}\right)\right), \left(\frac{\color{blue}{{b}^{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
    5. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \left(a \cdot a\right)\right), \left(\frac{{b}^{\color{blue}{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
    6. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{{b}^{\color{blue}{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
    7. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\color{blue}{{x-scale}^{2}} \cdot {y-scale}^{2}}\right)\right) \]
    8. times-fracN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b}{{x-scale}^{2}} \cdot \color{blue}{\frac{b}{{y-scale}^{2}}}\right)\right) \]
    9. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\left(\frac{b}{{x-scale}^{2}}\right), \color{blue}{\left(\frac{b}{{y-scale}^{2}}\right)}\right)\right) \]
    10. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \left({x-scale}^{2}\right)\right), \left(\frac{\color{blue}{b}}{{y-scale}^{2}}\right)\right)\right) \]
    11. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \left(x-scale \cdot x-scale\right)\right), \left(\frac{b}{{y-scale}^{2}}\right)\right)\right) \]
    12. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \left(\frac{b}{{y-scale}^{2}}\right)\right)\right) \]
    13. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \color{blue}{\left({y-scale}^{2}\right)}\right)\right)\right) \]
    14. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \left(y-scale \cdot \color{blue}{y-scale}\right)\right)\right)\right) \]
    15. *-lowering-*.f6454.2%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(y-scale, \color{blue}{y-scale}\right)\right)\right)\right) \]
  6. Simplified54.2%

    \[\leadsto \color{blue}{\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(\frac{b}{x-scale \cdot x-scale} \cdot \frac{b}{y-scale \cdot y-scale}\right)} \]
  7. Step-by-step derivation
    1. frac-timesN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\color{blue}{\left(x-scale \cdot x-scale\right) \cdot \left(y-scale \cdot y-scale\right)}}\right)\right) \]
    2. swap-sqrN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\left(x-scale \cdot y-scale\right) \cdot \color{blue}{\left(x-scale \cdot y-scale\right)}}\right)\right) \]
    3. associate-*r*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{x-scale \cdot \color{blue}{\left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}}\right)\right) \]
    4. associate-/l*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(b \cdot \color{blue}{\frac{b}{x-scale \cdot \left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}}\right)\right) \]
    5. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \color{blue}{\left(\frac{b}{x-scale \cdot \left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}\right)}\right)\right) \]
    6. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \color{blue}{\left(x-scale \cdot \left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)\right)}\right)\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \color{blue}{\left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}\right)\right)\right)\right) \]
    8. *-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \left(\left(x-scale \cdot y-scale\right) \cdot \color{blue}{y-scale}\right)\right)\right)\right)\right) \]
    9. associate-*l*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \left(x-scale \cdot \color{blue}{\left(y-scale \cdot y-scale\right)}\right)\right)\right)\right)\right) \]
    10. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \mathsf{*.f64}\left(x-scale, \color{blue}{\left(y-scale \cdot y-scale\right)}\right)\right)\right)\right)\right) \]
    11. *-lowering-*.f6458.1%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \mathsf{*.f64}\left(x-scale, \mathsf{*.f64}\left(y-scale, \color{blue}{y-scale}\right)\right)\right)\right)\right)\right) \]
  8. Applied egg-rr58.1%

    \[\leadsto \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \color{blue}{\left(b \cdot \frac{b}{x-scale \cdot \left(x-scale \cdot \left(y-scale \cdot y-scale\right)\right)}\right)} \]
  9. Step-by-step derivation
    1. associate-/r*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \left(\frac{\frac{b}{x-scale}}{\color{blue}{x-scale \cdot \left(y-scale \cdot y-scale\right)}}\right)\right)\right) \]
    2. associate-*r*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \left(\frac{\frac{b}{x-scale}}{\left(x-scale \cdot y-scale\right) \cdot \color{blue}{y-scale}}\right)\right)\right) \]
    3. associate-/r*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \left(\frac{\frac{\frac{b}{x-scale}}{x-scale \cdot y-scale}}{\color{blue}{y-scale}}\right)\right)\right) \]
    4. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(\left(\frac{\frac{b}{x-scale}}{x-scale \cdot y-scale}\right), \color{blue}{y-scale}\right)\right)\right) \]
    5. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\frac{b}{x-scale}\right), \left(x-scale \cdot y-scale\right)\right), y-scale\right)\right)\right) \]
    6. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), \left(x-scale \cdot y-scale\right)\right), y-scale\right)\right)\right) \]
    7. *-lowering-*.f6471.1%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(b, x-scale\right), \mathsf{*.f64}\left(x-scale, y-scale\right)\right), y-scale\right)\right)\right) \]
  10. Applied egg-rr71.1%

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

Alternative 7: 60.6% accurate, 99.6× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ \left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(b\_m \cdot \frac{b\_m}{x-scale \cdot \left(x-scale \cdot \left(y-scale \cdot y-scale\right)\right)}\right) \end{array} \]
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
 :precision binary64
 (*
  (* -4.0 (* a a))
  (* b_m (/ b_m (* x-scale (* x-scale (* y-scale y-scale)))))))
b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
	return (-4.0 * (a * a)) * (b_m * (b_m / (x_45_scale * (x_45_scale * (y_45_scale * y_45_scale)))));
}
b_m = abs(b)
real(8) function code(a, b_m, angle, x_45scale, y_45scale)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: angle
    real(8), intent (in) :: x_45scale
    real(8), intent (in) :: y_45scale
    code = ((-4.0d0) * (a * a)) * (b_m * (b_m / (x_45scale * (x_45scale * (y_45scale * y_45scale)))))
end function
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
	return (-4.0 * (a * a)) * (b_m * (b_m / (x_45_scale * (x_45_scale * (y_45_scale * y_45_scale)))));
}
b_m = math.fabs(b)
def code(a, b_m, angle, x_45_scale, y_45_scale):
	return (-4.0 * (a * a)) * (b_m * (b_m / (x_45_scale * (x_45_scale * (y_45_scale * y_45_scale)))))
b_m = abs(b)
function code(a, b_m, angle, x_45_scale, y_45_scale)
	return Float64(Float64(-4.0 * Float64(a * a)) * Float64(b_m * Float64(b_m / Float64(x_45_scale * Float64(x_45_scale * Float64(y_45_scale * y_45_scale))))))
end
b_m = abs(b);
function tmp = code(a, b_m, angle, x_45_scale, y_45_scale)
	tmp = (-4.0 * (a * a)) * (b_m * (b_m / (x_45_scale * (x_45_scale * (y_45_scale * y_45_scale)))));
end
b_m = N[Abs[b], $MachinePrecision]
code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := N[(N[(-4.0 * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(b$95$m * N[(b$95$m / N[(x$45$scale * N[(x$45$scale * N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|

\\
\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(b\_m \cdot \frac{b\_m}{x-scale \cdot \left(x-scale \cdot \left(y-scale \cdot y-scale\right)\right)}\right)
\end{array}
Derivation
  1. Initial program 22.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. Simplified18.3%

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

    \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
  5. Step-by-step derivation
    1. associate-/l*N/A

      \[\leadsto -4 \cdot \left({a}^{2} \cdot \color{blue}{\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}}\right) \]
    2. associate-*r*N/A

      \[\leadsto \left(-4 \cdot {a}^{2}\right) \cdot \color{blue}{\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(-4 \cdot {a}^{2}\right), \color{blue}{\left(\frac{{b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)}\right) \]
    4. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \left({a}^{2}\right)\right), \left(\frac{\color{blue}{{b}^{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
    5. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \left(a \cdot a\right)\right), \left(\frac{{b}^{\color{blue}{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
    6. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{{b}^{\color{blue}{2}}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\right) \]
    7. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\color{blue}{{x-scale}^{2}} \cdot {y-scale}^{2}}\right)\right) \]
    8. times-fracN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b}{{x-scale}^{2}} \cdot \color{blue}{\frac{b}{{y-scale}^{2}}}\right)\right) \]
    9. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\left(\frac{b}{{x-scale}^{2}}\right), \color{blue}{\left(\frac{b}{{y-scale}^{2}}\right)}\right)\right) \]
    10. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \left({x-scale}^{2}\right)\right), \left(\frac{\color{blue}{b}}{{y-scale}^{2}}\right)\right)\right) \]
    11. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \left(x-scale \cdot x-scale\right)\right), \left(\frac{b}{{y-scale}^{2}}\right)\right)\right) \]
    12. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \left(\frac{b}{{y-scale}^{2}}\right)\right)\right) \]
    13. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \color{blue}{\left({y-scale}^{2}\right)}\right)\right)\right) \]
    14. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \left(y-scale \cdot \color{blue}{y-scale}\right)\right)\right)\right) \]
    15. *-lowering-*.f6454.2%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, x-scale\right)\right), \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(y-scale, \color{blue}{y-scale}\right)\right)\right)\right) \]
  6. Simplified54.2%

    \[\leadsto \color{blue}{\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(\frac{b}{x-scale \cdot x-scale} \cdot \frac{b}{y-scale \cdot y-scale}\right)} \]
  7. Step-by-step derivation
    1. frac-timesN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\color{blue}{\left(x-scale \cdot x-scale\right) \cdot \left(y-scale \cdot y-scale\right)}}\right)\right) \]
    2. swap-sqrN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{\left(x-scale \cdot y-scale\right) \cdot \color{blue}{\left(x-scale \cdot y-scale\right)}}\right)\right) \]
    3. associate-*r*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(\frac{b \cdot b}{x-scale \cdot \color{blue}{\left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}}\right)\right) \]
    4. associate-/l*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \left(b \cdot \color{blue}{\frac{b}{x-scale \cdot \left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}}\right)\right) \]
    5. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \color{blue}{\left(\frac{b}{x-scale \cdot \left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}\right)}\right)\right) \]
    6. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \color{blue}{\left(x-scale \cdot \left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)\right)}\right)\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \color{blue}{\left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}\right)\right)\right)\right) \]
    8. *-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \left(\left(x-scale \cdot y-scale\right) \cdot \color{blue}{y-scale}\right)\right)\right)\right)\right) \]
    9. associate-*l*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \left(x-scale \cdot \color{blue}{\left(y-scale \cdot y-scale\right)}\right)\right)\right)\right)\right) \]
    10. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \mathsf{*.f64}\left(x-scale, \color{blue}{\left(y-scale \cdot y-scale\right)}\right)\right)\right)\right)\right) \]
    11. *-lowering-*.f6458.1%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(a, a\right)\right), \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(b, \mathsf{*.f64}\left(x-scale, \mathsf{*.f64}\left(x-scale, \mathsf{*.f64}\left(y-scale, \color{blue}{y-scale}\right)\right)\right)\right)\right)\right) \]
  8. Applied egg-rr58.1%

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

Reproduce

?
herbie shell --seed 2024191 
(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))))