ab-angle->ABCF C

Percentage Accurate: 79.5% → 79.5%
Time: 16.6s
Alternatives: 17
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \pi \cdot \frac{angle}{180}\\ {\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2} \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (let* ((t_0 (* PI (/ angle 180.0))))
   (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
double code(double a, double b, double angle) {
	double t_0 = ((double) M_PI) * (angle / 180.0);
	return pow((a * cos(t_0)), 2.0) + pow((b * sin(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
	double t_0 = Math.PI * (angle / 180.0);
	return Math.pow((a * Math.cos(t_0)), 2.0) + Math.pow((b * Math.sin(t_0)), 2.0);
}
def code(a, b, angle):
	t_0 = math.pi * (angle / 180.0)
	return math.pow((a * math.cos(t_0)), 2.0) + math.pow((b * math.sin(t_0)), 2.0)
function code(a, b, angle)
	t_0 = Float64(pi * Float64(angle / 180.0))
	return Float64((Float64(a * cos(t_0)) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0))
end
function tmp = code(a, b, angle)
	t_0 = pi * (angle / 180.0);
	tmp = ((a * cos(t_0)) ^ 2.0) + ((b * sin(t_0)) ^ 2.0);
end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\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 17 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: 79.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \pi \cdot \frac{angle}{180}\\ {\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2} \end{array} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (let* ((t_0 (* PI (/ angle 180.0))))
   (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
double code(double a, double b, double angle) {
	double t_0 = ((double) M_PI) * (angle / 180.0);
	return pow((a * cos(t_0)), 2.0) + pow((b * sin(t_0)), 2.0);
}
public static double code(double a, double b, double angle) {
	double t_0 = Math.PI * (angle / 180.0);
	return Math.pow((a * Math.cos(t_0)), 2.0) + Math.pow((b * Math.sin(t_0)), 2.0);
}
def code(a, b, angle):
	t_0 = math.pi * (angle / 180.0)
	return math.pow((a * math.cos(t_0)), 2.0) + math.pow((b * math.sin(t_0)), 2.0)
function code(a, b, angle)
	t_0 = Float64(pi * Float64(angle / 180.0))
	return Float64((Float64(a * cos(t_0)) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0))
end
function tmp = code(a, b, angle)
	t_0 = pi * (angle / 180.0);
	tmp = ((a * cos(t_0)) ^ 2.0) + ((b * sin(t_0)) ^ 2.0);
end
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}

Alternative 1: 79.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ {\left(a \cdot \cos \left(\left({\left(\left(\pi \cdot \pi\right) \cdot \sqrt{\pi}\right)}^{0.3333333333333333} \cdot \sqrt[3]{\sqrt{\pi}}\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\pi \cdot angle}{180}\right)\right)}^{2} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (+
  (pow
   (*
    a
    (cos
     (*
      (* (pow (* (* PI PI) (sqrt PI)) 0.3333333333333333) (cbrt (sqrt PI)))
      (/ angle 180.0))))
   2.0)
  (pow (* b (sin (/ (* PI angle) 180.0))) 2.0)))
double code(double a, double b, double angle) {
	return pow((a * cos(((pow(((((double) M_PI) * ((double) M_PI)) * sqrt(((double) M_PI))), 0.3333333333333333) * cbrt(sqrt(((double) M_PI)))) * (angle / 180.0)))), 2.0) + pow((b * sin(((((double) M_PI) * angle) / 180.0))), 2.0);
}
public static double code(double a, double b, double angle) {
	return Math.pow((a * Math.cos(((Math.pow(((Math.PI * Math.PI) * Math.sqrt(Math.PI)), 0.3333333333333333) * Math.cbrt(Math.sqrt(Math.PI))) * (angle / 180.0)))), 2.0) + Math.pow((b * Math.sin(((Math.PI * angle) / 180.0))), 2.0);
}
function code(a, b, angle)
	return Float64((Float64(a * cos(Float64(Float64((Float64(Float64(pi * pi) * sqrt(pi)) ^ 0.3333333333333333) * cbrt(sqrt(pi))) * Float64(angle / 180.0)))) ^ 2.0) + (Float64(b * sin(Float64(Float64(pi * angle) / 180.0))) ^ 2.0))
end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Cos[N[(N[(N[Power[N[(N[(Pi * Pi), $MachinePrecision] * N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision], 0.3333333333333333], $MachinePrecision] * N[Power[N[Sqrt[Pi], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(N[(Pi * angle), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
{\left(a \cdot \cos \left(\left({\left(\left(\pi \cdot \pi\right) \cdot \sqrt{\pi}\right)}^{0.3333333333333333} \cdot \sqrt[3]{\sqrt{\pi}}\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\pi \cdot angle}{180}\right)\right)}^{2}
\end{array}
Derivation
  1. Initial program 76.7%

    \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}^{2} \]
    2. lift-/.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\frac{angle}{180}}\right)\right)}^{2} \]
    3. associate-*r/N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)}\right)}^{2} \]
    4. lower-/.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)}\right)}^{2} \]
    5. lower-*.f6476.9

      \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\color{blue}{\pi \cdot angle}}{180}\right)\right)}^{2} \]
  4. Applied rewrites76.9%

    \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{\pi \cdot angle}{180}\right)}\right)}^{2} \]
  5. Step-by-step derivation
    1. lift-PI.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    2. add-cbrt-cubeN/A

      \[\leadsto {\left(a \cdot \cos \left(\color{blue}{\sqrt[3]{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)}} \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    3. pow1/3N/A

      \[\leadsto {\left(a \cdot \cos \left(\color{blue}{{\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right)}^{\frac{1}{3}}} \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    4. add-sqr-sqrtN/A

      \[\leadsto {\left(a \cdot \cos \left({\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \color{blue}{\left(\sqrt{\mathsf{PI}\left(\right)} \cdot \sqrt{\mathsf{PI}\left(\right)}\right)}\right)}^{\frac{1}{3}} \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    5. associate-*r*N/A

      \[\leadsto {\left(a \cdot \cos \left({\color{blue}{\left(\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right)}}^{\frac{1}{3}} \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    6. unpow-prod-downN/A

      \[\leadsto {\left(a \cdot \cos \left(\color{blue}{\left({\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{3}} \cdot {\left(\sqrt{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{3}}\right)} \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    7. pow1/3N/A

      \[\leadsto {\left(a \cdot \cos \left(\left({\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{3}} \cdot \color{blue}{\sqrt[3]{\sqrt{\mathsf{PI}\left(\right)}}}\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    8. lower-*.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\color{blue}{\left({\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{3}} \cdot \sqrt[3]{\sqrt{\mathsf{PI}\left(\right)}}\right)} \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    9. lower-pow.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\left(\color{blue}{{\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{3}}} \cdot \sqrt[3]{\sqrt{\mathsf{PI}\left(\right)}}\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    10. lower-*.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\left({\color{blue}{\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right)}}^{\frac{1}{3}} \cdot \sqrt[3]{\sqrt{\mathsf{PI}\left(\right)}}\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    11. lift-PI.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\left({\left(\left(\color{blue}{\mathsf{PI}\left(\right)} \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{3}} \cdot \sqrt[3]{\sqrt{\mathsf{PI}\left(\right)}}\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    12. lift-PI.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\left({\left(\left(\mathsf{PI}\left(\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{3}} \cdot \sqrt[3]{\sqrt{\mathsf{PI}\left(\right)}}\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    13. lower-*.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\left({\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)} \cdot \sqrt{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{3}} \cdot \sqrt[3]{\sqrt{\mathsf{PI}\left(\right)}}\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    14. lift-PI.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\left({\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\color{blue}{\mathsf{PI}\left(\right)}}\right)}^{\frac{1}{3}} \cdot \sqrt[3]{\sqrt{\mathsf{PI}\left(\right)}}\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    15. lower-sqrt.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\left({\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \color{blue}{\sqrt{\mathsf{PI}\left(\right)}}\right)}^{\frac{1}{3}} \cdot \sqrt[3]{\sqrt{\mathsf{PI}\left(\right)}}\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    16. lower-cbrt.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\left({\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{3}} \cdot \color{blue}{\sqrt[3]{\sqrt{\mathsf{PI}\left(\right)}}}\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    17. lift-PI.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\left({\left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{3}} \cdot \sqrt[3]{\sqrt{\color{blue}{\mathsf{PI}\left(\right)}}}\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    18. lower-sqrt.f6477.0

      \[\leadsto {\left(a \cdot \cos \left(\left({\left(\left(\pi \cdot \pi\right) \cdot \sqrt{\pi}\right)}^{0.3333333333333333} \cdot \sqrt[3]{\color{blue}{\sqrt{\pi}}}\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\pi \cdot angle}{180}\right)\right)}^{2} \]
  6. Applied rewrites77.0%

    \[\leadsto {\left(a \cdot \cos \left(\color{blue}{\left({\left(\left(\pi \cdot \pi\right) \cdot \sqrt{\pi}\right)}^{0.3333333333333333} \cdot \sqrt[3]{\sqrt{\pi}}\right)} \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\pi \cdot angle}{180}\right)\right)}^{2} \]
  7. Add Preprocessing

Alternative 2: 79.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ {\left(b \cdot \sin \left(\frac{\pi \cdot angle}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left(0.005555555555555556 \cdot \frac{\pi}{\frac{1}{angle}}\right)\right)}^{2} \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (+
  (pow (* b (sin (/ (* PI angle) 180.0))) 2.0)
  (pow (* a (cos (* 0.005555555555555556 (/ PI (/ 1.0 angle))))) 2.0)))
double code(double a, double b, double angle) {
	return pow((b * sin(((((double) M_PI) * angle) / 180.0))), 2.0) + pow((a * cos((0.005555555555555556 * (((double) M_PI) / (1.0 / angle))))), 2.0);
}
public static double code(double a, double b, double angle) {
	return Math.pow((b * Math.sin(((Math.PI * angle) / 180.0))), 2.0) + Math.pow((a * Math.cos((0.005555555555555556 * (Math.PI / (1.0 / angle))))), 2.0);
}
def code(a, b, angle):
	return math.pow((b * math.sin(((math.pi * angle) / 180.0))), 2.0) + math.pow((a * math.cos((0.005555555555555556 * (math.pi / (1.0 / angle))))), 2.0)
function code(a, b, angle)
	return Float64((Float64(b * sin(Float64(Float64(pi * angle) / 180.0))) ^ 2.0) + (Float64(a * cos(Float64(0.005555555555555556 * Float64(pi / Float64(1.0 / angle))))) ^ 2.0))
end
function tmp = code(a, b, angle)
	tmp = ((b * sin(((pi * angle) / 180.0))) ^ 2.0) + ((a * cos((0.005555555555555556 * (pi / (1.0 / angle))))) ^ 2.0);
end
code[a_, b_, angle_] := N[(N[Power[N[(b * N[Sin[N[(N[(Pi * angle), $MachinePrecision] / 180.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(a * N[Cos[N[(0.005555555555555556 * N[(Pi / N[(1.0 / angle), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
{\left(b \cdot \sin \left(\frac{\pi \cdot angle}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left(0.005555555555555556 \cdot \frac{\pi}{\frac{1}{angle}}\right)\right)}^{2}
\end{array}
Derivation
  1. Initial program 79.5%

    \[{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}^{2} \]
    2. lift-/.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\frac{angle}{180}}\right)\right)}^{2} \]
    3. associate-*r/N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)}\right)}^{2} \]
    4. lower-/.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)}\right)}^{2} \]
    5. lower-*.f6479.5

      \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\color{blue}{\pi \cdot angle}}{180}\right)\right)}^{2} \]
  4. Applied rewrites79.5%

    \[\leadsto {\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \color{blue}{\left(\frac{\pi \cdot angle}{180}\right)}\right)}^{2} \]
  5. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \frac{angle}{180}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    2. *-commutativeN/A

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    3. lift-/.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\color{blue}{\frac{angle}{180}} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    4. clear-numN/A

      \[\leadsto {\left(a \cdot \cos \left(\color{blue}{\frac{1}{\frac{180}{angle}}} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    5. associate-*l/N/A

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{1 \cdot \mathsf{PI}\left(\right)}{\frac{180}{angle}}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    6. div-invN/A

      \[\leadsto {\left(a \cdot \cos \left(\frac{1 \cdot \mathsf{PI}\left(\right)}{\color{blue}{180 \cdot \frac{1}{angle}}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    7. times-fracN/A

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

      \[\leadsto {\left(a \cdot \cos \left(\color{blue}{\frac{1}{180}} \cdot \frac{\mathsf{PI}\left(\right)}{\frac{1}{angle}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    9. lower-*.f64N/A

      \[\leadsto {\left(a \cdot \cos \color{blue}{\left(\frac{1}{180} \cdot \frac{\mathsf{PI}\left(\right)}{\frac{1}{angle}}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    10. lower-/.f64N/A

      \[\leadsto {\left(a \cdot \cos \left(\frac{1}{180} \cdot \color{blue}{\frac{\mathsf{PI}\left(\right)}{\frac{1}{angle}}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\mathsf{PI}\left(\right) \cdot angle}{180}\right)\right)}^{2} \]
    11. lower-/.f6479.5

      \[\leadsto {\left(a \cdot \cos \left(0.005555555555555556 \cdot \frac{\pi}{\color{blue}{\frac{1}{angle}}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{\pi \cdot angle}{180}\right)\right)}^{2} \]
  6. Applied rewrites79.5%

    \[\leadsto {\left(a \cdot \cos \color{blue}{\left(0.005555555555555556 \cdot \frac{\pi}{\frac{1}{angle}}\right)}\right)}^{2} + {\left(b \cdot \sin \left(\frac{\pi \cdot angle}{180}\right)\right)}^{2} \]
  7. Final simplification79.5%

    \[\leadsto {\left(b \cdot \sin \left(\frac{\pi \cdot angle}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left(0.005555555555555556 \cdot \frac{\pi}{\frac{1}{angle}}\right)\right)}^{2} \]
  8. Add Preprocessing

Reproduce

?
herbie shell --seed 2024228 
(FPCore (a b angle)
  :name "ab-angle->ABCF C"
  :precision binary64
  (+ (pow (* a (cos (* PI (/ angle 180.0)))) 2.0) (pow (* b (sin (* PI (/ angle 180.0)))) 2.0)))