| Alternative 1 | |
|---|---|
| Error | 20.9 |
| Cost | 26368 |
\[{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2}
\]
(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 (+ (pow (* a (sin (* angle (* PI 0.005555555555555556)))) 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) {
return pow((a * sin((angle * (((double) M_PI) * 0.005555555555555556)))), 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) {
return Math.pow((a * Math.sin((angle * (Math.PI * 0.005555555555555556)))), 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): return math.pow((a * math.sin((angle * (math.pi * 0.005555555555555556)))), 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) return Float64((Float64(a * sin(Float64(angle * Float64(pi * 0.005555555555555556)))) ^ 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) tmp = ((a * sin((angle * (pi * 0.005555555555555556)))) ^ 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_] := N[(N[Power[N[(a * N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $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}
{\left(a \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2}
Results
Initial program 20.8
Taylor expanded in angle around 0 20.8
Taylor expanded in angle around inf 20.9
Simplified20.8
[Start]20.9 | \[ {\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot 1\right)}^{2}
\] |
|---|---|
rational.json-simplify-43 [=>]20.8 | \[ {\left(a \cdot \sin \color{blue}{\left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)}\right)}^{2} + {\left(b \cdot 1\right)}^{2}
\] |
Final simplification20.8
| Alternative 1 | |
|---|---|
| Error | 20.9 |
| Cost | 26368 |
| Alternative 2 | |
|---|---|
| Error | 26.7 |
| Cost | 19968 |
| Alternative 3 | |
|---|---|
| Error | 26.7 |
| Cost | 19968 |
| Alternative 4 | |
|---|---|
| Error | 26.6 |
| Cost | 19968 |
herbie shell --seed 2023067
(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)))