Migdal et al, Equation (51)

Percentage Accurate: 99.4% → 99.2%
Time: 11.9s
Alternatives: 8
Speedup: 1.0×

Specification

?
\[\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
 (* (/ 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:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 8 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.4% accurate, 1.0× speedup?

\[\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
 (* (/ 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}

Alternative 1: 99.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;k \leq 4 \cdot 10^{-48}:\\ \;\;\;\;\frac{\sqrt{\pi \cdot \left(2 \cdot n\right)}}{\sqrt{k}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)} \cdot \frac{1}{k}}\\ \end{array} \end{array} \]
(FPCore (k n)
 :precision binary64
 (if (<= k 4e-48)
   (/ (sqrt (* PI (* 2.0 n))) (sqrt k))
   (sqrt (* (pow (* 2.0 (* PI n)) (- 1.0 k)) (/ 1.0 k)))))
double code(double k, double n) {
	double tmp;
	if (k <= 4e-48) {
		tmp = sqrt((((double) M_PI) * (2.0 * n))) / sqrt(k);
	} else {
		tmp = sqrt((pow((2.0 * (((double) M_PI) * n)), (1.0 - k)) * (1.0 / k)));
	}
	return tmp;
}
public static double code(double k, double n) {
	double tmp;
	if (k <= 4e-48) {
		tmp = Math.sqrt((Math.PI * (2.0 * n))) / Math.sqrt(k);
	} else {
		tmp = Math.sqrt((Math.pow((2.0 * (Math.PI * n)), (1.0 - k)) * (1.0 / k)));
	}
	return tmp;
}
def code(k, n):
	tmp = 0
	if k <= 4e-48:
		tmp = math.sqrt((math.pi * (2.0 * n))) / math.sqrt(k)
	else:
		tmp = math.sqrt((math.pow((2.0 * (math.pi * n)), (1.0 - k)) * (1.0 / k)))
	return tmp
function code(k, n)
	tmp = 0.0
	if (k <= 4e-48)
		tmp = Float64(sqrt(Float64(pi * Float64(2.0 * n))) / sqrt(k));
	else
		tmp = sqrt(Float64((Float64(2.0 * Float64(pi * n)) ^ Float64(1.0 - k)) * Float64(1.0 / k)));
	end
	return tmp
end
function tmp_2 = code(k, n)
	tmp = 0.0;
	if (k <= 4e-48)
		tmp = sqrt((pi * (2.0 * n))) / sqrt(k);
	else
		tmp = sqrt((((2.0 * (pi * n)) ^ (1.0 - k)) * (1.0 / k)));
	end
	tmp_2 = tmp;
end
code[k_, n_] := If[LessEqual[k, 4e-48], N[(N[Sqrt[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision] * N[(1.0 / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;k \leq 4 \cdot 10^{-48}:\\
\;\;\;\;\frac{\sqrt{\pi \cdot \left(2 \cdot n\right)}}{\sqrt{k}}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)} \cdot \frac{1}{k}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if k < 3.9999999999999999e-48

    1. Initial program 99.3%

      \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    2. Step-by-step derivation
      1. *-commutative99.3%

        \[\leadsto \color{blue}{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}}} \]
      2. *-commutative99.3%

        \[\leadsto {\left(\color{blue}{\left(\pi \cdot 2\right)} \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}} \]
      3. associate-*r*99.3%

        \[\leadsto {\color{blue}{\left(\pi \cdot \left(2 \cdot n\right)\right)}}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}} \]
      4. div-inv99.5%

        \[\leadsto \color{blue}{\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}} \]
      5. expm1-log1p-u93.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}\right)\right)} \]
      6. expm1-udef77.0%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}\right)} - 1} \]
    3. Applied egg-rr47.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)} - 1} \]
    4. Step-by-step derivation
      1. expm1-def63.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)\right)} \]
      2. expm1-log1p66.3%

        \[\leadsto \color{blue}{\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}} \]
      3. associate-*r*66.3%

        \[\leadsto \sqrt{\frac{{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot n\right)}}^{\left(1 - k\right)}}{k}} \]
    5. Simplified66.3%

      \[\leadsto \color{blue}{\sqrt{\frac{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(1 - k\right)}}{k}}} \]
    6. Taylor expanded in k around 0 66.3%

      \[\leadsto \sqrt{\color{blue}{2 \cdot \frac{n \cdot \pi}{k}}} \]
    7. Step-by-step derivation
      1. associate-/l*66.4%

        \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{n}{\frac{k}{\pi}}}} \]
      2. associate-/r/66.4%

        \[\leadsto \sqrt{2 \cdot \color{blue}{\left(\frac{n}{k} \cdot \pi\right)}} \]
    8. Simplified66.4%

      \[\leadsto \sqrt{\color{blue}{2 \cdot \left(\frac{n}{k} \cdot \pi\right)}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u63.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2 \cdot \left(\frac{n}{k} \cdot \pi\right)}\right)\right)} \]
      2. expm1-udef47.2%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{2 \cdot \left(\frac{n}{k} \cdot \pi\right)}\right)} - 1} \]
      3. *-commutative47.2%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{2 \cdot \color{blue}{\left(\pi \cdot \frac{n}{k}\right)}}\right)} - 1 \]
    10. Applied egg-rr47.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}\right)} - 1} \]
    11. Step-by-step derivation
      1. expm1-def63.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}\right)\right)} \]
      2. expm1-log1p66.4%

        \[\leadsto \color{blue}{\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}} \]
      3. associate-*r/66.3%

        \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{\pi \cdot n}{k}}} \]
      4. *-commutative66.3%

        \[\leadsto \sqrt{2 \cdot \frac{\color{blue}{n \cdot \pi}}{k}} \]
      5. associate-*r/66.3%

        \[\leadsto \sqrt{\color{blue}{\frac{2 \cdot \left(n \cdot \pi\right)}{k}}} \]
    12. Simplified66.3%

      \[\leadsto \color{blue}{\sqrt{\frac{2 \cdot \left(n \cdot \pi\right)}{k}}} \]
    13. Step-by-step derivation
      1. sqrt-div99.5%

        \[\leadsto \color{blue}{\frac{\sqrt{2 \cdot \left(n \cdot \pi\right)}}{\sqrt{k}}} \]
      2. associate-*r*99.5%

        \[\leadsto \frac{\sqrt{\color{blue}{\left(2 \cdot n\right) \cdot \pi}}}{\sqrt{k}} \]
    14. Applied egg-rr99.5%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(2 \cdot n\right) \cdot \pi}}{\sqrt{k}}} \]

    if 3.9999999999999999e-48 < k

    1. Initial program 99.8%

      \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    2. Step-by-step derivation
      1. *-commutative99.8%

        \[\leadsto \color{blue}{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}}} \]
      2. *-commutative99.8%

        \[\leadsto {\left(\color{blue}{\left(\pi \cdot 2\right)} \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}} \]
      3. associate-*r*99.8%

        \[\leadsto {\color{blue}{\left(\pi \cdot \left(2 \cdot n\right)\right)}}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}} \]
      4. div-inv99.8%

        \[\leadsto \color{blue}{\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}} \]
      5. expm1-log1p-u99.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}\right)\right)} \]
      6. expm1-udef93.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}\right)} - 1} \]
    3. Applied egg-rr93.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)} - 1} \]
    4. Step-by-step derivation
      1. expm1-def99.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)\right)} \]
      2. expm1-log1p99.8%

        \[\leadsto \color{blue}{\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}} \]
      3. associate-*r*99.8%

        \[\leadsto \sqrt{\frac{{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot n\right)}}^{\left(1 - k\right)}}{k}} \]
    5. Simplified99.8%

      \[\leadsto \color{blue}{\sqrt{\frac{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(1 - k\right)}}{k}}} \]
    6. Step-by-step derivation
      1. div-inv99.8%

        \[\leadsto \sqrt{\color{blue}{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(1 - k\right)} \cdot \frac{1}{k}}} \]
      2. associate-*r*99.8%

        \[\leadsto \sqrt{{\color{blue}{\left(2 \cdot \left(\pi \cdot n\right)\right)}}^{\left(1 - k\right)} \cdot \frac{1}{k}} \]
    7. Applied egg-rr99.8%

      \[\leadsto \sqrt{\color{blue}{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)} \cdot \frac{1}{k}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 4 \cdot 10^{-48}:\\ \;\;\;\;\frac{\sqrt{\pi \cdot \left(2 \cdot n\right)}}{\sqrt{k}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)} \cdot \frac{1}{k}}\\ \end{array} \]

