Simplification of discriminant from scale-rotated-ellipse

Percentage Accurate: 24.0% → 84.7%
Time: 29.2s
Alternatives: 5
Speedup: 1693.0×

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 5 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: 24.0% 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: 84.7% accurate, 62.6× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ \begin{array}{l} t_0 := \frac{\frac{-4}{y-scale}}{x-scale} \cdot \frac{b\_m \cdot \left(a \cdot \left(b\_m \cdot a\right)\right)}{y-scale \cdot x-scale}\\ \mathbf{if}\;b\_m \leq 3.7 \cdot 10^{-195}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;b\_m \leq 4.8 \cdot 10^{+229}:\\ \;\;\;\;\frac{\frac{b\_m}{\frac{y-scale}{-4}}}{\frac{x-scale}{b\_m}} \cdot \frac{a}{\frac{y-scale}{\frac{a}{x-scale}}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \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 y-scale) x-scale)
          (/ (* b_m (* a (* b_m a))) (* y-scale x-scale)))))
   (if (<= b_m 3.7e-195)
     t_0
     (if (<= b_m 4.8e+229)
       (*
        (/ (/ b_m (/ y-scale -4.0)) (/ x-scale b_m))
        (/ a (/ y-scale (/ a x-scale))))
       t_0))))
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 / y_45_scale) / x_45_scale) * ((b_m * (a * (b_m * a))) / (y_45_scale * x_45_scale));
	double tmp;
	if (b_m <= 3.7e-195) {
		tmp = t_0;
	} else if (b_m <= 4.8e+229) {
		tmp = ((b_m / (y_45_scale / -4.0)) / (x_45_scale / b_m)) * (a / (y_45_scale / (a / x_45_scale)));
	} else {
		tmp = t_0;
	}
	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) / y_45scale) / x_45scale) * ((b_m * (a * (b_m * a))) / (y_45scale * x_45scale))
    if (b_m <= 3.7d-195) then
        tmp = t_0
    else if (b_m <= 4.8d+229) then
        tmp = ((b_m / (y_45scale / (-4.0d0))) / (x_45scale / b_m)) * (a / (y_45scale / (a / x_45scale)))
    else
        tmp = t_0
    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 / y_45_scale) / x_45_scale) * ((b_m * (a * (b_m * a))) / (y_45_scale * x_45_scale));
	double tmp;
	if (b_m <= 3.7e-195) {
		tmp = t_0;
	} else if (b_m <= 4.8e+229) {
		tmp = ((b_m / (y_45_scale / -4.0)) / (x_45_scale / b_m)) * (a / (y_45_scale / (a / x_45_scale)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
b_m = math.fabs(b)
def code(a, b_m, angle, x_45_scale, y_45_scale):
	t_0 = ((-4.0 / y_45_scale) / x_45_scale) * ((b_m * (a * (b_m * a))) / (y_45_scale * x_45_scale))
	tmp = 0
	if b_m <= 3.7e-195:
		tmp = t_0
	elif b_m <= 4.8e+229:
		tmp = ((b_m / (y_45_scale / -4.0)) / (x_45_scale / b_m)) * (a / (y_45_scale / (a / x_45_scale)))
	else:
		tmp = t_0
	return tmp
b_m = abs(b)
function code(a, b_m, angle, x_45_scale, y_45_scale)
	t_0 = Float64(Float64(Float64(-4.0 / y_45_scale) / x_45_scale) * Float64(Float64(b_m * Float64(a * Float64(b_m * a))) / Float64(y_45_scale * x_45_scale)))
	tmp = 0.0
	if (b_m <= 3.7e-195)
		tmp = t_0;
	elseif (b_m <= 4.8e+229)
		tmp = Float64(Float64(Float64(b_m / Float64(y_45_scale / -4.0)) / Float64(x_45_scale / b_m)) * Float64(a / Float64(y_45_scale / Float64(a / x_45_scale))));
	else
		tmp = t_0;
	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 / y_45_scale) / x_45_scale) * ((b_m * (a * (b_m * a))) / (y_45_scale * x_45_scale));
	tmp = 0.0;
	if (b_m <= 3.7e-195)
		tmp = t_0;
	elseif (b_m <= 4.8e+229)
		tmp = ((b_m / (y_45_scale / -4.0)) / (x_45_scale / b_m)) * (a / (y_45_scale / (a / x_45_scale)));
	else
		tmp = t_0;
	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[(N[(-4.0 / y$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision] * N[(N[(b$95$m * N[(a * N[(b$95$m * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b$95$m, 3.7e-195], t$95$0, If[LessEqual[b$95$m, 4.8e+229], N[(N[(N[(b$95$m / N[(y$45$scale / -4.0), $MachinePrecision]), $MachinePrecision] / N[(x$45$scale / b$95$m), $MachinePrecision]), $MachinePrecision] * N[(a / N[(y$45$scale / N[(a / x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
b_m = \left|b\right|

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

\mathbf{elif}\;b\_m \leq 4.8 \cdot 10^{+229}:\\
\;\;\;\;\frac{\frac{b\_m}{\frac{y-scale}{-4}}}{\frac{x-scale}{b\_m}} \cdot \frac{a}{\frac{y-scale}{\frac{a}{x-scale}}}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 3.69999999999999962e-195 or 4.8000000000000002e229 < b

    1. Initial program 24.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. Simplified24.5%

      \[\leadsto \color{blue}{\left(\cos \left(angle \cdot \frac{\pi}{180}\right) \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right) \cdot \left(4 \cdot \left(\left(\sin \left(angle \cdot \frac{\pi}{180}\right) \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right) \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) + \frac{\left(\left({\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}\right) \cdot \frac{-4}{x-scale}\right) \cdot \frac{{\left(a \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}}{x-scale}}{y-scale \cdot y-scale}} \]
    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-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{-4}{y-scale}}{\frac{\frac{x-scale}{a}}{a} \cdot y-scale} \cdot \color{blue}{\frac{b \cdot b}{x-scale}} \]
      4. div-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.69999999999999962e-195 < b < 4.8000000000000002e229

    1. Initial program 31.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. Simplified25.9%

      \[\leadsto \color{blue}{\left(\cos \left(angle \cdot \frac{\pi}{180}\right) \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right) \cdot \left(4 \cdot \left(\left(\sin \left(angle \cdot \frac{\pi}{180}\right) \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right) \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) + \frac{\left(\left({\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}\right) \cdot \frac{-4}{x-scale}\right) \cdot \frac{{\left(a \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}}{x-scale}}{y-scale \cdot y-scale}} \]
    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-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 84.4% accurate, 76.9× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ \begin{array}{l} \mathbf{if}\;b\_m \leq 10^{-196}:\\ \;\;\;\;\frac{\frac{-4}{y-scale}}{x-scale} \cdot \frac{b\_m \cdot \left(a \cdot \left(b\_m \cdot a\right)\right)}{y-scale \cdot x-scale}\\ \mathbf{else}:\\ \;\;\;\;\frac{b\_m \cdot \frac{-4}{\frac{\frac{y-scale}{\frac{a}{x-scale}}}{a}}}{y-scale} \cdot \frac{b\_m}{x-scale}\\ \end{array} \end{array} \]
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
 :precision binary64
 (if (<= b_m 1e-196)
   (*
    (/ (/ -4.0 y-scale) x-scale)
    (/ (* b_m (* a (* b_m a))) (* y-scale x-scale)))
   (*
    (/ (* b_m (/ -4.0 (/ (/ y-scale (/ a x-scale)) a))) y-scale)
    (/ b_m x-scale))))
b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
	double tmp;
	if (b_m <= 1e-196) {
		tmp = ((-4.0 / y_45_scale) / x_45_scale) * ((b_m * (a * (b_m * a))) / (y_45_scale * x_45_scale));
	} else {
		tmp = ((b_m * (-4.0 / ((y_45_scale / (a / x_45_scale)) / a))) / y_45_scale) * (b_m / 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) :: tmp
    if (b_m <= 1d-196) then
        tmp = (((-4.0d0) / y_45scale) / x_45scale) * ((b_m * (a * (b_m * a))) / (y_45scale * x_45scale))
    else
        tmp = ((b_m * ((-4.0d0) / ((y_45scale / (a / x_45scale)) / a))) / y_45scale) * (b_m / 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 tmp;
	if (b_m <= 1e-196) {
		tmp = ((-4.0 / y_45_scale) / x_45_scale) * ((b_m * (a * (b_m * a))) / (y_45_scale * x_45_scale));
	} else {
		tmp = ((b_m * (-4.0 / ((y_45_scale / (a / x_45_scale)) / a))) / y_45_scale) * (b_m / x_45_scale);
	}
	return tmp;
}
b_m = math.fabs(b)
def code(a, b_m, angle, x_45_scale, y_45_scale):
	tmp = 0
	if b_m <= 1e-196:
		tmp = ((-4.0 / y_45_scale) / x_45_scale) * ((b_m * (a * (b_m * a))) / (y_45_scale * x_45_scale))
	else:
		tmp = ((b_m * (-4.0 / ((y_45_scale / (a / x_45_scale)) / a))) / y_45_scale) * (b_m / x_45_scale)
	return tmp
b_m = abs(b)
function code(a, b_m, angle, x_45_scale, y_45_scale)
	tmp = 0.0
	if (b_m <= 1e-196)
		tmp = Float64(Float64(Float64(-4.0 / y_45_scale) / x_45_scale) * Float64(Float64(b_m * Float64(a * Float64(b_m * a))) / Float64(y_45_scale * x_45_scale)));
	else
		tmp = Float64(Float64(Float64(b_m * Float64(-4.0 / Float64(Float64(y_45_scale / Float64(a / x_45_scale)) / a))) / y_45_scale) * Float64(b_m / 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)
	tmp = 0.0;
	if (b_m <= 1e-196)
		tmp = ((-4.0 / y_45_scale) / x_45_scale) * ((b_m * (a * (b_m * a))) / (y_45_scale * x_45_scale));
	else
		tmp = ((b_m * (-4.0 / ((y_45_scale / (a / x_45_scale)) / a))) / y_45_scale) * (b_m / 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_] := If[LessEqual[b$95$m, 1e-196], N[(N[(N[(-4.0 / y$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision] * N[(N[(b$95$m * N[(a * N[(b$95$m * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(b$95$m * N[(-4.0 / N[(N[(y$45$scale / N[(a / x$45$scale), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] * N[(b$95$m / x$45$scale), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
b_m = \left|b\right|

\\
\begin{array}{l}
\mathbf{if}\;b\_m \leq 10^{-196}:\\
\;\;\;\;\frac{\frac{-4}{y-scale}}{x-scale} \cdot \frac{b\_m \cdot \left(a \cdot \left(b\_m \cdot a\right)\right)}{y-scale \cdot x-scale}\\

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


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

    1. Initial program 27.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. Simplified27.7%

      \[\leadsto \color{blue}{\left(\cos \left(angle \cdot \frac{\pi}{180}\right) \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right) \cdot \left(4 \cdot \left(\left(\sin \left(angle \cdot \frac{\pi}{180}\right) \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right) \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) + \frac{\left(\left({\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}\right) \cdot \frac{-4}{x-scale}\right) \cdot \frac{{\left(a \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}}{x-scale}}{y-scale \cdot y-scale}} \]
    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-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{-4}{y-scale}}{\frac{\frac{x-scale}{a}}{a} \cdot y-scale} \cdot \color{blue}{\frac{b \cdot b}{x-scale}} \]
      4. div-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1e-196 < b

    1. Initial program 26.2%

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

      \[\leadsto \color{blue}{\left(\cos \left(angle \cdot \frac{\pi}{180}\right) \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right) \cdot \left(4 \cdot \left(\left(\sin \left(angle \cdot \frac{\pi}{180}\right) \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right) \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) + \frac{\left(\left({\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}\right) \cdot \frac{-4}{x-scale}\right) \cdot \frac{{\left(a \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}}{x-scale}}{y-scale \cdot y-scale}} \]
    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-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 83.2% accurate, 76.9× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ \begin{array}{l} \mathbf{if}\;a \leq 8.5 \cdot 10^{-160}:\\ \;\;\;\;\frac{b\_m}{x-scale} \cdot \left(b\_m \cdot \left(a \cdot \left(\frac{-4}{y-scale} \cdot \frac{a}{y-scale \cdot x-scale}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{b\_m \cdot \frac{-4}{\frac{\frac{y-scale}{\frac{a}{x-scale}}}{a}}}{y-scale} \cdot \frac{b\_m}{x-scale}\\ \end{array} \end{array} \]
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
 :precision binary64
 (if (<= a 8.5e-160)
   (*
    (/ b_m x-scale)
    (* b_m (* a (* (/ -4.0 y-scale) (/ a (* y-scale x-scale))))))
   (*
    (/ (* b_m (/ -4.0 (/ (/ y-scale (/ a x-scale)) a))) y-scale)
    (/ b_m x-scale))))
b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
	double tmp;
	if (a <= 8.5e-160) {
		tmp = (b_m / x_45_scale) * (b_m * (a * ((-4.0 / y_45_scale) * (a / (y_45_scale * x_45_scale)))));
	} else {
		tmp = ((b_m * (-4.0 / ((y_45_scale / (a / x_45_scale)) / a))) / y_45_scale) * (b_m / 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) :: tmp
    if (a <= 8.5d-160) then
        tmp = (b_m / x_45scale) * (b_m * (a * (((-4.0d0) / y_45scale) * (a / (y_45scale * x_45scale)))))
    else
        tmp = ((b_m * ((-4.0d0) / ((y_45scale / (a / x_45scale)) / a))) / y_45scale) * (b_m / 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 tmp;
	if (a <= 8.5e-160) {
		tmp = (b_m / x_45_scale) * (b_m * (a * ((-4.0 / y_45_scale) * (a / (y_45_scale * x_45_scale)))));
	} else {
		tmp = ((b_m * (-4.0 / ((y_45_scale / (a / x_45_scale)) / a))) / y_45_scale) * (b_m / x_45_scale);
	}
	return tmp;
}
b_m = math.fabs(b)
def code(a, b_m, angle, x_45_scale, y_45_scale):
	tmp = 0
	if a <= 8.5e-160:
		tmp = (b_m / x_45_scale) * (b_m * (a * ((-4.0 / y_45_scale) * (a / (y_45_scale * x_45_scale)))))
	else:
		tmp = ((b_m * (-4.0 / ((y_45_scale / (a / x_45_scale)) / a))) / y_45_scale) * (b_m / x_45_scale)
	return tmp
b_m = abs(b)
function code(a, b_m, angle, x_45_scale, y_45_scale)
	tmp = 0.0
	if (a <= 8.5e-160)
		tmp = Float64(Float64(b_m / x_45_scale) * Float64(b_m * Float64(a * Float64(Float64(-4.0 / y_45_scale) * Float64(a / Float64(y_45_scale * x_45_scale))))));
	else
		tmp = Float64(Float64(Float64(b_m * Float64(-4.0 / Float64(Float64(y_45_scale / Float64(a / x_45_scale)) / a))) / y_45_scale) * Float64(b_m / 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)
	tmp = 0.0;
	if (a <= 8.5e-160)
		tmp = (b_m / x_45_scale) * (b_m * (a * ((-4.0 / y_45_scale) * (a / (y_45_scale * x_45_scale)))));
	else
		tmp = ((b_m * (-4.0 / ((y_45_scale / (a / x_45_scale)) / a))) / y_45_scale) * (b_m / 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_] := If[LessEqual[a, 8.5e-160], N[(N[(b$95$m / x$45$scale), $MachinePrecision] * N[(b$95$m * N[(a * N[(N[(-4.0 / y$45$scale), $MachinePrecision] * N[(a / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(b$95$m * N[(-4.0 / N[(N[(y$45$scale / N[(a / x$45$scale), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] * N[(b$95$m / x$45$scale), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
b_m = \left|b\right|

\\
\begin{array}{l}
\mathbf{if}\;a \leq 8.5 \cdot 10^{-160}:\\
\;\;\;\;\frac{b\_m}{x-scale} \cdot \left(b\_m \cdot \left(a \cdot \left(\frac{-4}{y-scale} \cdot \frac{a}{y-scale \cdot x-scale}\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 8.49999999999999959e-160

    1. Initial program 33.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. Simplified29.4%

      \[\leadsto \color{blue}{\left(\cos \left(angle \cdot \frac{\pi}{180}\right) \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right) \cdot \left(4 \cdot \left(\left(\sin \left(angle \cdot \frac{\pi}{180}\right) \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right) \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) + \frac{\left(\left({\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}\right) \cdot \frac{-4}{x-scale}\right) \cdot \frac{{\left(a \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}}{x-scale}}{y-scale \cdot y-scale}} \]
    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-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.49999999999999959e-160 < a

    1. Initial program 16.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. Simplified17.9%

      \[\leadsto \color{blue}{\left(\cos \left(angle \cdot \frac{\pi}{180}\right) \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right) \cdot \left(4 \cdot \left(\left(\sin \left(angle \cdot \frac{\pi}{180}\right) \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right) \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) + \frac{\left(\left({\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}\right) \cdot \frac{-4}{x-scale}\right) \cdot \frac{{\left(a \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}}{x-scale}}{y-scale \cdot y-scale}} \]
    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-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 82.0% accurate, 99.6× speedup?

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

\\
\frac{b\_m}{x-scale} \cdot \left(b\_m \cdot \left(a \cdot \left(\frac{-4}{y-scale} \cdot \frac{a}{y-scale \cdot x-scale}\right)\right)\right)
\end{array}
Derivation
  1. Initial program 27.2%

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

    \[\leadsto \color{blue}{\left(\cos \left(angle \cdot \frac{\pi}{180}\right) \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right) \cdot \left(4 \cdot \left(\left(\sin \left(angle \cdot \frac{\pi}{180}\right) \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right) \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) + \frac{\left(\left({\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}\right) \cdot \frac{-4}{x-scale}\right) \cdot \frac{{\left(a \cdot \cos \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2}}{x-scale}}{y-scale \cdot y-scale}} \]
  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-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 34.2% accurate, 1693.0× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ 0 \end{array} \]
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale) :precision binary64 0.0)
b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
	return 0.0;
}
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 = 0.0d0
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 0.0;
}
b_m = math.fabs(b)
def code(a, b_m, angle, x_45_scale, y_45_scale):
	return 0.0
b_m = abs(b)
function code(a, b_m, angle, x_45_scale, y_45_scale)
	return 0.0
end
b_m = abs(b);
function tmp = code(a, b_m, angle, x_45_scale, y_45_scale)
	tmp = 0.0;
end
b_m = N[Abs[b], $MachinePrecision]
code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := 0.0
\begin{array}{l}
b_m = \left|b\right|

\\
0
\end{array}
Derivation
  1. Initial program 27.2%

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

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

    \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{4} \cdot \left({\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}{{x-scale}^{2} \cdot {y-scale}^{2}} + 4 \cdot \frac{{a}^{4} \cdot \left({\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
  5. Step-by-step derivation
    1. distribute-rgt-outN/A

      \[\leadsto \frac{{a}^{4} \cdot \left({\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}{{x-scale}^{2} \cdot {y-scale}^{2}} \cdot \color{blue}{\left(-4 + 4\right)} \]
    2. metadata-evalN/A

      \[\leadsto \frac{{a}^{4} \cdot \left({\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}{{x-scale}^{2} \cdot {y-scale}^{2}} \cdot 0 \]
    3. mul0-rgt35.5%

      \[\leadsto 0 \]
  6. Simplified35.5%

    \[\leadsto \color{blue}{0} \]
  7. Add Preprocessing

Reproduce

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