?

Average Error: 20.3 → 20.3
Time: 28.3s
Precision: binary64
Cost: 66624

?

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

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

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

    [Start]28.4

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

    exponential.json-simplify-27 [=>]20.3

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

    rational.json-simplify-2 [=>]20.3

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

    rational.json-simplify-43 [=>]20.3

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

    rational.json-simplify-2 [=>]20.3

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

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

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

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

Alternatives

Alternative 1
Error20.3
Cost52992
\[{\left(\sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right) \cdot a\right)}^{2} + {\left(b \cdot \left(\frac{1 + \cos \left(\frac{angle}{180} \cdot \left(\pi \cdot 2\right)\right)}{2} \cdot \frac{1}{\cos \left(\frac{angle}{180} \cdot \pi\right)}\right)\right)}^{2} \]
Alternative 2
Error20.3
Cost39360
\[{\left(\sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right) \cdot a\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} \]
Alternative 3
Error20.4
Cost26368
\[{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
Alternative 4
Error20.4
Cost26368
\[{\left(\sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right) \cdot a\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
Alternative 5
Error23.8
Cost20352
\[3.08641975308642 \cdot 10^{-5} \cdot {\left(angle \cdot \left(\left(0 - \left(-1 - \pi \cdot a\right)\right) - 1\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
Alternative 6
Error26.2
Cost19968
\[3.08641975308642 \cdot 10^{-5} \cdot {\left(a \cdot \left(angle \cdot \pi\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]
Alternative 7
Error26.2
Cost19968
\[3.08641975308642 \cdot 10^{-5} \cdot {\left(angle \cdot \left(\pi \cdot a\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2} \]

Error

Reproduce?

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