Alternative 2: 99.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;k \leq 4 \cdot 10^{-48}:\\ \;\;\;\;\frac{\sqrt{\pi \cdot \left(2 \cdot n\right)}}{\sqrt{k}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{{\left(n \cdot \left(\pi \cdot 2\right)\right)}^{\left(1 - k\right)}}{k}}\\ \end{array} \end{array} \]
(FPCore (k n)
 :precision binary64
 (if (<= k 4e-48)
   (/ (sqrt (* PI (* 2.0 n))) (sqrt k))
   (sqrt (/ (pow (* n (* PI 2.0)) (- 1.0 k)) k))))
double code(double k, double n) {
	double tmp;
	if (k <= 4e-48) {
		tmp = sqrt((((double) M_PI) * (2.0 * n))) / sqrt(k);
	} else {
		tmp = sqrt((pow((n * (((double) M_PI) * 2.0)), (1.0 - k)) / k));
	}
	return tmp;
}
public static double code(double k, double n) {
	double tmp;
	if (k <= 4e-48) {
		tmp = Math.sqrt((Math.PI * (2.0 * n))) / Math.sqrt(k);
	} else {
		tmp = Math.sqrt((Math.pow((n * (Math.PI * 2.0)), (1.0 - k)) / k));
	}
	return tmp;
}
def code(k, n):
	tmp = 0
	if k <= 4e-48:
		tmp = math.sqrt((math.pi * (2.0 * n))) / math.sqrt(k)
	else:
		tmp = math.sqrt((math.pow((n * (math.pi * 2.0)), (1.0 - k)) / k))
	return tmp
function code(k, n)
	tmp = 0.0
	if (k <= 4e-48)
		tmp = Float64(sqrt(Float64(pi * Float64(2.0 * n))) / sqrt(k));
	else
		tmp = sqrt(Float64((Float64(n * Float64(pi * 2.0)) ^ Float64(1.0 - k)) / k));
	end
	return tmp
end
function tmp_2 = code(k, n)
	tmp = 0.0;
	if (k <= 4e-48)
		tmp = sqrt((pi * (2.0 * n))) / sqrt(k);
	else
		tmp = sqrt((((n * (pi * 2.0)) ^ (1.0 - k)) / k));
	end
	tmp_2 = tmp;
