| Alternative 1 | |
|---|---|
| Error | 0.6 |
| Cost | 26624 |
\[\begin{array}{l}
t_0 := 0.5 + k \cdot -0.5\\
{\pi}^{t_0} \cdot \frac{{\left(n \cdot 2\right)}^{t_0}}{\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 (/ (/ (sqrt (* n 2.0)) (/ (pow (* n 2.0) (* 0.5 k)) (pow PI (+ 0.5 (* k -0.5))))) (sqrt k)))
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) {
return (sqrt((n * 2.0)) / (pow((n * 2.0), (0.5 * k)) / pow(((double) M_PI), (0.5 + (k * -0.5))))) / sqrt(k);
}
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) {
return (Math.sqrt((n * 2.0)) / (Math.pow((n * 2.0), (0.5 * k)) / Math.pow(Math.PI, (0.5 + (k * -0.5))))) / Math.sqrt(k);
}
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): return (math.sqrt((n * 2.0)) / (math.pow((n * 2.0), (0.5 * k)) / math.pow(math.pi, (0.5 + (k * -0.5))))) / math.sqrt(k)
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) return Float64(Float64(sqrt(Float64(n * 2.0)) / Float64((Float64(n * 2.0) ^ Float64(0.5 * k)) / (pi ^ Float64(0.5 + Float64(k * -0.5))))) / sqrt(k)) 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) tmp = (sqrt((n * 2.0)) / (((n * 2.0) ^ (0.5 * k)) / (pi ^ (0.5 + (k * -0.5))))) / sqrt(k); 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_] := N[(N[(N[Sqrt[N[(n * 2.0), $MachinePrecision]], $MachinePrecision] / N[(N[Power[N[(n * 2.0), $MachinePrecision], N[(0.5 * k), $MachinePrecision]], $MachinePrecision] / N[Power[Pi, N[(0.5 + N[(k * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}
\frac{\frac{\sqrt{n \cdot 2}}{\frac{{\left(n \cdot 2\right)}^{\left(0.5 \cdot k\right)}}{{\pi}^{\left(0.5 + k \cdot -0.5\right)}}}}{\sqrt{k}}
Results
Initial program 0.5
Simplified0.5
[Start]0.5 | \[ \frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}
\] |
|---|---|
associate-*l/ [=>]0.5 | \[ \color{blue}{\frac{1 \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}}
\] |
*-lft-identity [=>]0.5 | \[ \frac{\color{blue}{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}}}{\sqrt{k}}
\] |
sqr-pow [=>]0.6 | \[ \frac{\color{blue}{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{\frac{1 - k}{2}}{2}\right)} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{\frac{1 - k}{2}}{2}\right)}}}{\sqrt{k}}
\] |
sqr-pow [<=]0.5 | \[ \frac{\color{blue}{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}}}{\sqrt{k}}
\] |
*-commutative [=>]0.5 | \[ \frac{{\left(\color{blue}{\left(\pi \cdot 2\right)} \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}
\] |
associate-*l* [=>]0.5 | \[ \frac{{\color{blue}{\left(\pi \cdot \left(2 \cdot n\right)\right)}}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}
\] |
div-sub [=>]0.5 | \[ \frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\color{blue}{\left(\frac{1}{2} - \frac{k}{2}\right)}}}{\sqrt{k}}
\] |
metadata-eval [=>]0.5 | \[ \frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\color{blue}{0.5} - \frac{k}{2}\right)}}{\sqrt{k}}
\] |
Applied egg-rr0.5
Simplified0.4
[Start]0.5 | \[ \frac{\frac{\sqrt{2 \cdot n} \cdot {\pi}^{\left(0.5 + k \cdot -0.5\right)}}{{\left(2 \cdot n\right)}^{\left(0.5 \cdot k\right)}}}{\sqrt{k}}
\] |
|---|---|
associate-/l* [=>]0.4 | \[ \frac{\color{blue}{\frac{\sqrt{2 \cdot n}}{\frac{{\left(2 \cdot n\right)}^{\left(0.5 \cdot k\right)}}{{\pi}^{\left(0.5 + k \cdot -0.5\right)}}}}}{\sqrt{k}}
\] |
*-commutative [=>]0.4 | \[ \frac{\frac{\sqrt{\color{blue}{n \cdot 2}}}{\frac{{\left(2 \cdot n\right)}^{\left(0.5 \cdot k\right)}}{{\pi}^{\left(0.5 + k \cdot -0.5\right)}}}}{\sqrt{k}}
\] |
*-commutative [=>]0.4 | \[ \frac{\frac{\sqrt{n \cdot 2}}{\frac{{\color{blue}{\left(n \cdot 2\right)}}^{\left(0.5 \cdot k\right)}}{{\pi}^{\left(0.5 + k \cdot -0.5\right)}}}}{\sqrt{k}}
\] |
Final simplification0.4
| Alternative 1 | |
|---|---|
| Error | 0.6 |
| Cost | 26624 |
| Alternative 2 | |
|---|---|
| Error | 0.6 |
| Cost | 19908 |
| Alternative 3 | |
|---|---|
| Error | 0.5 |
| Cost | 19904 |
| Alternative 4 | |
|---|---|
| Error | 20.8 |
| Cost | 19844 |
| Alternative 5 | |
|---|---|
| Error | 20.8 |
| Cost | 19780 |
| Alternative 6 | |
|---|---|
| Error | 21.7 |
| Cost | 19584 |
| Alternative 7 | |
|---|---|
| Error | 31.2 |
| Cost | 13312 |
| Alternative 8 | |
|---|---|
| Error | 31.7 |
| Cost | 13184 |
| Alternative 9 | |
|---|---|
| Error | 31.7 |
| Cost | 13184 |
herbie shell --seed 2023073
(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))))