?

Average Error: 20.0 → 20.0
Time: 18.1s
Precision: binary64
Cost: 26240

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 20.0

    \[{\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. Applied egg-rr20.0

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

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

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

Alternatives

Alternative 1
Error20.0
Cost26240
\[{a}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)\right)}^{2} \]
Alternative 2
Error20.0
Cost26240
\[{a}^{2} + {\left(b \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)}^{2} \]
Alternative 3
Error20.3
Cost20680
\[\begin{array}{l} \mathbf{if}\;\frac{angle}{180} \leq -10:\\ \;\;\;\;{a}^{2} + \frac{b \cdot b}{2} \cdot \left(1 - \cos \left(\frac{2}{\frac{\frac{180}{angle}}{\pi}}\right)\right)\\ \mathbf{elif}\;\frac{angle}{180} \leq 5 \cdot 10^{-15}:\\ \;\;\;\;{a}^{2} + \left(3.08641975308642 \cdot 10^{-5} \cdot \left(\left(b \cdot angle\right) \cdot \left(b \cdot angle\right)\right)\right) \cdot {\pi}^{2}\\ \mathbf{else}:\\ \;\;\;\;{a}^{2} + \left(b \cdot b\right) \cdot \frac{1 - \cos \left(\frac{\pi \cdot angle}{90}\right)}{2}\\ \end{array} \]
Alternative 4
Error20.1
Cost20425
\[\begin{array}{l} \mathbf{if}\;angle \leq -0.0042 \lor \neg \left(angle \leq 0.00062\right):\\ \;\;\;\;{a}^{2} + \left(b \cdot b\right) \cdot \frac{1 - \cos \left(\frac{\pi \cdot angle}{90}\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;{a}^{2} + \left(3.08641975308642 \cdot 10^{-5} \cdot \left(\left(b \cdot angle\right) \cdot \left(b \cdot angle\right)\right)\right) \cdot {\pi}^{2}\\ \end{array} \]
Alternative 5
Error20.1
Cost20424
\[\begin{array}{l} \mathbf{if}\;angle \leq -0.0042:\\ \;\;\;\;{a}^{2} + \frac{b}{\frac{2}{b}} \cdot \left(1 - \cos \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right)\right)\\ \mathbf{elif}\;angle \leq 0.00062:\\ \;\;\;\;{a}^{2} + \left(3.08641975308642 \cdot 10^{-5} \cdot \left(\left(b \cdot angle\right) \cdot \left(b \cdot angle\right)\right)\right) \cdot {\pi}^{2}\\ \mathbf{else}:\\ \;\;\;\;{a}^{2} + \left(b \cdot b\right) \cdot \frac{1 - \cos \left(\frac{\pi \cdot angle}{90}\right)}{2}\\ \end{array} \]
Alternative 6
Error20.1
Cost20424
\[\begin{array}{l} \mathbf{if}\;angle \leq -0.0042:\\ \;\;\;\;{a}^{2} + \frac{b \cdot b}{2} \cdot \left(1 - \cos \left(angle \cdot \frac{\pi}{90}\right)\right)\\ \mathbf{elif}\;angle \leq 0.00062:\\ \;\;\;\;{a}^{2} + \left(3.08641975308642 \cdot 10^{-5} \cdot \left(\left(b \cdot angle\right) \cdot \left(b \cdot angle\right)\right)\right) \cdot {\pi}^{2}\\ \mathbf{else}:\\ \;\;\;\;{a}^{2} + \left(b \cdot b\right) \cdot \frac{1 - \cos \left(\frac{\pi \cdot angle}{90}\right)}{2}\\ \end{array} \]
Alternative 7
Error23.3
Cost20361
\[\begin{array}{l} \mathbf{if}\;angle \leq -2.5 \cdot 10^{-36} \lor \neg \left(angle \leq 3.1 \cdot 10^{-15}\right):\\ \;\;\;\;{a}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot \left({\pi}^{2} \cdot \left(angle \cdot \left(angle \cdot \left(b \cdot b\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{a}^{2} + \left(3.08641975308642 \cdot 10^{-5} \cdot \left(\left(b \cdot angle\right) \cdot \left(b \cdot angle\right)\right)\right) \cdot {\pi}^{2}\\ \end{array} \]
Alternative 8
Error23.3
Cost20360
\[\begin{array}{l} \mathbf{if}\;b \leq -6 \cdot 10^{+149}:\\ \;\;\;\;{a}^{2} + {\left(\left(angle \cdot 0.005555555555555556\right) \cdot \left(b \cdot \pi\right)\right)}^{2}\\ \mathbf{elif}\;b \leq 5 \cdot 10^{+129}:\\ \;\;\;\;{a}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot \left({\pi}^{2} \cdot \left(angle \cdot \left(angle \cdot \left(b \cdot b\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{a}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot {\left(angle \cdot \left(b \cdot \pi\right)\right)}^{2}\\ \end{array} \]
Alternative 9
Error25.6
Cost20096
\[{a}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot \left(\left(b \cdot angle\right) \cdot \left(\pi \cdot \left(b \cdot \left(\pi \cdot angle\right)\right)\right)\right) \]
Alternative 10
Error25.6
Cost19840
\[{a}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot {\left(b \cdot \left(\pi \cdot angle\right)\right)}^{2} \]
Alternative 11
Error25.6
Cost19840
\[{a}^{2} + 3.08641975308642 \cdot 10^{-5} \cdot {\left(angle \cdot \left(b \cdot \pi\right)\right)}^{2} \]
Alternative 12
Error25.5
Cost19840
\[{a}^{2} + {\left(0.005555555555555556 \cdot \left(b \cdot \left(\pi \cdot angle\right)\right)\right)}^{2} \]

Error

Reproduce?

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