end
code[k_, n_] := If[LessEqual[k, 4e-48], N[(N[Sqrt[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;k \leq 4 \cdot 10^{-48}:\\
\;\;\;\;\frac{\sqrt{\pi \cdot \left(2 \cdot n\right)}}{\sqrt{k}}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(n \cdot \left(\pi \cdot 2\right)\right)}^{\left(1 - k\right)}}{k}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if k < 3.9999999999999999e-48

    1. Initial program 99.3%

      \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    2. Step-by-step derivation
      1. *-commutative99.3%

        \[\leadsto \color{blue}{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}}} \]
      2. *-commutative99.3%

        \[\leadsto {\left(\color{blue}{\left(\pi \cdot 2\right)} \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}} \]
      3. associate-*r*99.3%

        \[\leadsto {\color{blue}{\left(\pi \cdot \left(2 \cdot n\right)\right)}}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}} \]
      4. div-inv99.5%

        \[\leadsto \color{blue}{\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}} \]
      5. expm1-log1p-u93.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}\right)\right)} \]
      6. expm1-udef77.0%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}\right)} - 1} \]
    3. Applied egg-rr47.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)} - 1} \]
    4. Step-by-step derivation
      1. expm1-def63.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)\right)} \]
      2. expm1-log1p66.3%

        \[\leadsto \color{blue}{\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}} \]
      3. associate-*r*66.3%

        \[\leadsto \sqrt{\frac{{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot n\right)}}^{\left(1 - k\right)}}{k}} \]
    5. Simplified66.3%

      \[\leadsto \color{blue}{\sqrt{\frac{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(1 - k\right)}}{k}}} \]
    6. Taylor expanded in k around 0 66.3%

      \[\leadsto \sqrt{\color{blue}{2 \cdot \frac{n \cdot \pi}{k}}} \]
    7. Step-by-step derivation
      1. associate-/l*66.4%

        \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{n}{\frac{k}{\pi}}}} \]
      2. associate-/r/66.4%

        \[\leadsto \sqrt{2 \cdot \color{blue}{\left(\frac{n}{k} \cdot \pi\right)}} \]
    8. Simplified66.4%

      \[\leadsto \sqrt{\color{blue}{2 \cdot \left(\frac{n}{k} \cdot \pi\right)}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u63.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2 \cdot \left(\frac{n}{k} \cdot \pi\right)}\right)\right)} \]
      2. expm1-udef47.2%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{2 \cdot \left(\frac{n}{k} \cdot \pi\right)}\right)} - 1} \]
      3. *-commutative47.2%

        \[\leadsto e^{\mathsf{log1p}\left(\sqrt{2 \cdot \color{blue}{\left(\pi \cdot \frac{n}{k}\right)}}\right)} - 1 \]
    10. Applied egg-rr47.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}\right)} - 1} \]
    11. Step-by-step derivation
      1. expm1-def63.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}\right)\right)} \]
      2. expm1-log1p66.4%

        \[\leadsto \color{blue}{\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}} \]
      3. associate-*r/66.3%

        \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{\pi \cdot n}{k}}} \]
      4. *-commutative66.3%

        \[\leadsto \sqrt{2 \cdot \frac{\color{blue}{n \cdot \pi}}{k}} \]
      5. associate-*r/66.3%

        \[\leadsto \sqrt{\color{blue}{\frac{2 \cdot \left(n \cdot \pi\right)}{k}}} \]
    12. Simplified66.3%

      \[\leadsto \color{blue}{\sqrt{\frac{2 \cdot \left(n \cdot \pi\right)}{k}}} \]
    13. Step-by-step derivation
      1. sqrt-div99.5%

        \[\leadsto \color{blue}{\frac{\sqrt{2 \cdot \left(n \cdot \pi\right)}}{\sqrt{k}}} \]
      2. associate-*r*99.5%

        \[\leadsto \frac{\sqrt{\color{blue}{\left(2 \cdot n\right) \cdot \pi}}}{\sqrt{k}} \]
    14. Applied egg-rr99.5%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(2 \cdot n\right) \cdot \pi}}{\sqrt{k}}} \]

    if 3.9999999999999999e-48 < k

    1. Initial program 99.8%

      \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    2. Step-by-step derivation
      1. *-commutative99.8%

        \[\leadsto \color{blue}{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}}} \]
      2. *-commutative99.8%

        \[\leadsto {\left(\color{blue}{\left(\pi \cdot 2\right)} \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}} \]
      3. associate-*r*99.8%

        \[\leadsto {\color{blue}{\left(\pi \cdot \left(2 \cdot n\right)\right)}}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}} \]
      4. div-inv99.8%

        \[\leadsto \color{blue}{\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}} \]
      5. expm1-log1p-u99.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}\right)\right)} \]
      6. expm1-udef93.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}\right)} - 1} \]
    3. Applied egg-rr93.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)} - 1} \]
    4. Step-by-step derivation
      1. expm1-def99.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)\right)} \]
      2. expm1-log1p99.8%

        \[\leadsto \color{blue}{\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}} \]
      3. associate-*r*99.8%

        \[\leadsto \sqrt{\frac{{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot n\right)}}^{\left(1 - k\right)}}{k}} \]
    5. Simplified99.8%

      \[\leadsto \color{blue}{\sqrt{\frac{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(1 - k\right)}}{k}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 4 \cdot 10^{-48}:\\ \;\;\;\;\frac{\sqrt{\pi \cdot \left(2 \cdot n\right)}}{\sqrt{k}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{{\left(n \cdot \left(\pi \cdot 2\right)\right)}^{\left(1 - k\right)}}{k}}\\ \end{array} \]

Alternative 3: 99.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}} \end{array} \]
(FPCore (k n)
 :precision binary64
 (/ (pow (* PI (* 2.0 n)) (/ (- 1.0 k) 2.0)) (sqrt k)))
double code(double k, double n) {
	return pow((((double) M_PI) * (2.0 * n)), ((1.0 - k) / 2.0)) / sqrt(k);
}
public static double code(double k, double n) {
	return Math.pow((Math.PI * (2.0 * n)), ((1.0 - k) / 2.0)) / Math.sqrt(k);
}
def code(k, n):
	return math.pow((math.pi * (2.0 * n)), ((1.0 - k) / 2.0)) / math.sqrt(k)
function code(k, n)
	return Float64((Float64(pi * Float64(2.0 * n)) ^ Float64(Float64(1.0 - k) / 2.0)) / sqrt(k))
end
function tmp = code(k, n)
	tmp = ((pi * (2.0 * n)) ^ ((1.0 - k) / 2.0)) / sqrt(k);
