?

Average Error: 20.6 → 20.7
Time: 16.8s
Precision: binary64
Cost: 65728

?

\[{\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 := \frac{angle}{180} \cdot \pi\\ t_1 := \cos t_0\\ {\left(a \cdot \sin t_0\right)}^{2} + {\left(b \cdot \left(\left(t_1 \cdot \frac{1}{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}\right) \cdot t_1\right)\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 180.0) PI)) (t_1 (cos t_0)))
   (+
    (pow (* a (sin t_0)) 2.0)
    (pow
     (* b (* (* t_1 (/ 1.0 (cos (* 0.005555555555555556 (* angle PI))))) t_1))
     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 / 180.0) * ((double) M_PI);
	double t_1 = cos(t_0);
	return pow((a * sin(t_0)), 2.0) + pow((b * ((t_1 * (1.0 / cos((0.005555555555555556 * (angle * ((double) M_PI)))))) * t_1)), 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 / 180.0) * Math.PI;
	double t_1 = Math.cos(t_0);
	return Math.pow((a * Math.sin(t_0)), 2.0) + Math.pow((b * ((t_1 * (1.0 / Math.cos((0.005555555555555556 * (angle * Math.PI))))) * t_1)), 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 / 180.0) * math.pi
	t_1 = math.cos(t_0)
	return math.pow((a * math.sin(t_0)), 2.0) + math.pow((b * ((t_1 * (1.0 / math.cos((0.005555555555555556 * (angle * math.pi))))) * t_1)), 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(Float64(angle / 180.0) * pi)
	t_1 = cos(t_0)
	return Float64((Float64(a * sin(t_0)) ^ 2.0) + (Float64(b * Float64(Float64(t_1 * Float64(1.0 / cos(Float64(0.005555555555555556 * Float64(angle * pi))))) * t_1)) ^ 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 / 180.0) * pi;
	t_1 = cos(t_0);
	tmp = ((a * sin(t_0)) ^ 2.0) + ((b * ((t_1 * (1.0 / cos((0.005555555555555556 * (angle * pi))))) * t_1)) ^ 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[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$1 = N[Cos[t$95$0], $MachinePrecision]}, N[(N[Power[N[(a * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[(N[(t$95$1 * N[(1.0 / N[Cos[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $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 := \frac{angle}{180} \cdot \pi\\
t_1 := \cos t_0\\
{\left(a \cdot \sin t_0\right)}^{2} + {\left(b \cdot \left(\left(t_1 \cdot \frac{1}{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}\right) \cdot t_1\right)\right)}^{2}
\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 20.6

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

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

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

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

Alternatives

Alternative 1
Error20.6
Cost39360
\[\begin{array}{l} t_0 := \frac{angle}{180} \cdot \pi\\ {\left(a \cdot \sin t_0\right)}^{2} + {\left(b \cdot \cos t_0\right)}^{2} \end{array} \]
Alternative 2
Error20.6
Cost26240
\[{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {b}^{2} \]
Alternative 3
Error26.0
Cost20416
\[{\left(0 \cdot \left(0.005555555555555556 \cdot a\right) - \left(0.005555555555555556 \cdot a\right) \cdot \left(angle \cdot \left(-\pi\right)\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
Alternative 4
Error26.0
Cost19968
\[{\left(0.005555555555555556 \cdot \left(a \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
Alternative 5
Error26.0
Cost19968
\[{\left(a \cdot \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
Alternative 6
Error26.0
Cost19968
\[{\left(a \cdot \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
Alternative 7
Error26.0
Cost19968
\[{\left(angle \cdot \left(a \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]

Error

Reproduce?

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