| Alternative 1 | |
|---|---|
| Error | 20.2 |
| Cost | 39360 |
\[{\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{\frac{180}{\pi}}\right)\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 (/ 180.0 PI)))) 2.0) (pow (* b (cos (* (/ angle (/ 180.0 (sqrt PI))) (cbrt (pow PI 1.5))))) 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 / (180.0 / ((double) M_PI))))), 2.0) + pow((b * cos(((angle / (180.0 / sqrt(((double) M_PI)))) * cbrt(pow(((double) M_PI), 1.5))))), 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 / (180.0 / Math.PI)))), 2.0) + Math.pow((b * Math.cos(((angle / (180.0 / Math.sqrt(Math.PI))) * Math.cbrt(Math.pow(Math.PI, 1.5))))), 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(180.0 / pi)))) ^ 2.0) + (Float64(b * cos(Float64(Float64(angle / Float64(180.0 / sqrt(pi))) * cbrt((pi ^ 1.5))))) ^ 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[(180.0 / Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[(angle / N[(180.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Power[N[Power[Pi, 1.5], $MachinePrecision], 1/3], $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}
{\left(a \cdot \sin \left(\frac{angle}{\frac{180}{\pi}}\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{\frac{180}{\sqrt{\pi}}} \cdot \sqrt[3]{{\pi}^{1.5}}\right)\right)}^{2}
Results
Initial program 20.2
Simplified20.2
[Start]20.2 | \[ {\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}
\] |
|---|---|
associate-/r/ [<=]20.2 | \[ {\left(a \cdot \sin \color{blue}{\left(\frac{angle}{\frac{180}{\pi}}\right)}\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}
\] |
associate-/r/ [<=]20.2 | \[ {\left(a \cdot \sin \left(\frac{angle}{\frac{180}{\pi}}\right)\right)}^{2} + {\left(b \cdot \cos \color{blue}{\left(\frac{angle}{\frac{180}{\pi}}\right)}\right)}^{2}
\] |
Applied egg-rr20.2
Applied egg-rr20.2
Simplified20.2
[Start]20.2 | \[ {\left(a \cdot \sin \left(\frac{angle}{\frac{180}{\pi}}\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{\frac{180}{\sqrt{\pi}}} \cdot {\left({\pi}^{1.5}\right)}^{0.3333333333333333}\right)\right)}^{2}
\] |
|---|---|
unpow1/3 [=>]20.2 | \[ {\left(a \cdot \sin \left(\frac{angle}{\frac{180}{\pi}}\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{\frac{180}{\sqrt{\pi}}} \cdot \color{blue}{\sqrt[3]{{\pi}^{1.5}}}\right)\right)}^{2}
\] |
Final simplification20.2
| Alternative 1 | |
|---|---|
| Error | 20.2 |
| Cost | 39360 |
| Alternative 2 | |
|---|---|
| Error | 20.2 |
| Cost | 39360 |
| Alternative 3 | |
|---|---|
| Error | 20.2 |
| Cost | 39360 |
| Alternative 4 | |
|---|---|
| Error | 20.2 |
| Cost | 26240 |
| Alternative 5 | |
|---|---|
| Error | 20.1 |
| Cost | 26240 |
| Alternative 6 | |
|---|---|
| Error | 20.2 |
| Cost | 20425 |
| Alternative 7 | |
|---|---|
| Error | 20.3 |
| Cost | 20424 |
| Alternative 8 | |
|---|---|
| Error | 22.2 |
| Cost | 20105 |
| Alternative 9 | |
|---|---|
| Error | 26.0 |
| Cost | 19840 |
| Alternative 10 | |
|---|---|
| Error | 25.8 |
| Cost | 19840 |
| Alternative 11 | |
|---|---|
| Error | 25.8 |
| Cost | 19840 |
| Alternative 12 | |
|---|---|
| Error | 25.8 |
| Cost | 19840 |
| Alternative 13 | |
|---|---|
| Error | 25.8 |
| Cost | 19840 |
herbie shell --seed 2023060
(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)))