end
code[k_, n_] := N[(N[Power[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - k), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Step-by-step derivation
    1. associate-*l/99.7%

      \[\leadsto \color{blue}{\frac{1 \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}} \]
    2. *-lft-identity99.7%

      \[\leadsto \frac{\color{blue}{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}}}{\sqrt{k}} \]
    3. *-commutative99.7%

      \[\leadsto \frac{{\left(\color{blue}{\left(\pi \cdot 2\right)} \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}} \]
    4. associate-*l*99.7%

      \[\leadsto \frac{{\color{blue}{\left(\pi \cdot \left(2 \cdot n\right)\right)}}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}} \]
  3. Simplified99.7%

    \[\leadsto \color{blue}{\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}} \]
  4. Final simplification99.7%

    \[\leadsto \frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}} \]

Alternative 4: 39.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\sqrt{2}}{\sqrt{\frac{\frac{k}{\pi}}{n}}} \end{array} \]
(FPCore (k n) :precision binary64 (/ (sqrt 2.0) (sqrt (/ (/ k PI) n))))
double code(double k, double n) {
	return sqrt(2.0) / sqrt(((k / ((double) M_PI)) / n));
}
public static double code(double k, double n) {
	return Math.sqrt(2.0) / Math.sqrt(((k / Math.PI) / n));
}
def code(k, n):
	return math.sqrt(2.0) / math.sqrt(((k / math.pi) / n))
function code(k, n)
	return Float64(sqrt(2.0) / sqrt(Float64(Float64(k / pi) / n)))
end
function tmp = code(k, n)
	tmp = sqrt(2.0) / sqrt(((k / pi) / n));
end
code[k_, n_] := N[(N[Sqrt[2.0], $MachinePrecision] / N[Sqrt[N[(N[(k / Pi), $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\sqrt{2}}{\sqrt{\frac{\frac{k}{\pi}}{n}}}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Step-by-step derivation
    1. *-commutative99.6%

      \[\leadsto \color{blue}{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}}} \]
    2. *-commutative99.6%

      \[\leadsto {\left(\color{blue}{\left(\pi \cdot 2\right)} \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}} \]
    3. associate-*r*99.6%

      \[\leadsto {\color{blue}{\left(\pi \cdot \left(2 \cdot n\right)\right)}}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}} \]
    4. div-inv99.7%

      \[\leadsto \color{blue}{\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}} \]
    5. expm1-log1p-u96.7%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}\right)\right)} \]
    6. expm1-udef86.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}\right)} - 1} \]
  3. Applied egg-rr73.6%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)} - 1} \]
  4. Step-by-step derivation
    1. expm1-def83.9%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)\right)} \]
    2. expm1-log1p85.4%

      \[\leadsto \color{blue}{\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}} \]
    3. associate-*r*85.4%

      \[\leadsto \sqrt{\frac{{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot n\right)}}^{\left(1 - k\right)}}{k}} \]
  5. Simplified85.4%

    \[\leadsto \color{blue}{\sqrt{\frac{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(1 - k\right)}}{k}}} \]
  6. Taylor expanded in k around 0 36.8%

    \[\leadsto \sqrt{\color{blue}{2 \cdot \frac{n \cdot \pi}{k}}} \]
  7. Step-by-step derivation
    1. associate-/l*36.8%

      \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{n}{\frac{k}{\pi}}}} \]
    2. associate-/r/36.8%

      \[\leadsto \sqrt{2 \cdot \color{blue}{\left(\frac{n}{k} \cdot \pi\right)}} \]
  8. Simplified36.8%

    \[\leadsto \sqrt{\color{blue}{2 \cdot \left(\frac{n}{k} \cdot \pi\right)}} \]
  9. Step-by-step derivation
    1. expm1-log1p-u35.3%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2 \cdot \left(\frac{n}{k} \cdot \pi\right)}\right)\right)} \]
    2. expm1-udef34.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{2 \cdot \left(\frac{n}{k} \cdot \pi\right)}\right)} - 1} \]
    3. *-commutative34.9%

      \[\leadsto e^{\mathsf{log1p}\left(\sqrt{2 \cdot \color{blue}{\left(\pi \cdot \frac{n}{k}\right)}}\right)} - 1 \]
  10. Applied egg-rr34.9%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}\right)} - 1} \]
  11. Step-by-step derivation
    1. expm1-def35.3%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}\right)\right)} \]
    2. expm1-log1p36.8%

      \[\leadsto \color{blue}{\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}} \]
    3. associate-*r/36.8%

      \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{\pi \cdot n}{k}}} \]
    4. *-commutative36.8%

      \[\leadsto \sqrt{2 \cdot \frac{\color{blue}{n \cdot \pi}}{k}} \]
    5. associate-*r/36.8%

      \[\leadsto \sqrt{\color{blue}{\frac{2 \cdot \left(n \cdot \pi\right)}{k}}} \]
  12. Simplified36.8%

    \[\leadsto \color{blue}{\sqrt{\frac{2 \cdot \left(n \cdot \pi\right)}{k}}} \]
  13. Step-by-step derivation
    1. associate-/l*36.8%

      \[\leadsto \sqrt{\color{blue}{\frac{2}{\frac{k}{n \cdot \pi}}}} \]
    2. sqrt-div36.9%

      \[\leadsto \color{blue}{\frac{\sqrt{2}}{\sqrt{\frac{k}{n \cdot \pi}}}} \]
    3. *-commutative36.9%

      \[\leadsto \frac{\sqrt{2}}{\sqrt{\frac{k}{\color{blue}{\pi \cdot n}}}} \]
  14. Applied egg-rr36.9%

    \[\leadsto \color{blue}{\frac{\sqrt{2}}{\sqrt{\frac{k}{\pi \cdot n}}}} \]
  15. Step-by-step derivation
    1. associate-/r*36.9%

      \[\leadsto \frac{\sqrt{2}}{\sqrt{\color{blue}{\frac{\frac{k}{\pi}}{n}}}} \]
  16. Simplified36.9%

    \[\leadsto \color{blue}{\frac{\sqrt{2}}{\sqrt{\frac{\frac{k}{\pi}}{n}}}} \]
  17. Final simplification36.9%

    \[\leadsto \frac{\sqrt{2}}{\sqrt{\frac{\frac{k}{\pi}}{n}}} \]

