| Alternative 1 | |
|---|---|
| Error | 0.6 |
| Cost | 26624 |
\[\begin{array}{l}
t_0 := 0.5 + k \cdot -0.5\\
\frac{{\left(2 \cdot \pi\right)}^{t_0} \cdot {n}^{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 (* (/ (pow (* 2.0 PI) (+ 0.5 (* k -0.5))) (sqrt k)) (sqrt (pow n (- 1.0 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 (pow((2.0 * ((double) M_PI)), (0.5 + (k * -0.5))) / sqrt(k)) * sqrt(pow(n, (1.0 - 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.pow((2.0 * Math.PI), (0.5 + (k * -0.5))) / Math.sqrt(k)) * Math.sqrt(Math.pow(n, (1.0 - 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.pow((2.0 * math.pi), (0.5 + (k * -0.5))) / math.sqrt(k)) * math.sqrt(math.pow(n, (1.0 - 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((Float64(2.0 * pi) ^ Float64(0.5 + Float64(k * -0.5))) / sqrt(k)) * sqrt((n ^ Float64(1.0 - 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 = (((2.0 * pi) ^ (0.5 + (k * -0.5))) / sqrt(k)) * sqrt((n ^ (1.0 - 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[Power[N[(2.0 * Pi), $MachinePrecision], N[(0.5 + N[(k * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Power[n, N[(1.0 - k), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}
\frac{{\left(2 \cdot \pi\right)}^{\left(0.5 + k \cdot -0.5\right)}}{\sqrt{k}} \cdot \sqrt{{n}^{\left(1 - k\right)}}
Results
Initial program 0.5
Applied egg-rr0.7
Simplified0.7
[Start]0.7 | \[ \frac{{\left(2 \cdot \pi\right)}^{\left(0.5 - k \cdot 0.5\right)}}{\frac{\sqrt{k}}{{\left({n}^{\left(1 - k\right)}\right)}^{0.5}}}
\] |
|---|---|
associate-/r/ [=>]0.7 | \[ \color{blue}{\frac{{\left(2 \cdot \pi\right)}^{\left(0.5 - k \cdot 0.5\right)}}{\sqrt{k}} \cdot {\left({n}^{\left(1 - k\right)}\right)}^{0.5}}
\] |
*-commutative [=>]0.7 | \[ \frac{{\left(2 \cdot \pi\right)}^{\left(0.5 - \color{blue}{0.5 \cdot k}\right)}}{\sqrt{k}} \cdot {\left({n}^{\left(1 - k\right)}\right)}^{0.5}
\] |
unpow1/2 [=>]0.7 | \[ \frac{{\left(2 \cdot \pi\right)}^{\left(0.5 - 0.5 \cdot k\right)}}{\sqrt{k}} \cdot \color{blue}{\sqrt{{n}^{\left(1 - k\right)}}}
\] |
Final simplification0.7
| Alternative 1 | |
|---|---|
| Error | 0.6 |
| Cost | 26624 |
| Alternative 2 | |
|---|---|
| Error | 0.5 |
| Cost | 19968 |
| Alternative 3 | |
|---|---|
| Error | 0.5 |
| Cost | 19908 |
| Alternative 4 | |
|---|---|
| Error | 0.5 |
| Cost | 19904 |
| Alternative 5 | |
|---|---|
| Error | 22.7 |
| Cost | 19584 |
| Alternative 6 | |
|---|---|
| Error | 33.0 |
| Cost | 13312 |
| Alternative 7 | |
|---|---|
| Error | 33.6 |
| Cost | 13184 |
| Alternative 8 | |
|---|---|
| Error | 33.6 |
| Cost | 13184 |
herbie shell --seed 2023083
(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))))