
(FPCore (k n) :precision binary64 (* (/ 1.0 (sqrt k)) (pow (* (* 2.0 (PI)) n) (/ (- 1.0 k) 2.0))))
\begin{array}{l}
\\
\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 6 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (k n) :precision binary64 (* (/ 1.0 (sqrt k)) (pow (* (* 2.0 (PI)) n) (/ (- 1.0 k) 2.0))))
\begin{array}{l}
\\
\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}
\end{array}
(FPCore (k n) :precision binary64 (* (sqrt (/ 1.0 k)) (pow (* (* n 2.0) (PI)) (fma k -0.5 0.5))))
\begin{array}{l}
\\
\sqrt{\frac{1}{k}} \cdot {\left(\left(n \cdot 2\right) \cdot \mathsf{PI}\left(\right)\right)}^{\left(\mathsf{fma}\left(k, -0.5, 0.5\right)\right)}
\end{array}
Initial program 99.5%
Taylor expanded in k around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.5%
Final simplification99.5%
(FPCore (k n) :precision binary64 (if (<= k 1.0) (* (sqrt (* n 2.0)) (sqrt (/ (PI) k))) (/ (pow (* (* (PI) 2.0) n) (* -0.5 k)) (sqrt k))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1:\\
\;\;\;\;\sqrt{n \cdot 2} \cdot \sqrt{\frac{\mathsf{PI}\left(\right)}{k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot n\right)}^{\left(-0.5 \cdot k\right)}}{\sqrt{k}}\\
\end{array}
\end{array}
if k < 1Initial program 98.9%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6473.1
Applied rewrites73.1%
Applied rewrites73.3%
Applied rewrites96.3%
if 1 < k Initial program 100.0%
Taylor expanded in k around inf
*-commutativeN/A
lower-*.f6499.3
Applied rewrites99.3%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6499.3
lift-*.f64N/A
*-commutativeN/A
lift-*.f6499.3
Applied rewrites99.3%
Final simplification97.8%
(FPCore (k n) :precision binary64 (/ (pow (* (* (PI) 2.0) n) (fma -0.5 k 0.5)) (sqrt k)))
\begin{array}{l}
\\
\frac{{\left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot n\right)}^{\left(\mathsf{fma}\left(-0.5, k, 0.5\right)\right)}}{\sqrt{k}}
\end{array}
Initial program 99.5%
Taylor expanded in n around -inf
*-commutativeN/A
associate-*l*N/A
exp-prodN/A
*-commutativeN/A
lower-pow.f64N/A
mul-1-negN/A
unsub-negN/A
exp-diffN/A
lower-/.f64N/A
rem-exp-logN/A
lower-*.f64N/A
lower-PI.f64N/A
rem-exp-logN/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
Applied rewrites99.4%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6499.5
Applied rewrites99.5%
(FPCore (k n) :precision binary64 (* (sqrt (* n 2.0)) (sqrt (/ (PI) k))))
\begin{array}{l}
\\
\sqrt{n \cdot 2} \cdot \sqrt{\frac{\mathsf{PI}\left(\right)}{k}}
\end{array}
Initial program 99.5%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6437.3
Applied rewrites37.3%
Applied rewrites37.4%
Applied rewrites48.8%
Final simplification48.8%
(FPCore (k n) :precision binary64 (* (sqrt (* (/ (PI) k) 2.0)) (sqrt n)))
\begin{array}{l}
\\
\sqrt{\frac{\mathsf{PI}\left(\right)}{k} \cdot 2} \cdot \sqrt{n}
\end{array}
Initial program 99.5%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6437.3
Applied rewrites37.3%
Applied rewrites37.4%
Applied rewrites48.8%
Final simplification48.8%
(FPCore (k n) :precision binary64 (sqrt (* (/ 2.0 k) (* (PI) n))))
\begin{array}{l}
\\
\sqrt{\frac{2}{k} \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)}
\end{array}
Initial program 99.5%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6437.3
Applied rewrites37.3%
Applied rewrites37.4%
Applied rewrites37.5%
Final simplification37.5%
herbie shell --seed 2024270
(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))))