| Alternative 1 | |
|---|---|
| Error | 0.5 |
| Cost | 20032 |
\[\sqrt{\frac{1}{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}
\]
(FPCore (k n) :precision binary64 (* (/ 1.0 (sqrt k)) (pow (* (* 2.0 PI) n) (/ (- 1.0 k) 2.0))))
(FPCore (k n) :precision binary64 (if (<= k 2.8288719500201867e-28) (* (sqrt n) (sqrt (* 2.0 (/ PI k)))) (sqrt (/ (pow (* -2.0 (/ PI (/ -1.0 n))) (- 1.0 k)) 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) {
double tmp;
if (k <= 2.8288719500201867e-28) {
tmp = sqrt(n) * sqrt((2.0 * (((double) M_PI) / k)));
} else {
tmp = sqrt((pow((-2.0 * (((double) M_PI) / (-1.0 / n))), (1.0 - k)) / k));
}
return tmp;
}
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 tmp;
if (k <= 2.8288719500201867e-28) {
tmp = Math.sqrt(n) * Math.sqrt((2.0 * (Math.PI / k)));
} else {
tmp = Math.sqrt((Math.pow((-2.0 * (Math.PI / (-1.0 / n))), (1.0 - k)) / k));
}
return tmp;
}
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): tmp = 0 if k <= 2.8288719500201867e-28: tmp = math.sqrt(n) * math.sqrt((2.0 * (math.pi / k))) else: tmp = math.sqrt((math.pow((-2.0 * (math.pi / (-1.0 / n))), (1.0 - k)) / k)) return tmp
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) tmp = 0.0 if (k <= 2.8288719500201867e-28) tmp = Float64(sqrt(n) * sqrt(Float64(2.0 * Float64(pi / k)))); else tmp = sqrt(Float64((Float64(-2.0 * Float64(pi / Float64(-1.0 / n))) ^ Float64(1.0 - k)) / k)); end return tmp end
function tmp = code(k, n) tmp = (1.0 / sqrt(k)) * (((2.0 * pi) * n) ^ ((1.0 - k) / 2.0)); end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 2.8288719500201867e-28) tmp = sqrt(n) * sqrt((2.0 * (pi / k))); else tmp = sqrt((((-2.0 * (pi / (-1.0 / n))) ^ (1.0 - k)) / k)); end tmp_2 = tmp; 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_] := If[LessEqual[k, 2.8288719500201867e-28], N[(N[Sqrt[n], $MachinePrecision] * N[Sqrt[N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[N[(-2.0 * N[(Pi / N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision] / k), $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}
\mathbf{if}\;k \leq 2.8288719500201867 \cdot 10^{-28}:\\
\;\;\;\;\sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(-2 \cdot \frac{\pi}{\frac{-1}{n}}\right)}^{\left(1 - k\right)}}{k}}\\
\end{array}
Results
if k < 2.8288719500201867e-28Initial program 0.6
Applied egg-rr17.8
Taylor expanded in k around 0 17.8
Simplified17.8
Applied egg-rr17.8
Applied egg-rr0.5
if 2.8288719500201867e-28 < k Initial program 0.4
Applied egg-rr0.6
Taylor expanded in n around -inf 64.0
Simplified0.6
Final simplification0.6
| Alternative 1 | |
|---|---|
| Error | 0.5 |
| Cost | 20032 |
| Alternative 2 | |
|---|---|
| Error | 0.5 |
| Cost | 19968 |
| Alternative 3 | |
|---|---|
| Error | 0.6 |
| Cost | 19908 |
| Alternative 4 | |
|---|---|
| Error | 18.1 |
| Cost | 19844 |
| Alternative 5 | |
|---|---|
| Error | 22.3 |
| Cost | 19584 |
| Alternative 6 | |
|---|---|
| Error | 32.1 |
| Cost | 13248 |
| Alternative 7 | |
|---|---|
| Error | 32.8 |
| Cost | 13184 |
| Alternative 8 | |
|---|---|
| Error | 32.9 |
| Cost | 13184 |
| Alternative 9 | |
|---|---|
| Error | 32.8 |
| Cost | 13184 |

herbie shell --seed 2022313
(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))))