| Alternative 1 | |
|---|---|
| Error | 0.61% |
| Cost | 32896 |
\[\begin{array}{l}
t_0 := \pi \cdot \left(n \cdot 2\right)\\
\frac{\sqrt{t_0} \cdot {t_0}^{\left(k \cdot -0.5\right)}}{\sqrt{k}}
\end{array}
\]
(FPCore (k n) :precision binary64 (* (/ 1.0 (sqrt k)) (pow (* (* 2.0 PI) n) (/ (- 1.0 k) 2.0))))
(FPCore (k n) :precision binary64 (let* ((t_0 (* n (* 2.0 PI)))) (* (/ (sqrt t_0) (pow t_0 (* 0.5 k))) (pow k -0.5))))
double code(double k, double n) {
return (1.0 / sqrt(k)) * pow(((2.0 * ((double) M_PI)) * n), ((1.0 - k) / 2.0));
}
double code(double k, double n) {
double t_0 = n * (2.0 * ((double) M_PI));
return (sqrt(t_0) / pow(t_0, (0.5 * k))) * pow(k, -0.5);
}
public static double code(double k, double n) {
return (1.0 / Math.sqrt(k)) * Math.pow(((2.0 * Math.PI) * n), ((1.0 - k) / 2.0));
}
public static double code(double k, double n) {
double t_0 = n * (2.0 * Math.PI);
return (Math.sqrt(t_0) / Math.pow(t_0, (0.5 * k))) * Math.pow(k, -0.5);
}
def code(k, n): return (1.0 / math.sqrt(k)) * math.pow(((2.0 * math.pi) * n), ((1.0 - k) / 2.0))
def code(k, n): t_0 = n * (2.0 * math.pi) return (math.sqrt(t_0) / math.pow(t_0, (0.5 * k))) * math.pow(k, -0.5)
function code(k, n) return Float64(Float64(1.0 / sqrt(k)) * (Float64(Float64(2.0 * pi) * n) ^ Float64(Float64(1.0 - k) / 2.0))) end
function code(k, n) t_0 = Float64(n * Float64(2.0 * pi)) return Float64(Float64(sqrt(t_0) / (t_0 ^ Float64(0.5 * k))) * (k ^ -0.5)) end
function tmp = code(k, n) tmp = (1.0 / sqrt(k)) * (((2.0 * pi) * n) ^ ((1.0 - k) / 2.0)); end
function tmp = code(k, n) t_0 = n * (2.0 * pi); tmp = (sqrt(t_0) / (t_0 ^ (0.5 * k))) * (k ^ -0.5); end
code[k_, n_] := N[(N[(1.0 / N[Sqrt[k], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(2.0 * Pi), $MachinePrecision] * n), $MachinePrecision], N[(N[(1.0 - k), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[k_, n_] := Block[{t$95$0 = N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Sqrt[t$95$0], $MachinePrecision] / N[Power[t$95$0, N[(0.5 * k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Power[k, -0.5], $MachinePrecision]), $MachinePrecision]]
\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}
\begin{array}{l}
t_0 := n \cdot \left(2 \cdot \pi\right)\\
\frac{\sqrt{t_0}}{{t_0}^{\left(0.5 \cdot k\right)}} \cdot {k}^{-0.5}
\end{array}
Results
Initial program 0.78
Applied egg-rr0.61
Simplified0.61
[Start]0.61 | \[ \frac{\sqrt{2 \cdot \left(\pi \cdot n\right)} \cdot {k}^{-0.5}}{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(k \cdot 0.5\right)}}
\] |
|---|---|
associate-/l* [=>]0.67 | \[ \color{blue}{\frac{\sqrt{2 \cdot \left(\pi \cdot n\right)}}{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(k \cdot 0.5\right)}}{{k}^{-0.5}}}}
\] |
associate-/r/ [=>]0.61 | \[ \color{blue}{\frac{\sqrt{2 \cdot \left(\pi \cdot n\right)}}{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(k \cdot 0.5\right)}} \cdot {k}^{-0.5}}
\] |
associate-*r* [=>]0.61 | \[ \frac{\sqrt{\color{blue}{\left(2 \cdot \pi\right) \cdot n}}}{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(k \cdot 0.5\right)}} \cdot {k}^{-0.5}
\] |
*-commutative [=>]0.61 | \[ \frac{\sqrt{\color{blue}{n \cdot \left(2 \cdot \pi\right)}}}{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(k \cdot 0.5\right)}} \cdot {k}^{-0.5}
\] |
associate-*r* [=>]0.61 | \[ \frac{\sqrt{n \cdot \left(2 \cdot \pi\right)}}{{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot n\right)}}^{\left(k \cdot 0.5\right)}} \cdot {k}^{-0.5}
\] |
*-commutative [=>]0.61 | \[ \frac{\sqrt{n \cdot \left(2 \cdot \pi\right)}}{{\color{blue}{\left(n \cdot \left(2 \cdot \pi\right)\right)}}^{\left(k \cdot 0.5\right)}} \cdot {k}^{-0.5}
\] |
*-commutative [=>]0.61 | \[ \frac{\sqrt{n \cdot \left(2 \cdot \pi\right)}}{{\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\color{blue}{\left(0.5 \cdot k\right)}}} \cdot {k}^{-0.5}
\] |
Final simplification0.61
| Alternative 1 | |
|---|---|
| Error | 0.61% |
| Cost | 32896 |
| Alternative 2 | |
|---|---|
| Error | 0.61% |
| Cost | 32896 |
| Alternative 3 | |
|---|---|
| Error | 0.77% |
| Cost | 20032 |
| Alternative 4 | |
|---|---|
| Error | 0.71% |
| Cost | 19968 |
| Alternative 5 | |
|---|---|
| Error | 1.21% |
| Cost | 19908 |
| Alternative 6 | |
|---|---|
| Error | 0.71% |
| Cost | 19904 |
| Alternative 7 | |
|---|---|
| Error | 33.43% |
| Cost | 19844 |
| Alternative 8 | |
|---|---|
| Error | 33.43% |
| Cost | 19780 |
| Alternative 9 | |
|---|---|
| Error | 33.43% |
| Cost | 19780 |
| Alternative 10 | |
|---|---|
| Error | 35.16% |
| Cost | 19584 |
| Alternative 11 | |
|---|---|
| Error | 35.07% |
| Cost | 19584 |
| Alternative 12 | |
|---|---|
| Error | 35.02% |
| Cost | 19584 |
| Alternative 13 | |
|---|---|
| Error | 49.84% |
| Cost | 13312 |
| Alternative 14 | |
|---|---|
| Error | 49.82% |
| Cost | 13312 |
| Alternative 15 | |
|---|---|
| Error | 50.61% |
| Cost | 13184 |
| Alternative 16 | |
|---|---|
| Error | 50.57% |
| Cost | 13184 |
herbie shell --seed 2023102
(FPCore (k n)
:name "Migdal et al, Equation (51)"
:precision binary64
(* (/ 1.0 (sqrt k)) (pow (* (* 2.0 PI) n) (/ (- 1.0 k) 2.0))))