| Alternative 1 | |
|---|---|
| Error | 20.4 |
| Cost | 58624 |
\[{\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(a \cdot \cos \left(\sqrt{\pi} \cdot \left(\frac{\sqrt{\pi}}{180} \cdot angle\right)\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 (cos (* (* (sqrt PI) (/ (sqrt PI) 180.0)) angle))) 2.0) (pow (* b (sin (* PI (/ angle 180.0)))) 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 * cos(((sqrt(((double) M_PI)) * (sqrt(((double) M_PI)) / 180.0)) * angle))), 2.0) + pow((b * sin((((double) M_PI) * (angle / 180.0)))), 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 * Math.cos(((Math.sqrt(Math.PI) * (Math.sqrt(Math.PI) / 180.0)) * angle))), 2.0) + Math.pow((b * Math.sin((Math.PI * (angle / 180.0)))), 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 * math.cos(((math.sqrt(math.pi) * (math.sqrt(math.pi) / 180.0)) * angle))), 2.0) + math.pow((b * math.sin((math.pi * (angle / 180.0)))), 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((Float64(a * cos(Float64(Float64(sqrt(pi) * Float64(sqrt(pi) / 180.0)) * angle))) ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 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 * cos(((sqrt(pi) * (sqrt(pi) / 180.0)) * angle))) ^ 2.0) + ((b * sin((pi * (angle / 180.0)))) ^ 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[N[(a * N[Cos[N[(N[(N[Sqrt[Pi], $MachinePrecision] * N[(N[Sqrt[Pi], $MachinePrecision] / 180.0), $MachinePrecision]), $MachinePrecision] * angle), $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]
{\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}
{\left(a \cdot \cos \left(\left(\sqrt{\pi} \cdot \frac{\sqrt{\pi}}{180}\right) \cdot angle\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2}
Results
Initial program 20.4
Applied egg-rr20.4
Simplified20.4
[Start]20.4 | \[ {\left(a \cdot \cos \left(\frac{\sqrt{\pi}}{\frac{\frac{180}{angle}}{\sqrt{\pi}}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2}
\] |
|---|---|
associate-/l/ [=>]20.4 | \[ {\left(a \cdot \cos \left(\frac{\sqrt{\pi}}{\color{blue}{\frac{180}{\sqrt{\pi} \cdot angle}}}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2}
\] |
associate-/r/ [=>]20.4 | \[ {\left(a \cdot \cos \color{blue}{\left(\frac{\sqrt{\pi}}{180} \cdot \left(\sqrt{\pi} \cdot angle\right)\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2}
\] |
associate-*r* [=>]20.4 | \[ {\left(a \cdot \cos \color{blue}{\left(\left(\frac{\sqrt{\pi}}{180} \cdot \sqrt{\pi}\right) \cdot angle\right)}\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2}
\] |
Final simplification20.4
| Alternative 1 | |
|---|---|
| Error | 20.4 |
| Cost | 58624 |
| Alternative 2 | |
|---|---|
| Error | 20.4 |
| Cost | 52288 |
| Alternative 3 | |
|---|---|
| Error | 20.4 |
| Cost | 39360 |
| Alternative 4 | |
|---|---|
| Error | 20.4 |
| Cost | 26368 |
| Alternative 5 | |
|---|---|
| Error | 20.4 |
| Cost | 26240 |
| Alternative 6 | |
|---|---|
| Error | 20.8 |
| Cost | 20489 |
| Alternative 7 | |
|---|---|
| Error | 20.9 |
| Cost | 20425 |
| Alternative 8 | |
|---|---|
| Error | 20.9 |
| Cost | 20425 |
| Alternative 9 | |
|---|---|
| Error | 26.0 |
| Cost | 19840 |
| Alternative 10 | |
|---|---|
| Error | 26.1 |
| Cost | 19840 |
herbie shell --seed 2023083
(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)))