Alternative 5: 50.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\sqrt{\pi \cdot \left(2 \cdot n\right)}}{\sqrt{k}} \end{array} \]
(FPCore (k n) :precision binary64 (/ (sqrt (* PI (* 2.0 n))) (sqrt k)))
double code(double k, double n) {
	return sqrt((((double) M_PI) * (2.0 * n))) / sqrt(k);
}
public static double code(double k, double n) {
	return Math.sqrt((Math.PI * (2.0 * n))) / Math.sqrt(k);
}
def code(k, n):
	return math.sqrt((math.pi * (2.0 * n))) / math.sqrt(k)
function code(k, n)
	return Float64(sqrt(Float64(pi * Float64(2.0 * n))) / sqrt(k))
end
function tmp = code(k, n)
	tmp = sqrt((pi * (2.0 * n))) / sqrt(k);
end
code[k_, n_] := N[(N[Sqrt[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\sqrt{\pi \cdot \left(2 \cdot n\right)}}{\sqrt{k}}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Step-by-step derivation
    1. *-commutative99.6%

      \[\leadsto \color{blue}{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}}} \]
    2. *-commutative99.6%

      \[\leadsto {\left(\color{blue}{\left(\pi \cdot 2\right)} \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}} \]
    3. associate-*r*99.6%

      \[\leadsto {\color{blue}{\left(\pi \cdot \left(2 \cdot n\right)\right)}}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}} \]
    4. div-inv99.7%

      \[\leadsto \color{blue}{\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}} \]
    5. expm1-log1p-u96.7%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}\right)\right)} \]
    6. expm1-udef86.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}\right)} - 1} \]
  3. Applied egg-rr73.6%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)} - 1} \]
  4. Step-by-step derivation
    1. expm1-def83.9%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)\right)} \]
    2. expm1-log1p85.4%

      \[\leadsto \color{blue}{\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}} \]
    3. associate-*r*85.4%

      \[\leadsto \sqrt{\frac{{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot n\right)}}^{\left(1 - k\right)}}{k}} \]
  5. Simplified85.4%

    \[\leadsto \color{blue}{\sqrt{\frac{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(1 - k\right)}}{k}}} \]
  6. Taylor expanded in k around 0 36.8%

    \[\leadsto \sqrt{\color{blue}{2 \cdot \frac{n \cdot \pi}{k}}} \]
  7. Step-by-step derivation
    1. associate-/l*36.8%

      \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{n}{\frac{k}{\pi}}}} \]
    2. associate-/r/36.8%

      \[\leadsto \sqrt{2 \cdot \color{blue}{\left(\frac{n}{k} \cdot \pi\right)}} \]
  8. Simplified36.8%

    \[\leadsto \sqrt{\color{blue}{2 \cdot \left(\frac{n}{k} \cdot \pi\right)}} \]
  9. Step-by-step derivation
    1. expm1-log1p-u35.3%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2 \cdot \left(\frac{n}{k} \cdot \pi\right)}\right)\right)} \]
    2. expm1-udef34.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{2 \cdot \left(\frac{n}{k} \cdot \pi\right)}\right)} - 1} \]
    3. *-commutative34.9%

      \[\leadsto e^{\mathsf{log1p}\left(\sqrt{2 \cdot \color{blue}{\left(\pi \cdot \frac{n}{k}\right)}}\right)} - 1 \]
  10. Applied egg-rr34.9%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}\right)} - 1} \]
  11. Step-by-step derivation
    1. expm1-def35.3%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}\right)\right)} \]
    2. expm1-log1p36.8%

      \[\leadsto \color{blue}{\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}} \]
    3. associate-*r/36.8%

      \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{\pi \cdot n}{k}}} \]
    4. *-commutative36.8%

      \[\leadsto \sqrt{2 \cdot \frac{\color{blue}{n \cdot \pi}}{k}} \]
    5. associate-*r/36.8%

      \[\leadsto \sqrt{\color{blue}{\frac{2 \cdot \left(n \cdot \pi\right)}{k}}} \]
  12. Simplified36.8%

    \[\leadsto \color{blue}{\sqrt{\frac{2 \cdot \left(n \cdot \pi\right)}{k}}} \]
  13. Step-by-step derivation
    1. sqrt-div51.0%

      \[\leadsto \color{blue}{\frac{\sqrt{2 \cdot \left(n \cdot \pi\right)}}{\sqrt{k}}} \]
    2. associate-*r*51.0%

      \[\leadsto \frac{\sqrt{\color{blue}{\left(2 \cdot n\right) \cdot \pi}}}{\sqrt{k}} \]
  14. Applied egg-rr51.0%

    \[\leadsto \color{blue}{\frac{\sqrt{\left(2 \cdot n\right) \cdot \pi}}{\sqrt{k}}} \]
  15. Final simplification51.0%

    \[\leadsto \frac{\sqrt{\pi \cdot \left(2 \cdot n\right)}}{\sqrt{k}} \]

Alternative 6: 39.2% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \frac{1}{\sqrt{\frac{0.5}{\pi} \cdot \frac{k}{n}}} \end{array} \]
(FPCore (k n) :precision binary64 (/ 1.0 (sqrt (* (/ 0.5 PI) (/ k n)))))
double code(double k, double n) {
	return 1.0 / sqrt(((0.5 / ((double) M_PI)) * (k / n)));
}
public static double code(double k, double n) {
	return 1.0 / Math.sqrt(((0.5 / Math.PI) * (k / n)));
}
def code(k, n):
	return 1.0 / math.sqrt(((0.5 / math.pi) * (k / n)))
function code(k, n)
	return Float64(1.0 / sqrt(Float64(Float64(0.5 / pi) * Float64(k / n))))
end
function tmp = code(k, n)
	tmp = 1.0 / sqrt(((0.5 / pi) * (k / n)));
