
(FPCore (k n) :precision binary64 (* (/ 1.0 (sqrt k)) (pow (* (* 2.0 PI) n) (/ (- 1.0 k) 2.0))))
double code(double k, double n) {
return (1.0 / sqrt(k)) * pow(((2.0 * ((double) M_PI)) * n), ((1.0 - k) / 2.0));
}
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));
}
def code(k, n): return (1.0 / math.sqrt(k)) * math.pow(((2.0 * math.pi) * n), ((1.0 - k) / 2.0))
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 tmp = code(k, n) tmp = (1.0 / sqrt(k)) * (((2.0 * pi) * n) ^ ((1.0 - k) / 2.0)); 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]
\begin{array}{l}
\\
\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (k n) :precision binary64 (* (/ 1.0 (sqrt k)) (pow (* (* 2.0 PI) n) (/ (- 1.0 k) 2.0))))
double code(double k, double n) {
return (1.0 / sqrt(k)) * pow(((2.0 * ((double) M_PI)) * n), ((1.0 - k) / 2.0));
}
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));
}
def code(k, n): return (1.0 / math.sqrt(k)) * math.pow(((2.0 * math.pi) * n), ((1.0 - k) / 2.0))
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 tmp = code(k, n) tmp = (1.0 / sqrt(k)) * (((2.0 * pi) * n) ^ ((1.0 - k) / 2.0)); 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]
\begin{array}{l}
\\
\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}
\end{array}
(FPCore (k n) :precision binary64 (let* ((t_0 (* 2.0 (* PI n)))) (/ (* (pow k -0.5) (sqrt t_0)) (pow t_0 (* k 0.5)))))
double code(double k, double n) {
double t_0 = 2.0 * (((double) M_PI) * n);
return (pow(k, -0.5) * sqrt(t_0)) / pow(t_0, (k * 0.5));
}
public static double code(double k, double n) {
double t_0 = 2.0 * (Math.PI * n);
return (Math.pow(k, -0.5) * Math.sqrt(t_0)) / Math.pow(t_0, (k * 0.5));
}
def code(k, n): t_0 = 2.0 * (math.pi * n) return (math.pow(k, -0.5) * math.sqrt(t_0)) / math.pow(t_0, (k * 0.5))
function code(k, n) t_0 = Float64(2.0 * Float64(pi * n)) return Float64(Float64((k ^ -0.5) * sqrt(t_0)) / (t_0 ^ Float64(k * 0.5))) end
function tmp = code(k, n) t_0 = 2.0 * (pi * n); tmp = ((k ^ -0.5) * sqrt(t_0)) / (t_0 ^ (k * 0.5)); end
code[k_, n_] := Block[{t$95$0 = N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Power[k, -0.5], $MachinePrecision] * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision] / N[Power[t$95$0, N[(k * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \left(\pi \cdot n\right)\\
\frac{{k}^{-0.5} \cdot \sqrt{t\_0}}{{t\_0}^{\left(k \cdot 0.5\right)}}
\end{array}
\end{array}
Initial program 99.4%
*-commutative99.4%
associate-*r*99.4%
div-sub99.4%
metadata-eval99.4%
pow-sub99.6%
pow1/299.6%
associate-*r/99.6%
inv-pow99.6%
sqrt-pow299.7%
metadata-eval99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (k n) :precision binary64 (let* ((t_0 (* PI (* 2.0 n)))) (/ (sqrt t_0) (* (sqrt k) (pow t_0 (* k 0.5))))))
double code(double k, double n) {
double t_0 = ((double) M_PI) * (2.0 * n);
return sqrt(t_0) / (sqrt(k) * pow(t_0, (k * 0.5)));
}
public static double code(double k, double n) {
double t_0 = Math.PI * (2.0 * n);
return Math.sqrt(t_0) / (Math.sqrt(k) * Math.pow(t_0, (k * 0.5)));
}
def code(k, n): t_0 = math.pi * (2.0 * n) return math.sqrt(t_0) / (math.sqrt(k) * math.pow(t_0, (k * 0.5)))
function code(k, n) t_0 = Float64(pi * Float64(2.0 * n)) return Float64(sqrt(t_0) / Float64(sqrt(k) * (t_0 ^ Float64(k * 0.5)))) end
function tmp = code(k, n) t_0 = pi * (2.0 * n); tmp = sqrt(t_0) / (sqrt(k) * (t_0 ^ (k * 0.5))); end
code[k_, n_] := Block[{t$95$0 = N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]}, N[(N[Sqrt[t$95$0], $MachinePrecision] / N[(N[Sqrt[k], $MachinePrecision] * N[Power[t$95$0, N[(k * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(2 \cdot n\right)\\
\frac{\sqrt{t\_0}}{\sqrt{k} \cdot {t\_0}^{\left(k \cdot 0.5\right)}}
\end{array}
\end{array}
Initial program 99.4%
associate-/r/99.5%
clear-num99.5%
*-commutative99.5%
associate-*r*99.5%
div-sub99.5%
metadata-eval99.5%
pow-sub99.7%
pow1/299.7%
associate-/l/99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
Applied egg-rr99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
*-commutative99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (k n) :precision binary64 (* (sqrt (/ 1.0 k)) (pow (* n (* 2.0 PI)) (/ (- 1.0 k) 2.0))))
double code(double k, double n) {
return sqrt((1.0 / k)) * pow((n * (2.0 * ((double) M_PI))), ((1.0 - k) / 2.0));
}
public static double code(double k, double n) {
return Math.sqrt((1.0 / k)) * Math.pow((n * (2.0 * Math.PI)), ((1.0 - k) / 2.0));
}
def code(k, n): return math.sqrt((1.0 / k)) * math.pow((n * (2.0 * math.pi)), ((1.0 - k) / 2.0))
function code(k, n) return Float64(sqrt(Float64(1.0 / k)) * (Float64(n * Float64(2.0 * pi)) ^ Float64(Float64(1.0 - k) / 2.0))) end
function tmp = code(k, n) tmp = sqrt((1.0 / k)) * ((n * (2.0 * pi)) ^ ((1.0 - k) / 2.0)); end
code[k_, n_] := N[(N[Sqrt[N[(1.0 / k), $MachinePrecision]], $MachinePrecision] * N[Power[N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - k), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{1}{k}} \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(\frac{1 - k}{2}\right)}
\end{array}
Initial program 99.4%
add-sqr-sqrt46.6%
sqrt-unprod46.7%
frac-times46.8%
metadata-eval46.8%
add-sqr-sqrt46.9%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (k n) :precision binary64 (* (pow k -0.5) (pow (* 2.0 (* PI n)) (+ 0.5 (* k -0.5)))))
double code(double k, double n) {
return pow(k, -0.5) * pow((2.0 * (((double) M_PI) * n)), (0.5 + (k * -0.5)));
}
public static double code(double k, double n) {
return Math.pow(k, -0.5) * Math.pow((2.0 * (Math.PI * n)), (0.5 + (k * -0.5)));
}
def code(k, n): return math.pow(k, -0.5) * math.pow((2.0 * (math.pi * n)), (0.5 + (k * -0.5)))
function code(k, n) return Float64((k ^ -0.5) * (Float64(2.0 * Float64(pi * n)) ^ Float64(0.5 + Float64(k * -0.5)))) end
function tmp = code(k, n) tmp = (k ^ -0.5) * ((2.0 * (pi * n)) ^ (0.5 + (k * -0.5))); end
code[k_, n_] := N[(N[Power[k, -0.5], $MachinePrecision] * N[Power[N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision], N[(0.5 + N[(k * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{k}^{-0.5} \cdot {\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 + k \cdot -0.5\right)}
\end{array}
Initial program 99.4%
associate-*l/99.5%
*-lft-identity99.5%
sqr-pow99.3%
pow-sqr99.5%
*-commutative99.5%
associate-*l*99.5%
associate-*r/99.5%
*-commutative99.5%
associate-/l*99.5%
metadata-eval99.5%
/-rgt-identity99.5%
div-sub99.5%
metadata-eval99.5%
Simplified99.5%
div-inv99.4%
associate-*r*99.4%
*-commutative99.4%
associate-*l*99.4%
sub-neg99.4%
div-inv99.4%
metadata-eval99.4%
distribute-rgt-neg-in99.4%
metadata-eval99.4%
inv-pow99.4%
sqrt-pow299.5%
metadata-eval99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (k n) :precision binary64 (/ (pow (* PI (* 2.0 n)) (- 0.5 (/ k 2.0))) (sqrt k)))
double code(double k, double n) {
return pow((((double) M_PI) * (2.0 * n)), (0.5 - (k / 2.0))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.pow((Math.PI * (2.0 * n)), (0.5 - (k / 2.0))) / Math.sqrt(k);
}
def code(k, n): return math.pow((math.pi * (2.0 * n)), (0.5 - (k / 2.0))) / math.sqrt(k)
function code(k, n) return Float64((Float64(pi * Float64(2.0 * n)) ^ Float64(0.5 - Float64(k / 2.0))) / sqrt(k)) end
function tmp = code(k, n) tmp = ((pi * (2.0 * n)) ^ (0.5 - (k / 2.0))) / sqrt(k); end
code[k_, n_] := N[(N[Power[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision], N[(0.5 - N[(k / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}
\end{array}
Initial program 99.4%
associate-*l/99.5%
*-lft-identity99.5%
sqr-pow99.3%
pow-sqr99.5%
*-commutative99.5%
associate-*l*99.5%
associate-*r/99.5%
*-commutative99.5%
associate-/l*99.5%
metadata-eval99.5%
/-rgt-identity99.5%
div-sub99.5%
metadata-eval99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (k n) :precision binary64 (* (sqrt (/ 1.0 k)) (sqrt (* PI (* 2.0 n)))))
double code(double k, double n) {
return sqrt((1.0 / k)) * sqrt((((double) M_PI) * (2.0 * n)));
}
public static double code(double k, double n) {
return Math.sqrt((1.0 / k)) * Math.sqrt((Math.PI * (2.0 * n)));
}
def code(k, n): return math.sqrt((1.0 / k)) * math.sqrt((math.pi * (2.0 * n)))
function code(k, n) return Float64(sqrt(Float64(1.0 / k)) * sqrt(Float64(pi * Float64(2.0 * n)))) end
function tmp = code(k, n) tmp = sqrt((1.0 / k)) * sqrt((pi * (2.0 * n))); end
code[k_, n_] := N[(N[Sqrt[N[(1.0 / k), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{1}{k}} \cdot \sqrt{\pi \cdot \left(2 \cdot n\right)}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 46.7%
sqrt-unprod46.7%
*-commutative46.7%
associate-*l*46.7%
Applied egg-rr46.7%
add-sqr-sqrt46.6%
sqrt-unprod46.7%
frac-times46.8%
metadata-eval46.8%
add-sqr-sqrt46.9%
Applied egg-rr46.9%
Final simplification46.9%
(FPCore (k n) :precision binary64 (* (pow k -0.5) (sqrt (* PI (* 2.0 n)))))
double code(double k, double n) {
return pow(k, -0.5) * sqrt((((double) M_PI) * (2.0 * n)));
}
public static double code(double k, double n) {
return Math.pow(k, -0.5) * Math.sqrt((Math.PI * (2.0 * n)));
}
def code(k, n): return math.pow(k, -0.5) * math.sqrt((math.pi * (2.0 * n)))
function code(k, n) return Float64((k ^ -0.5) * sqrt(Float64(pi * Float64(2.0 * n)))) end
function tmp = code(k, n) tmp = (k ^ -0.5) * sqrt((pi * (2.0 * n))); end
code[k_, n_] := N[(N[Power[k, -0.5], $MachinePrecision] * N[Sqrt[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{k}^{-0.5} \cdot \sqrt{\pi \cdot \left(2 \cdot n\right)}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 46.7%
sqrt-unprod46.7%
*-commutative46.7%
associate-*l*46.7%
Applied egg-rr46.7%
expm1-log1p-u43.7%
expm1-udef68.5%
inv-pow68.5%
sqrt-pow268.5%
metadata-eval68.5%
Applied egg-rr68.5%
expm1-def43.7%
expm1-log1p46.8%
Simplified46.8%
Final simplification46.8%
(FPCore (k n) :precision binary64 (* (sqrt (* 2.0 (/ PI k))) (sqrt n)))
double code(double k, double n) {
return sqrt((2.0 * (((double) M_PI) / k))) * sqrt(n);
}
public static double code(double k, double n) {
return Math.sqrt((2.0 * (Math.PI / k))) * Math.sqrt(n);
}
def code(k, n): return math.sqrt((2.0 * (math.pi / k))) * math.sqrt(n)
function code(k, n) return Float64(sqrt(Float64(2.0 * Float64(pi / k))) * sqrt(n)) end
function tmp = code(k, n) tmp = sqrt((2.0 * (pi / k))) * sqrt(n); end
code[k_, n_] := N[(N[Sqrt[N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[n], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot \frac{\pi}{k}} \cdot \sqrt{n}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 46.7%
sqrt-unprod46.7%
*-commutative46.7%
associate-*l*46.7%
Applied egg-rr46.7%
associate-*l/46.8%
*-un-lft-identity46.8%
sqrt-div36.7%
expm1-log1p-u34.9%
expm1-udef36.8%
Applied egg-rr36.8%
expm1-def34.9%
expm1-log1p36.7%
associate-/l*36.7%
associate-/r/36.7%
*-commutative36.7%
Simplified36.7%
associate-*r*36.7%
sqrt-prod46.8%
*-commutative46.8%
Applied egg-rr46.8%
Final simplification46.8%
(FPCore (k n) :precision binary64 (* (sqrt (/ PI k)) (sqrt (* 2.0 n))))
double code(double k, double n) {
return sqrt((((double) M_PI) / k)) * sqrt((2.0 * n));
}
public static double code(double k, double n) {
return Math.sqrt((Math.PI / k)) * Math.sqrt((2.0 * n));
}
def code(k, n): return math.sqrt((math.pi / k)) * math.sqrt((2.0 * n))
function code(k, n) return Float64(sqrt(Float64(pi / k)) * sqrt(Float64(2.0 * n))) end
function tmp = code(k, n) tmp = sqrt((pi / k)) * sqrt((2.0 * n)); end
code[k_, n_] := N[(N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{\pi}{k}} \cdot \sqrt{2 \cdot n}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 46.7%
sqrt-unprod46.7%
*-commutative46.7%
associate-*l*46.7%
Applied egg-rr46.7%
associate-*l/46.8%
*-un-lft-identity46.8%
sqrt-div36.7%
expm1-log1p-u34.9%
expm1-udef36.8%
Applied egg-rr36.8%
expm1-def34.9%
expm1-log1p36.7%
associate-/l*36.7%
associate-/r/36.7%
*-commutative36.7%
Simplified36.7%
sqrt-prod46.8%
*-commutative46.8%
Applied egg-rr46.8%
Final simplification46.8%
(FPCore (k n) :precision binary64 (pow (* k (/ (/ 0.5 n) PI)) -0.5))
double code(double k, double n) {
return pow((k * ((0.5 / n) / ((double) M_PI))), -0.5);
}
public static double code(double k, double n) {
return Math.pow((k * ((0.5 / n) / Math.PI)), -0.5);
}
def code(k, n): return math.pow((k * ((0.5 / n) / math.pi)), -0.5)
function code(k, n) return Float64(k * Float64(Float64(0.5 / n) / pi)) ^ -0.5 end
function tmp = code(k, n) tmp = (k * ((0.5 / n) / pi)) ^ -0.5; end
code[k_, n_] := N[Power[N[(k * N[(N[(0.5 / n), $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(k \cdot \frac{\frac{0.5}{n}}{\pi}\right)}^{-0.5}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 46.7%
sqrt-unprod46.7%
*-commutative46.7%
associate-*l*46.7%
Applied egg-rr46.7%
associate-*l/46.8%
*-un-lft-identity46.8%
sqrt-div36.7%
expm1-log1p-u34.9%
expm1-udef36.8%
Applied egg-rr36.8%
expm1-def34.9%
expm1-log1p36.7%
associate-/l*36.7%
associate-/r/36.7%
*-commutative36.7%
Simplified36.7%
sqrt-prod46.8%
clear-num46.8%
sqrt-div46.7%
metadata-eval46.7%
associate-/r/46.7%
sqrt-div37.4%
pow1/237.4%
pow-flip37.5%
div-inv37.4%
clear-num37.4%
associate-*l/37.4%
*-un-lft-identity37.4%
associate-/r*37.4%
metadata-eval37.4%
metadata-eval37.4%
Applied egg-rr37.4%
associate-/r/37.5%
Simplified37.5%
Final simplification37.5%
(FPCore (k n) :precision binary64 (sqrt (* (* 2.0 PI) (/ n k))))
double code(double k, double n) {
return sqrt(((2.0 * ((double) M_PI)) * (n / k)));
}
public static double code(double k, double n) {
return Math.sqrt(((2.0 * Math.PI) * (n / k)));
}
def code(k, n): return math.sqrt(((2.0 * math.pi) * (n / k)))
function code(k, n) return sqrt(Float64(Float64(2.0 * pi) * Float64(n / k))) end
function tmp = code(k, n) tmp = sqrt(((2.0 * pi) * (n / k))); end
code[k_, n_] := N[Sqrt[N[(N[(2.0 * Pi), $MachinePrecision] * N[(n / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\left(2 \cdot \pi\right) \cdot \frac{n}{k}}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 46.7%
sqrt-unprod46.7%
*-commutative46.7%
associate-*l*46.7%
Applied egg-rr46.7%
associate-*l/46.8%
*-un-lft-identity46.8%
sqrt-div36.7%
expm1-log1p-u34.9%
expm1-udef36.8%
Applied egg-rr36.8%
expm1-def34.9%
expm1-log1p36.7%
associate-/l*36.7%
associate-/r/36.7%
*-commutative36.7%
Simplified36.7%
associate-*l/36.7%
*-commutative36.7%
expm1-log1p-u34.9%
expm1-udef36.8%
*-commutative36.8%
associate-*l/36.8%
*-commutative36.8%
associate-*l*36.8%
Applied egg-rr36.8%
expm1-def34.9%
expm1-log1p36.7%
associate-*r*36.7%
*-commutative36.7%
associate-*r*36.7%
associate-*r/36.7%
associate-*r/36.7%
associate-*l/36.7%
Simplified36.7%
Final simplification36.7%
(FPCore (k n) :precision binary64 (sqrt (* (* 2.0 n) (/ PI k))))
double code(double k, double n) {
return sqrt(((2.0 * n) * (((double) M_PI) / k)));
}
public static double code(double k, double n) {
return Math.sqrt(((2.0 * n) * (Math.PI / k)));
}
def code(k, n): return math.sqrt(((2.0 * n) * (math.pi / k)))
function code(k, n) return sqrt(Float64(Float64(2.0 * n) * Float64(pi / k))) end
function tmp = code(k, n) tmp = sqrt(((2.0 * n) * (pi / k))); end
code[k_, n_] := N[Sqrt[N[(N[(2.0 * n), $MachinePrecision] * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\left(2 \cdot n\right) \cdot \frac{\pi}{k}}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 46.7%
sqrt-unprod46.7%
*-commutative46.7%
associate-*l*46.7%
Applied egg-rr46.7%
associate-*l/46.8%
*-un-lft-identity46.8%
sqrt-div36.7%
expm1-log1p-u34.9%
expm1-udef36.8%
Applied egg-rr36.8%
expm1-def34.9%
expm1-log1p36.7%
associate-/l*36.7%
associate-/r/36.7%
*-commutative36.7%
Simplified36.7%
Final simplification36.7%
(FPCore (k n) :precision binary64 (sqrt (/ (* PI (* 2.0 n)) k)))
double code(double k, double n) {
return sqrt(((((double) M_PI) * (2.0 * n)) / k));
}
public static double code(double k, double n) {
return Math.sqrt(((Math.PI * (2.0 * n)) / k));
}
def code(k, n): return math.sqrt(((math.pi * (2.0 * n)) / k))
function code(k, n) return sqrt(Float64(Float64(pi * Float64(2.0 * n)) / k)) end
function tmp = code(k, n) tmp = sqrt(((pi * (2.0 * n)) / k)); end
code[k_, n_] := N[Sqrt[N[(N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{\pi \cdot \left(2 \cdot n\right)}{k}}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 46.7%
sqrt-unprod46.7%
*-commutative46.7%
associate-*l*46.7%
Applied egg-rr46.7%
associate-*l/46.8%
*-un-lft-identity46.8%
sqrt-div36.7%
Applied egg-rr36.7%
Final simplification36.7%
herbie shell --seed 2024033
(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))))