| Alternative 1 | |
|---|---|
| Error | 64.33% |
| Cost | 46609 |
(FPCore (a b angle x-scale y-scale)
:precision binary64
(/
(-
(sqrt
(*
(*
(* 2.0 (/ (* 4.0 (* (* b a) (* b (- a)))) (pow (* x-scale y-scale) 2.0)))
(* (* b a) (* b (- a))))
(+
(+
(/
(/
(+
(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))
(sqrt
(+
(pow
(-
(/
(/
(+
(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))
2.0)
(pow
(/
(/
(*
(*
(* 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)))))))
(/ (* 4.0 (* (* b a) (* b (- a)))) (pow (* x-scale y-scale) 2.0))))(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (* 0.005555555555555556 angle) PI)) (t_1 (* a (cos t_0))))
(if (<= x-scale -1.8e+26)
(* -0.25 (* x-scale (* (sqrt 8.0) (* (sqrt 2.0) t_1))))
(if (or (<= x-scale 8e-131)
(and (not (<= x-scale 3.3e-44)) (<= x-scale 4.8e-26)))
(fabs (* y-scale b))
(*
0.25
(*
x-scale
(*
(sqrt 8.0)
(pow (sqrt (* (sqrt 2.0) (hypot (* b (sin t_0)) t_1))) 2.0))))))))double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return -sqrt((((2.0 * ((4.0 * ((b * a) * (b * -a))) / pow((x_45_scale * y_45_scale), 2.0))) * ((b * a) * (b * -a))) * (((((pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * cos(((angle / 180.0) * ((double) M_PI)))), 2.0)) / x_45_scale) / x_45_scale) + (((pow((a * cos(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * sin(((angle / 180.0) * ((double) M_PI)))), 2.0)) / y_45_scale) / y_45_scale)) + sqrt((pow(((((pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * cos(((angle / 180.0) * ((double) M_PI)))), 2.0)) / x_45_scale) / x_45_scale) - (((pow((a * cos(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * sin(((angle / 180.0) * ((double) M_PI)))), 2.0)) / y_45_scale) / y_45_scale)), 2.0) + pow((((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin(((angle / 180.0) * ((double) M_PI)))) * cos(((angle / 180.0) * ((double) M_PI)))) / x_45_scale) / y_45_scale), 2.0)))))) / ((4.0 * ((b * a) * (b * -a))) / pow((x_45_scale * y_45_scale), 2.0));
}
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (0.005555555555555556 * angle) * ((double) M_PI);
double t_1 = a * cos(t_0);
double tmp;
if (x_45_scale <= -1.8e+26) {
tmp = -0.25 * (x_45_scale * (sqrt(8.0) * (sqrt(2.0) * t_1)));
} else if ((x_45_scale <= 8e-131) || (!(x_45_scale <= 3.3e-44) && (x_45_scale <= 4.8e-26))) {
tmp = fabs((y_45_scale * b));
} else {
tmp = 0.25 * (x_45_scale * (sqrt(8.0) * pow(sqrt((sqrt(2.0) * hypot((b * sin(t_0)), t_1))), 2.0)));
}
return tmp;
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return -Math.sqrt((((2.0 * ((4.0 * ((b * a) * (b * -a))) / Math.pow((x_45_scale * y_45_scale), 2.0))) * ((b * a) * (b * -a))) * (((((Math.pow((a * Math.sin(((angle / 180.0) * Math.PI))), 2.0) + Math.pow((b * Math.cos(((angle / 180.0) * Math.PI))), 2.0)) / x_45_scale) / x_45_scale) + (((Math.pow((a * Math.cos(((angle / 180.0) * Math.PI))), 2.0) + Math.pow((b * Math.sin(((angle / 180.0) * Math.PI))), 2.0)) / y_45_scale) / y_45_scale)) + Math.sqrt((Math.pow(((((Math.pow((a * Math.sin(((angle / 180.0) * Math.PI))), 2.0) + Math.pow((b * Math.cos(((angle / 180.0) * Math.PI))), 2.0)) / x_45_scale) / x_45_scale) - (((Math.pow((a * Math.cos(((angle / 180.0) * Math.PI))), 2.0) + Math.pow((b * Math.sin(((angle / 180.0) * Math.PI))), 2.0)) / y_45_scale) / y_45_scale)), 2.0) + Math.pow((((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * Math.sin(((angle / 180.0) * Math.PI))) * Math.cos(((angle / 180.0) * Math.PI))) / x_45_scale) / y_45_scale), 2.0)))))) / ((4.0 * ((b * a) * (b * -a))) / Math.pow((x_45_scale * y_45_scale), 2.0));
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (0.005555555555555556 * angle) * Math.PI;
double t_1 = a * Math.cos(t_0);
double tmp;
if (x_45_scale <= -1.8e+26) {
tmp = -0.25 * (x_45_scale * (Math.sqrt(8.0) * (Math.sqrt(2.0) * t_1)));
} else if ((x_45_scale <= 8e-131) || (!(x_45_scale <= 3.3e-44) && (x_45_scale <= 4.8e-26))) {
tmp = Math.abs((y_45_scale * b));
} else {
tmp = 0.25 * (x_45_scale * (Math.sqrt(8.0) * Math.pow(Math.sqrt((Math.sqrt(2.0) * Math.hypot((b * Math.sin(t_0)), t_1))), 2.0)));
}
return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale): return -math.sqrt((((2.0 * ((4.0 * ((b * a) * (b * -a))) / math.pow((x_45_scale * y_45_scale), 2.0))) * ((b * a) * (b * -a))) * (((((math.pow((a * math.sin(((angle / 180.0) * math.pi))), 2.0) + math.pow((b * math.cos(((angle / 180.0) * math.pi))), 2.0)) / x_45_scale) / x_45_scale) + (((math.pow((a * math.cos(((angle / 180.0) * math.pi))), 2.0) + math.pow((b * math.sin(((angle / 180.0) * math.pi))), 2.0)) / y_45_scale) / y_45_scale)) + math.sqrt((math.pow(((((math.pow((a * math.sin(((angle / 180.0) * math.pi))), 2.0) + math.pow((b * math.cos(((angle / 180.0) * math.pi))), 2.0)) / x_45_scale) / x_45_scale) - (((math.pow((a * math.cos(((angle / 180.0) * math.pi))), 2.0) + math.pow((b * math.sin(((angle / 180.0) * math.pi))), 2.0)) / y_45_scale) / y_45_scale)), 2.0) + math.pow((((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * math.sin(((angle / 180.0) * math.pi))) * math.cos(((angle / 180.0) * math.pi))) / x_45_scale) / y_45_scale), 2.0)))))) / ((4.0 * ((b * a) * (b * -a))) / math.pow((x_45_scale * y_45_scale), 2.0))
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = (0.005555555555555556 * angle) * math.pi t_1 = a * math.cos(t_0) tmp = 0 if x_45_scale <= -1.8e+26: tmp = -0.25 * (x_45_scale * (math.sqrt(8.0) * (math.sqrt(2.0) * t_1))) elif (x_45_scale <= 8e-131) or (not (x_45_scale <= 3.3e-44) and (x_45_scale <= 4.8e-26)): tmp = math.fabs((y_45_scale * b)) else: tmp = 0.25 * (x_45_scale * (math.sqrt(8.0) * math.pow(math.sqrt((math.sqrt(2.0) * math.hypot((b * math.sin(t_0)), t_1))), 2.0))) return tmp
function code(a, b, angle, x_45_scale, y_45_scale) return Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * Float64(Float64(4.0 * Float64(Float64(b * a) * Float64(b * Float64(-a)))) / (Float64(x_45_scale * y_45_scale) ^ 2.0))) * Float64(Float64(b * a) * Float64(b * Float64(-a)))) * Float64(Float64(Float64(Float64(Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0)) / x_45_scale) / x_45_scale) + Float64(Float64(Float64((Float64(a * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0)) / y_45_scale) / y_45_scale)) + sqrt(Float64((Float64(Float64(Float64(Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0)) / x_45_scale) / x_45_scale) - Float64(Float64(Float64((Float64(a * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0)) / y_45_scale) / y_45_scale)) ^ 2.0) + (Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(Float64(Float64(angle / 180.0) * pi))) * cos(Float64(Float64(angle / 180.0) * pi))) / x_45_scale) / y_45_scale) ^ 2.0))))))) / Float64(Float64(4.0 * Float64(Float64(b * a) * Float64(b * Float64(-a)))) / (Float64(x_45_scale * y_45_scale) ^ 2.0))) end
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(0.005555555555555556 * angle) * pi) t_1 = Float64(a * cos(t_0)) tmp = 0.0 if (x_45_scale <= -1.8e+26) tmp = Float64(-0.25 * Float64(x_45_scale * Float64(sqrt(8.0) * Float64(sqrt(2.0) * t_1)))); elseif ((x_45_scale <= 8e-131) || (!(x_45_scale <= 3.3e-44) && (x_45_scale <= 4.8e-26))) tmp = abs(Float64(y_45_scale * b)); else tmp = Float64(0.25 * Float64(x_45_scale * Float64(sqrt(8.0) * (sqrt(Float64(sqrt(2.0) * hypot(Float64(b * sin(t_0)), t_1))) ^ 2.0)))); end return tmp end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = -sqrt((((2.0 * ((4.0 * ((b * a) * (b * -a))) / ((x_45_scale * y_45_scale) ^ 2.0))) * ((b * a) * (b * -a))) * (((((((a * sin(((angle / 180.0) * pi))) ^ 2.0) + ((b * cos(((angle / 180.0) * pi))) ^ 2.0)) / x_45_scale) / x_45_scale) + (((((a * cos(((angle / 180.0) * pi))) ^ 2.0) + ((b * sin(((angle / 180.0) * pi))) ^ 2.0)) / y_45_scale) / y_45_scale)) + sqrt(((((((((a * sin(((angle / 180.0) * pi))) ^ 2.0) + ((b * cos(((angle / 180.0) * pi))) ^ 2.0)) / x_45_scale) / x_45_scale) - (((((a * cos(((angle / 180.0) * pi))) ^ 2.0) + ((b * sin(((angle / 180.0) * pi))) ^ 2.0)) / y_45_scale) / y_45_scale)) ^ 2.0) + ((((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * sin(((angle / 180.0) * pi))) * cos(((angle / 180.0) * pi))) / x_45_scale) / y_45_scale) ^ 2.0)))))) / ((4.0 * ((b * a) * (b * -a))) / ((x_45_scale * y_45_scale) ^ 2.0)); end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale) t_0 = (0.005555555555555556 * angle) * pi; t_1 = a * cos(t_0); tmp = 0.0; if (x_45_scale <= -1.8e+26) tmp = -0.25 * (x_45_scale * (sqrt(8.0) * (sqrt(2.0) * t_1))); elseif ((x_45_scale <= 8e-131) || (~((x_45_scale <= 3.3e-44)) && (x_45_scale <= 4.8e-26))) tmp = abs((y_45_scale * b)); else tmp = 0.25 * (x_45_scale * (sqrt(8.0) * (sqrt((sqrt(2.0) * hypot((b * sin(t_0)), t_1))) ^ 2.0))); end tmp_2 = tmp; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[((-N[Sqrt[N[(N[(N[(2.0 * N[(N[(4.0 * N[(N[(b * a), $MachinePrecision] * N[(b * (-a)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[N[(x$45$scale * y$45$scale), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(b * a), $MachinePrecision] * N[(b * (-a)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision] + N[(N[(N[(N[Power[N[(a * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(N[(N[(N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision] - N[(N[(N[(N[Power[N[(a * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(N[(N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(4.0 * N[(N[(b * a), $MachinePrecision] * N[(b * (-a)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[N[(x$45$scale * y$45$scale), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(0.005555555555555556 * angle), $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$1 = N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$45$scale, -1.8e+26], N[(-0.25 * N[(x$45$scale * N[(N[Sqrt[8.0], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x$45$scale, 8e-131], And[N[Not[LessEqual[x$45$scale, 3.3e-44]], $MachinePrecision], LessEqual[x$45$scale, 4.8e-26]]], N[Abs[N[(y$45$scale * b), $MachinePrecision]], $MachinePrecision], N[(0.25 * N[(x$45$scale * N[(N[Sqrt[8.0], $MachinePrecision] * N[Power[N[Sqrt[N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\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} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}}
\begin{array}{l}
t_0 := \left(0.005555555555555556 \cdot angle\right) \cdot \pi\\
t_1 := a \cdot \cos t_0\\
\mathbf{if}\;x-scale \leq -1.8 \cdot 10^{+26}:\\
\;\;\;\;-0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \left(\sqrt{2} \cdot t_1\right)\right)\right)\\
\mathbf{elif}\;x-scale \leq 8 \cdot 10^{-131} \lor \neg \left(x-scale \leq 3.3 \cdot 10^{-44}\right) \land x-scale \leq 4.8 \cdot 10^{-26}:\\
\;\;\;\;\left|y-scale \cdot b\right|\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot {\left(\sqrt{\sqrt{2} \cdot \mathsf{hypot}\left(b \cdot \sin t_0, t_1\right)}\right)}^{2}\right)\right)\\
\end{array}
Results
if x-scale < -1.80000000000000012e26Initial program 98.74
Taylor expanded in y-scale around 0 98.97
Simplified98.97
[Start]98.97 | \[ 0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)
\] |
|---|---|
associate-*l* [=>]98.97 | \[ 0.25 \cdot \color{blue}{\left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)\right)}
\] |
distribute-lft-out [=>]98.97 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{\color{blue}{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} + {b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}}\right)\right)
\] |
+-commutative [=>]98.97 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{2 \cdot \color{blue}{\left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} + {a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}}\right)\right)
\] |
fma-def [=>]98.97 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{2 \cdot \color{blue}{\mathsf{fma}\left({b}^{2}, {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}, {a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}}\right)\right)
\] |
unpow2 [=>]98.97 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{2 \cdot \mathsf{fma}\left(\color{blue}{b \cdot b}, {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}, {a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)\right)
\] |
Taylor expanded in a around -inf 81.58
Simplified81.64
[Start]81.58 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \left(-1 \cdot \left(\sqrt{2} \cdot \left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)\right)\right)\right)\right)
\] |
|---|---|
mul-1-neg [=>]81.58 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \color{blue}{\left(-\sqrt{2} \cdot \left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)\right)}\right)\right)
\] |
*-commutative [=>]81.58 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \left(-\sqrt{2} \cdot \left(a \cdot \cos \left(0.005555555555555556 \cdot \color{blue}{\left(\pi \cdot angle\right)}\right)\right)\right)\right)\right)
\] |
associate-*l* [<=]81.58 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \left(-\sqrt{2} \cdot \left(a \cdot \cos \color{blue}{\left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right)}\right)\right)\right)\right)
\] |
associate-*l* [=>]81.58 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \left(-\sqrt{2} \cdot \left(a \cdot \cos \color{blue}{\left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)}\right)\right)\right)\right)
\] |
*-commutative [<=]81.58 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \left(-\sqrt{2} \cdot \left(a \cdot \cos \left(0.005555555555555556 \cdot \color{blue}{\left(angle \cdot \pi\right)}\right)\right)\right)\right)\right)
\] |
associate-*r* [=>]81.64 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \left(-\sqrt{2} \cdot \left(a \cdot \cos \color{blue}{\left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right)}\right)\right)\right)\right)
\] |
if -1.80000000000000012e26 < x-scale < 7.9999999999999999e-131 or 3.30000000000000006e-44 < x-scale < 4.8000000000000002e-26Initial program 99.37
Simplified99.17
[Start]99.37 | \[ \frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\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} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}}
\] |
|---|
Taylor expanded in angle around 0 79.31
Simplified79.31
[Start]79.31 | \[ 0.25 \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \left(b \cdot \sqrt{8}\right)\right)\right)
\] |
|---|---|
associate-*r* [=>]79.31 | \[ \color{blue}{\left(0.25 \cdot y-scale\right) \cdot \left(\sqrt{2} \cdot \left(b \cdot \sqrt{8}\right)\right)}
\] |
associate-*r* [=>]79.31 | \[ \left(0.25 \cdot y-scale\right) \cdot \color{blue}{\left(\left(\sqrt{2} \cdot b\right) \cdot \sqrt{8}\right)}
\] |
*-commutative [=>]79.31 | \[ \left(0.25 \cdot y-scale\right) \cdot \left(\color{blue}{\left(b \cdot \sqrt{2}\right)} \cdot \sqrt{8}\right)
\] |
Applied egg-rr62.75
Taylor expanded in b around 0 62.75
if 7.9999999999999999e-131 < x-scale < 3.30000000000000006e-44 or 4.8000000000000002e-26 < x-scale Initial program 99.25
Taylor expanded in y-scale around 0 74.07
Simplified74.03
[Start]74.07 | \[ 0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)
\] |
|---|---|
associate-*l* [=>]74.03 | \[ 0.25 \cdot \color{blue}{\left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)\right)}
\] |
distribute-lft-out [=>]74.03 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{\color{blue}{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} + {b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}}\right)\right)
\] |
+-commutative [=>]74.03 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{2 \cdot \color{blue}{\left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} + {a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}}\right)\right)
\] |
fma-def [=>]74.03 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{2 \cdot \color{blue}{\mathsf{fma}\left({b}^{2}, {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}, {a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}}\right)\right)
\] |
unpow2 [=>]74.03 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{2 \cdot \mathsf{fma}\left(\color{blue}{b \cdot b}, {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}, {a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)\right)
\] |
Applied egg-rr84.18
Simplified70.93
[Start]84.18 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{2 \cdot \left(e^{\mathsf{log1p}\left({\left(\cos \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right) \cdot a\right)}^{2}\right)} - \left(1 - {\left(b \cdot \sin \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right)\right)}^{2}\right)\right)}\right)\right)
\] |
|---|---|
associate--r- [=>]80.25 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{2 \cdot \color{blue}{\left(\left(e^{\mathsf{log1p}\left({\left(\cos \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right) \cdot a\right)}^{2}\right)} - 1\right) + {\left(b \cdot \sin \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right)\right)}^{2}\right)}}\right)\right)
\] |
+-commutative [=>]80.25 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{2 \cdot \color{blue}{\left({\left(b \cdot \sin \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right)\right)}^{2} + \left(e^{\mathsf{log1p}\left({\left(\cos \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right) \cdot a\right)}^{2}\right)} - 1\right)\right)}}\right)\right)
\] |
*-commutative [=>]80.25 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{2 \cdot \left({\left(b \cdot \sin \left(\color{blue}{\left(\pi \cdot 0.005555555555555556\right)} \cdot angle\right)\right)}^{2} + \left(e^{\mathsf{log1p}\left({\left(\cos \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right) \cdot a\right)}^{2}\right)} - 1\right)\right)}\right)\right)
\] |
associate-*l* [=>]80.27 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{2 \cdot \left({\left(b \cdot \sin \color{blue}{\left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)}\right)}^{2} + \left(e^{\mathsf{log1p}\left({\left(\cos \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right) \cdot a\right)}^{2}\right)} - 1\right)\right)}\right)\right)
\] |
*-commutative [=>]80.27 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{2 \cdot \left({\left(b \cdot \sin \left(\pi \cdot \color{blue}{\left(angle \cdot 0.005555555555555556\right)}\right)\right)}^{2} + \left(e^{\mathsf{log1p}\left({\left(\cos \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right) \cdot a\right)}^{2}\right)} - 1\right)\right)}\right)\right)
\] |
expm1-def [=>]70.93 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{2 \cdot \left({\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\cos \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right) \cdot a\right)}^{2}\right)\right)}\right)}\right)\right)
\] |
*-commutative [=>]70.93 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{2 \cdot \left({\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + \mathsf{expm1}\left(\mathsf{log1p}\left({\color{blue}{\left(a \cdot \cos \left(\left(0.005555555555555556 \cdot \pi\right) \cdot angle\right)\right)}}^{2}\right)\right)\right)}\right)\right)
\] |
*-commutative [=>]70.93 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{2 \cdot \left({\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + \mathsf{expm1}\left(\mathsf{log1p}\left({\left(a \cdot \cos \left(\color{blue}{\left(\pi \cdot 0.005555555555555556\right)} \cdot angle\right)\right)}^{2}\right)\right)\right)}\right)\right)
\] |
associate-*l* [=>]70.93 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{2 \cdot \left({\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + \mathsf{expm1}\left(\mathsf{log1p}\left({\left(a \cdot \cos \color{blue}{\left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)}\right)}^{2}\right)\right)\right)}\right)\right)
\] |
*-commutative [=>]70.93 | \[ 0.25 \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{2 \cdot \left({\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} + \mathsf{expm1}\left(\mathsf{log1p}\left({\left(a \cdot \cos \left(\pi \cdot \color{blue}{\left(angle \cdot 0.005555555555555556\right)}\right)\right)}^{2}\right)\right)\right)}\right)\right)
\] |
Applied egg-rr56.92
Final simplification64.27
| Alternative 1 | |
|---|---|
| Error | 64.33% |
| Cost | 46609 |
| Alternative 2 | |
|---|---|
| Error | 70.87% |
| Cost | 46412 |
| Alternative 3 | |
|---|---|
| Error | 72.47% |
| Cost | 27552 |
| Alternative 4 | |
|---|---|
| Error | 71.54% |
| Cost | 26760 |
| Alternative 5 | |
|---|---|
| Error | 71.46% |
| Cost | 14028 |
| Alternative 6 | |
|---|---|
| Error | 69.95% |
| Cost | 13641 |
| Alternative 7 | |
|---|---|
| Error | 71.64% |
| Cost | 6592 |
| Alternative 8 | |
|---|---|
| Error | 84.16% |
| Cost | 192 |
herbie shell --seed 2023089
(FPCore (a b angle x-scale y-scale)
:name "a from scale-rotated-ellipse"
:precision binary64
(/ (- (sqrt (* (* (* 2.0 (/ (* 4.0 (* (* b a) (* b (- a)))) (pow (* x-scale y-scale) 2.0))) (* (* b a) (* b (- a)))) (+ (+ (/ (/ (+ (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)) (sqrt (+ (pow (- (/ (/ (+ (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)) 2.0) (pow (/ (/ (* (* (* 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))))))) (/ (* 4.0 (* (* b a) (* b (- a)))) (pow (* x-scale y-scale) 2.0))))