end
code[k_, n_] := N[(1.0 / N[Sqrt[N[(N[(0.5 / Pi), $MachinePrecision] * N[(k / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{\sqrt{\frac{0.5}{\pi} \cdot \frac{k}{n}}}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Step-by-step derivation
    1. *-commutative99.6%

      \[\leadsto \frac{1}{\sqrt{k}} \cdot {\left(\color{blue}{\left(\pi \cdot 2\right)} \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    2. associate-*r*99.6%

      \[\leadsto \frac{1}{\sqrt{k}} \cdot {\color{blue}{\left(\pi \cdot \left(2 \cdot n\right)\right)}}^{\left(\frac{1 - k}{2}\right)} \]
    3. associate-/r/99.6%

      \[\leadsto \color{blue}{\frac{1}{\frac{\sqrt{k}}{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}}} \]
    4. add-sqr-sqrt99.3%

      \[\leadsto \frac{1}{\frac{\sqrt{k}}{\color{blue}{\sqrt{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}} \cdot \sqrt{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}}}} \]
    5. sqrt-unprod99.6%

      \[\leadsto \frac{1}{\frac{\sqrt{k}}{\color{blue}{\sqrt{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)} \cdot {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}}}} \]
    6. associate-*r*99.6%

      \[\leadsto \frac{1}{\frac{\sqrt{k}}{\sqrt{{\color{blue}{\left(\left(\pi \cdot 2\right) \cdot n\right)}}^{\left(\frac{1 - k}{2}\right)} \cdot {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}}} \]
    7. *-commutative99.6%

      \[\leadsto \frac{1}{\frac{\sqrt{k}}{\sqrt{{\left(\color{blue}{\left(2 \cdot \pi\right)} \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}}} \]
    8. associate-*r*99.6%

      \[\leadsto \frac{1}{\frac{\sqrt{k}}{\sqrt{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot {\color{blue}{\left(\left(\pi \cdot 2\right) \cdot n\right)}}^{\left(\frac{1 - k}{2}\right)}}}} \]
    9. *-commutative99.6%

      \[\leadsto \frac{1}{\frac{\sqrt{k}}{\sqrt{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot {\left(\color{blue}{\left(2 \cdot \pi\right)} \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}}}} \]
    10. pow-prod-up99.6%

      \[\leadsto \frac{1}{\frac{\sqrt{k}}{\sqrt{\color{blue}{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2} + \frac{1 - k}{2}\right)}}}}} \]
  3. Applied egg-rr99.6%

    \[\leadsto \color{blue}{\frac{1}{\frac{\sqrt{k}}{\sqrt{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}}}} \]
  4. Taylor expanded in n around 0 82.8%

    \[\leadsto \frac{1}{\color{blue}{\sqrt{\frac{k}{e^{\left(1 - k\right) \cdot \left(\log n + \log \left(2 \cdot \pi\right)\right)}}}}} \]
  5. Step-by-step derivation
    1. distribute-lft-in82.8%

      \[\leadsto \frac{1}{\sqrt{\frac{k}{e^{\color{blue}{\left(1 - k\right) \cdot \log n + \left(1 - k\right) \cdot \log \left(2 \cdot \pi\right)}}}}} \]
    2. remove-double-neg82.8%

      \[\leadsto \frac{1}{\sqrt{\frac{k}{e^{\left(1 - k\right) \cdot \color{blue}{\left(-\left(-\log n\right)\right)} + \left(1 - k\right) \cdot \log \left(2 \cdot \pi\right)}}}} \]
    3. log-rec82.8%

      \[\leadsto \frac{1}{\sqrt{\frac{k}{e^{\left(1 - k\right) \cdot \left(-\color{blue}{\log \left(\frac{1}{n}\right)}\right) + \left(1 - k\right) \cdot \log \left(2 \cdot \pi\right)}}}} \]
    4. mul-1-neg82.8%

      \[\leadsto \frac{1}{\sqrt{\frac{k}{e^{\left(1 - k\right) \cdot \color{blue}{\left(-1 \cdot \log \left(\frac{1}{n}\right)\right)} + \left(1 - k\right) \cdot \log \left(2 \cdot \pi\right)}}}} \]
    5. distribute-lft-in82.8%

      \[\leadsto \frac{1}{\sqrt{\frac{k}{e^{\color{blue}{\left(1 - k\right) \cdot \left(-1 \cdot \log \left(\frac{1}{n}\right) + \log \left(2 \cdot \pi\right)\right)}}}}} \]
    6. *-commutative82.8%

      \[\leadsto \frac{1}{\sqrt{\frac{k}{e^{\color{blue}{\left(-1 \cdot \log \left(\frac{1}{n}\right) + \log \left(2 \cdot \pi\right)\right) \cdot \left(1 - k\right)}}}}} \]
    7. exp-prod82.8%

      \[\leadsto \frac{1}{\sqrt{\frac{k}{\color{blue}{{\left(e^{-1 \cdot \log \left(\frac{1}{n}\right) + \log \left(2 \cdot \pi\right)}\right)}^{\left(1 - k\right)}}}}} \]
  6. Simplified85.6%

    \[\leadsto \frac{1}{\color{blue}{\sqrt{\frac{k}{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}}}} \]
  7. Taylor expanded in k around 0 36.9%

    \[\leadsto \frac{1}{\sqrt{\color{blue}{0.5 \cdot \frac{k}{n \cdot \pi}}}} \]
  8. Step-by-step derivation
    1. associate-*r/36.9%

      \[\leadsto \frac{1}{\sqrt{\color{blue}{\frac{0.5 \cdot k}{n \cdot \pi}}}} \]
    2. *-commutative36.9%

      \[\leadsto \frac{1}{\sqrt{\frac{0.5 \cdot k}{\color{blue}{\pi \cdot n}}}} \]
    3. times-frac36.9%

      \[\leadsto \frac{1}{\sqrt{\color{blue}{\frac{0.5}{\pi} \cdot \frac{k}{n}}}} \]
  9. Simplified36.9%

    \[\leadsto \frac{1}{\sqrt{\color{blue}{\frac{0.5}{\pi} \cdot \frac{k}{n}}}} \]
  10. Final simplification36.9%

    \[\leadsto \frac{1}{\sqrt{\frac{0.5}{\pi} \cdot \frac{k}{n}}} \]

Alternative 7: 39.2% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \frac{1}{\sqrt{\frac{k \cdot 0.5}{\pi \cdot n}}} \end{array} \]
(FPCore (k n) :precision binary64 (/ 1.0 (sqrt (/ (* k 0.5) (* PI n)))))
double code(double k, double n) {
	return 1.0 / sqrt(((k * 0.5) / (((double) M_PI) * n)));
}
public static double code(double k, double n) {
	return 1.0 / Math.sqrt(((k * 0.5) / (Math.PI * n)));
}
def code(k, n):
	return 1.0 / math.sqrt(((k * 0.5) / (math.pi * n)))
function code(k, n)
	return Float64(1.0 / sqrt(Float64(Float64(k * 0.5) / Float64(pi * n))))
end
function tmp = code(k, n)
	tmp = 1.0 / sqrt(((k * 0.5) / (pi * n)));
end
code[k_, n_] := N[(1.0 / N[Sqrt[N[(N[(k * 0.5), $MachinePrecision] / N[(Pi * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{\sqrt{\frac{k \cdot 0.5}{\pi \cdot n}}}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Step-by-step derivation
    1. *-commutative99.6%

      \[\leadsto \frac{1}{\sqrt{k}} \cdot {\left(\color{blue}{\left(\pi \cdot 2\right)} \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    2. associate-*r*99.6%

      \[\leadsto \frac{1}{\sqrt{k}} \cdot {\color{blue}{\left(\pi \cdot \left(2 \cdot n\right)\right)}}^{\left(\frac{1 - k}{2}\right)} \]
    3. associate-/r/99.6%

      \[\leadsto \color{blue}{\frac{1}{\frac{\sqrt{k}}{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}}} \]
    4. add-sqr-sqrt99.3%

      \[\leadsto \frac{1}{\frac{\sqrt{k}}{\color{blue}{\sqrt{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}} \cdot \sqrt{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}}}} \]
    5. sqrt-unprod99.6%

      \[\leadsto \frac{1}{\frac{\sqrt{k}}{\color{blue}{\sqrt{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)} \cdot {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}}}} \]
    6. associate-*r*99.6%

      \[\leadsto \frac{1}{\frac{\sqrt{k}}{\sqrt{{\color{blue}{\left(\left(\pi \cdot 2\right) \cdot n\right)}}^{\left(\frac{1 - k}{2}\right)} \cdot {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}}} \]
    7. *-commutative99.6%

      \[\leadsto \frac{1}{\frac{\sqrt{k}}{\sqrt{{\left(\color{blue}{\left(2 \cdot \pi\right)} \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}}} \]
    8. associate-*r*99.6%

      \[\leadsto \frac{1}{\frac{\sqrt{k}}{\sqrt{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot {\color{blue}{\left(\left(\pi \cdot 2\right) \cdot n\right)}}^{\left(\frac{1 - k}{2}\right)}}}} \]
    9. *-commutative99.6%

      \[\leadsto \frac{1}{\frac{\sqrt{k}}{\sqrt{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot {\left(\color{blue}{\left(2 \cdot \pi\right)} \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}}}} \]
    10. pow-prod-up99.6%

      \[\leadsto \frac{1}{\frac{\sqrt{k}}{\sqrt{\color{blue}{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2} + \frac{1 - k}{2}\right)}}}}} \]
  3. Applied egg-rr99.6%

    \[\leadsto \color{blue}{\frac{1}{\frac{\sqrt{k}}{\sqrt{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}}}} \]
  4. Taylor expanded in n around 0 82.8%

    \[\leadsto \frac{1}{\color{blue}{\sqrt{\frac{k}{e^{\left(1 - k\right) \cdot \left(\log n + \log \left(2 \cdot \pi\right)\right)}}}}} \]
  5. Step-by-step derivation
    1. distribute-lft-in82.8%

      \[\leadsto \frac{1}{\sqrt{\frac{k}{e^{\color{blue}{\left(1 - k\right) \cdot \log n + \left(1 - k\right) \cdot \log \left(2 \cdot \pi\right)}}}}} \]
    2. remove-double-neg82.8%

      \[\leadsto \frac{1}{\sqrt{\frac{k}{e^{\left(1 - k\right) \cdot \color{blue}{\left(-\left(-\log n\right)\right)} + \left(1 - k\right) \cdot \log \left(2 \cdot \pi\right)}}}} \]
    3. log-rec82.8%

      \[\leadsto \frac{1}{\sqrt{\frac{k}{e^{\left(1 - k\right) \cdot \left(-\color{blue}{\log \left(\frac{1}{n}\right)}\right) + \left(1 - k\right) \cdot \log \left(2 \cdot \pi\right)}}}} \]
    4. mul-1-neg82.8%

      \[\leadsto \frac{1}{\sqrt{\frac{k}{e^{\left(1 - k\right) \cdot \color{blue}{\left(-1 \cdot \log \left(\frac{1}{n}\right)\right)} + \left(1 - k\right) \cdot \log \left(2 \cdot \pi\right)}}}} \]
    5. distribute-lft-in82.8%

      \[\leadsto \frac{1}{\sqrt{\frac{k}{e^{\color{blue}{\left(1 - k\right) \cdot \left(-1 \cdot \log \left(\frac{1}{n}\right) + \log \left(2 \cdot \pi\right)\right)}}}}} \]
    6. *-commutative82.8%

      \[\leadsto \frac{1}{\sqrt{\frac{k}{e^{\color{blue}{\left(-1 \cdot \log \left(\frac{1}{n}\right) + \log \left(2 \cdot \pi\right)\right) \cdot \left(1 - k\right)}}}}} \]
    7. exp-prod82.8%

      \[\leadsto \frac{1}{\sqrt{\frac{k}{\color{blue}{{\left(e^{-1 \cdot \log \left(\frac{1}{n}\right) + \log \left(2 \cdot \pi\right)}\right)}^{\left(1 - k\right)}}}}} \]
  6. Simplified85.6%

    \[\leadsto \frac{1}{\color{blue}{\sqrt{\frac{k}{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}}}} \]
  7. Taylor expanded in k around 0 36.9%

    \[\leadsto \frac{1}{\sqrt{\color{blue}{0.5 \cdot \frac{k}{n \cdot \pi}}}} \]
  8. Step-by-step derivation
    1. associate-*r/36.9%

      \[\leadsto \frac{1}{\sqrt{\color{blue}{\frac{0.5 \cdot k}{n \cdot \pi}}}} \]
  9. Simplified36.9%

    \[\leadsto \frac{1}{\sqrt{\color{blue}{\frac{0.5 \cdot k}{n \cdot \pi}}}} \]
  10. Final simplification36.9%

    \[\leadsto \frac{1}{\sqrt{\frac{k \cdot 0.5}{\pi \cdot n}}} \]

Alternative 8: 38.8% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \sqrt{2 \cdot \left(n \cdot \frac{\pi}{k}\right)} \end{array} \]
(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(2.0 * Float64(n * Float64(pi / k))))
end
function tmp = code(k, n)
	tmp = sqrt((2.0 * (n * (pi / k))));
end
code[k_, n_] := N[Sqrt[N[(2.0 * N[(n * N[(Pi / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\sqrt{2 \cdot \left(n \cdot \frac{\pi}{k}\right)}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Step-by-step derivation
    1. *-commutative99.6%

      \[\leadsto \color{blue}{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}}} \]
    2. *-commutative99.6%

      \[\leadsto {\left(\color{blue}{\left(\pi \cdot 2\right)} \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}} \]
    3. associate-*r*99.6%

      \[\leadsto {\color{blue}{\left(\pi \cdot \left(2 \cdot n\right)\right)}}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}} \]
    4. div-inv99.7%

      \[\leadsto \color{blue}{\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}} \]
    5. expm1-log1p-u96.7%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}\right)\right)} \]
    6. expm1-udef86.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}\right)} - 1} \]
  3. Applied egg-rr73.6%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)} - 1} \]
  4. Step-by-step derivation
    1. expm1-def83.9%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)\right)} \]
    2. expm1-log1p85.4%

      \[\leadsto \color{blue}{\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}} \]
    3. associate-*r*85.4%

      \[\leadsto \sqrt{\frac{{\color{blue}{\left(\left(2 \cdot \pi\right) \cdot n\right)}}^{\left(1 - k\right)}}{k}} \]
  5. Simplified85.4%

    \[\leadsto \color{blue}{\sqrt{\frac{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(1 - k\right)}}{k}}} \]
  6. Taylor expanded in k around 0 36.8%

    \[\leadsto \sqrt{\color{blue}{2 \cdot \frac{n \cdot \pi}{k}}} \]
  7. Step-by-step derivation
    1. associate-/l*36.8%

      \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{n}{\frac{k}{\pi}}}} \]
    2. associate-/r/36.8%

      \[\leadsto \sqrt{2 \cdot \color{blue}{\left(\frac{n}{k} \cdot \pi\right)}} \]
  8. Simplified36.8%

    \[\leadsto \sqrt{\color{blue}{2 \cdot \left(\frac{n}{k} \cdot \pi\right)}} \]
  9. Step-by-step derivation
    1. expm1-log1p-u35.3%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2 \cdot \left(\frac{n}{k} \cdot \pi\right)}\right)\right)} \]
    2. expm1-udef34.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{2 \cdot \left(\frac{n}{k} \cdot \pi\right)}\right)} - 1} \]
    3. *-commutative34.9%

      \[\leadsto e^{\mathsf{log1p}\left(\sqrt{2 \cdot \color{blue}{\left(\pi \cdot \frac{n}{k}\right)}}\right)} - 1 \]
  10. Applied egg-rr34.9%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}\right)} - 1} \]
  11. Step-by-step derivation
    1. expm1-def35.3%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}\right)\right)} \]
    2. expm1-log1p36.8%

      \[\leadsto \color{blue}{\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}} \]
    3. associate-*r/36.8%

      \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{\pi \cdot n}{k}}} \]
    4. *-commutative36.8%

      \[\leadsto \sqrt{2 \cdot \frac{\color{blue}{n \cdot \pi}}{k}} \]
    5. associate-*r/36.8%

      \[\leadsto \sqrt{\color{blue}{\frac{2 \cdot \left(n \cdot \pi\right)}{k}}} \]
  12. Simplified36.8%

    \[\leadsto \color{blue}{\sqrt{\frac{2 \cdot \left(n \cdot \pi\right)}{k}}} \]
  13. Taylor expanded in n around 0 36.8%

    \[\leadsto \sqrt{\color{blue}{2 \cdot \frac{n \cdot \pi}{k}}} \]
  14. Step-by-step derivation
    1. associate-*r/36.8%

      \[\leadsto \sqrt{\color{blue}{\frac{2 \cdot \left(n \cdot \pi\right)}{k}}} \]
    2. associate-*l*36.8%

      \[\leadsto \sqrt{\frac{\color{blue}{\left(2 \cdot n\right) \cdot \pi}}{k}} \]
    3. associate-*r/36.8%

      \[\leadsto \sqrt{\color{blue}{\left(2 \cdot n\right) \cdot \frac{\pi}{k}}} \]
    4. associate-*l*36.8%

      \[\leadsto \sqrt{\color{blue}{2 \cdot \left(n \cdot \frac{\pi}{k}\right)}} \]
  15. Simplified36.8%

    \[\leadsto \sqrt{\color{blue}{2 \cdot \left(n \cdot \frac{\pi}{k}\right)}} \]
  16. Final simplification36.8%

    \[\leadsto \sqrt{2 \cdot \left(n \cdot \frac{\pi}{k}\right)} \]

Reproduce

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