
(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 8 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 (let* ((t_0 (* n (* (PI) 2.0)))) (/ (/ (sqrt t_0) (sqrt k)) (pow t_0 (* 0.5 k)))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\\
\frac{\frac{\sqrt{t\_0}}{\sqrt{k}}}{{t\_0}^{\left(0.5 \cdot k\right)}}
\end{array}
\end{array}
Initial program 99.5%
lift-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift--.f64N/A
div-subN/A
metadata-evalN/A
pow-subN/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.7%
lift-pow.f64N/A
lift-pow.f64N/A
pow-powN/A
*-commutativeN/A
lower-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
metadata-evalN/A
pow-flipN/A
pow1/2N/A
lift-sqrt.f64N/A
div-invN/A
lower-/.f6499.8
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f6499.8
Applied rewrites99.8%
Final simplification99.8%
(FPCore (k n) :precision binary64 (let* ((t_0 (* n (* (PI) 2.0)))) (* (* (sqrt t_0) (pow t_0 (* -0.5 k))) (/ 1.0 (sqrt k)))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\\
\left(\sqrt{t\_0} \cdot {t\_0}^{\left(-0.5 \cdot k\right)}\right) \cdot \frac{1}{\sqrt{k}}
\end{array}
\end{array}
Initial program 99.5%
lift-pow.f64N/A
lift-/.f64N/A
lift--.f64N/A
div-subN/A
metadata-evalN/A
sub-negN/A
+-commutativeN/A
unpow-prod-upN/A
lower-*.f64N/A
Applied rewrites99.7%
Final simplification99.7%
(FPCore (k n) :precision binary64 (let* ((t_0 (* n (* (PI) 2.0)))) (if (<= k 1.0) (/ (sqrt t_0) (sqrt k)) (/ (pow t_0 (* -0.5 k)) (sqrt k)))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\\
\mathbf{if}\;k \leq 1:\\
\;\;\;\;\frac{\sqrt{t\_0}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{{t\_0}^{\left(-0.5 \cdot k\right)}}{\sqrt{k}}\\
\end{array}
\end{array}
if k < 1Initial program 99.0%
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.f6474.2
Applied rewrites74.2%
Applied rewrites95.3%
if 1 < k Initial program 100.0%
Taylor expanded in k around inf
*-commutativeN/A
lower-*.f64100.0
Applied rewrites100.0%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f64100.0
Applied rewrites100.0%
Final simplification97.8%
(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.6%
Final simplification99.6%
(FPCore (k n) :precision binary64 (/ (sqrt (* n (* (PI) 2.0))) (sqrt k)))
\begin{array}{l}
\\
\frac{\sqrt{n \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)}}{\sqrt{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.f6436.2
Applied rewrites36.2%
Applied rewrites46.1%
Final simplification46.1%
(FPCore (k n) :precision binary64 (* (sqrt (/ 2.0 k)) (sqrt (* n (PI)))))
\begin{array}{l}
\\
\sqrt{\frac{2}{k}} \cdot \sqrt{n \cdot \mathsf{PI}\left(\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.f6436.2
Applied rewrites36.2%
Applied rewrites36.2%
Applied rewrites46.1%
Final simplification46.1%
(FPCore (k n) :precision binary64 (* (sqrt (/ (* (PI) 2.0) k)) (sqrt n)))
\begin{array}{l}
\\
\sqrt{\frac{\mathsf{PI}\left(\right) \cdot 2}{k}} \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.f6436.2
Applied rewrites36.2%
Applied rewrites36.2%
Applied rewrites46.1%
Final simplification46.1%
(FPCore (k n) :precision binary64 (sqrt (* (* (/ (PI) k) n) 2.0)))
\begin{array}{l}
\\
\sqrt{\left(\frac{\mathsf{PI}\left(\right)}{k} \cdot n\right) \cdot 2}
\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.f6436.2
Applied rewrites36.2%
Applied rewrites36.2%
Applied rewrites36.3%
Final simplification36.3%
herbie shell --seed 2024250
(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))))