?

Average Error: 20.3 → 20.3
Time: 18.8s
Precision: binary64
Cost: 33472

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 20.3

    \[{\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} \]
  2. Simplified20.3

    \[\leadsto \color{blue}{{\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}} \]
    Proof

    [Start]20.3

    \[ {\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} \]

    rational_best-simplify-1 [=>]20.3

    \[ {\left(a \cdot \sin \color{blue}{\left(\pi \cdot \frac{angle}{180}\right)}\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]

    rational_best-simplify-62 [=>]20.3

    \[ {\left(a \cdot \sin \color{blue}{\left(\frac{angle \cdot \pi}{180}\right)}\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]

    rational_best-simplify-1 [=>]20.3

    \[ {\left(a \cdot \sin \left(\frac{\color{blue}{\pi \cdot angle}}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]

    rational_best-simplify-61 [=>]20.3

    \[ {\left(a \cdot \sin \color{blue}{\left(angle \cdot \frac{\pi}{180}\right)}\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]

    rational_best-simplify-1 [=>]20.3

    \[ {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(\pi \cdot \frac{angle}{180}\right)}\right)}^{2} \]

    rational_best-simplify-62 [=>]20.3

    \[ {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(\frac{angle \cdot \pi}{180}\right)}\right)}^{2} \]

    rational_best-simplify-1 [=>]20.3

    \[ {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{\color{blue}{\pi \cdot angle}}{180}\right)\right)}^{2} \]

    rational_best-simplify-61 [=>]20.3

    \[ {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(angle \cdot \frac{\pi}{180}\right)}\right)}^{2} \]
  3. Taylor expanded in angle around 0 20.3

    \[\leadsto {\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot \color{blue}{1}\right)}^{2} \]
  4. Applied egg-rr20.3

    \[\leadsto {\left(a \cdot \sin \color{blue}{\left(\frac{angle \cdot \pi}{180}\right)}\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
  5. Applied egg-rr20.3

    \[\leadsto {\left(a \cdot \sin \left(\frac{\color{blue}{\left(angle \cdot \left(\pi \cdot 0.5\right) + angle\right) - \left(angle - angle \cdot \left(\pi \cdot 0.5\right)\right)}}{180}\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
  6. Final simplification20.3

    \[\leadsto {\left(a \cdot \sin \left(\frac{\left(angle \cdot \left(\pi \cdot 0.5\right) + angle\right) - \left(angle - angle \cdot \left(\pi \cdot 0.5\right)\right)}{180}\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]

Alternatives

Alternative 1
Error20.3
Cost26368
\[{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
Alternative 2
Error20.3
Cost26368
\[{\left(a \cdot \sin \left(angle \cdot \frac{\pi}{180}\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
Alternative 3
Error20.3
Cost26368
\[{\left(a \cdot \sin \left(\frac{angle \cdot \pi}{180}\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
Alternative 4
Error22.0
Cost20104
\[\begin{array}{l} \mathbf{if}\;angle \leq -3.5 \cdot 10^{+53}:\\ \;\;\;\;{b}^{2}\\ \mathbf{elif}\;angle \leq 2.4 \cdot 10^{+27}:\\ \;\;\;\;{b}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot {\left(angle \cdot \left(a \cdot \pi\right)\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;{b}^{2}\\ \end{array} \]
Alternative 5
Error22.0
Cost20104
\[\begin{array}{l} \mathbf{if}\;angle \leq -3.5 \cdot 10^{+53}:\\ \;\;\;\;{b}^{2}\\ \mathbf{elif}\;angle \leq 2.25 \cdot 10^{+21}:\\ \;\;\;\;{b}^{2} - {\left(\pi \cdot \left(angle \cdot a\right)\right)}^{2} \cdot -3.08641975308642 \cdot 10^{-5}\\ \mathbf{else}:\\ \;\;\;\;{b}^{2}\\ \end{array} \]
Alternative 6
Error32.0
Cost6528
\[{b}^{2} \]

Error

Reproduce?

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