| Alternative 1 | |
|---|---|
| Accuracy | 99.3% |
| Cost | 26176 |
(FPCore (k n) :precision binary64 (* (/ 1.0 (sqrt k)) (pow (* (* 2.0 PI) n) (/ (- 1.0 k) 2.0))))
(FPCore (k n) :precision binary64 (let* ((t_0 (* PI (* 2.0 n)))) (* (pow t_0 (* -0.5 k)) (/ (sqrt t_0) (sqrt 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 t_0 = ((double) M_PI) * (2.0 * n);
return pow(t_0, (-0.5 * k)) * (sqrt(t_0) / sqrt(k));
}
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 t_0 = Math.PI * (2.0 * n);
return Math.pow(t_0, (-0.5 * k)) * (Math.sqrt(t_0) / Math.sqrt(k));
}
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): t_0 = math.pi * (2.0 * n) return math.pow(t_0, (-0.5 * k)) * (math.sqrt(t_0) / math.sqrt(k))
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) t_0 = Float64(pi * Float64(2.0 * n)) return Float64((t_0 ^ Float64(-0.5 * k)) * Float64(sqrt(t_0) / sqrt(k))) end
function tmp = code(k, n) tmp = (1.0 / sqrt(k)) * (((2.0 * pi) * n) ^ ((1.0 - k) / 2.0)); end
function tmp = code(k, n) t_0 = pi * (2.0 * n); tmp = (t_0 ^ (-0.5 * k)) * (sqrt(t_0) / sqrt(k)); 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_] := Block[{t$95$0 = N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[t$95$0, N[(-0.5 * k), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[t$95$0], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $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}
t_0 := \pi \cdot \left(2 \cdot n\right)\\
{t_0}^{\left(-0.5 \cdot k\right)} \cdot \frac{\sqrt{t_0}}{\sqrt{k}}
\end{array}
Results
Initial program 99.2%
Simplified99.3%
[Start]99.2 | \[ \frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}
\] |
|---|---|
associate-*l/ [=>]99.3 | \[ \color{blue}{\frac{1 \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}}
\] |
*-lft-identity [=>]99.3 | \[ \frac{\color{blue}{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}}}{\sqrt{k}}
\] |
sqr-pow [=>]99.0 | \[ \frac{\color{blue}{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{\frac{1 - k}{2}}{2}\right)} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{\frac{1 - k}{2}}{2}\right)}}}{\sqrt{k}}
\] |
sqr-pow [<=]99.3 | \[ \frac{\color{blue}{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}}}{\sqrt{k}}
\] |
*-commutative [=>]99.3 | \[ \frac{{\left(\color{blue}{\left(\pi \cdot 2\right)} \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}
\] |
associate-*l* [=>]99.3 | \[ \frac{{\color{blue}{\left(\pi \cdot \left(2 \cdot n\right)\right)}}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}
\] |
div-sub [=>]99.3 | \[ \frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\color{blue}{\left(\frac{1}{2} - \frac{k}{2}\right)}}}{\sqrt{k}}
\] |
metadata-eval [=>]99.3 | \[ \frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\color{blue}{0.5} - \frac{k}{2}\right)}}{\sqrt{k}}
\] |
Applied egg-rr99.4%
[Start]99.3 | \[ \frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}
\] |
|---|---|
sub-neg [=>]99.3 | \[ \frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\color{blue}{\left(0.5 + \left(-\frac{k}{2}\right)\right)}}}{\sqrt{k}}
\] |
unpow-prod-up [=>]99.4 | \[ \frac{\color{blue}{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{0.5} \cdot {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(-\frac{k}{2}\right)}}}{\sqrt{k}}
\] |
unpow1/2 [=>]99.4 | \[ \frac{\color{blue}{\sqrt{\pi \cdot \left(2 \cdot n\right)}} \cdot {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(-\frac{k}{2}\right)}}{\sqrt{k}}
\] |
div-inv [=>]99.4 | \[ \frac{\sqrt{\pi \cdot \left(2 \cdot n\right)} \cdot {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(-\color{blue}{k \cdot \frac{1}{2}}\right)}}{\sqrt{k}}
\] |
metadata-eval [=>]99.4 | \[ \frac{\sqrt{\pi \cdot \left(2 \cdot n\right)} \cdot {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(-k \cdot \color{blue}{0.5}\right)}}{\sqrt{k}}
\] |
distribute-rgt-neg-in [=>]99.4 | \[ \frac{\sqrt{\pi \cdot \left(2 \cdot n\right)} \cdot {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\color{blue}{\left(k \cdot \left(-0.5\right)\right)}}}{\sqrt{k}}
\] |
metadata-eval [=>]99.4 | \[ \frac{\sqrt{\pi \cdot \left(2 \cdot n\right)} \cdot {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(k \cdot \color{blue}{-0.5}\right)}}{\sqrt{k}}
\] |
Simplified99.4%
[Start]99.4 | \[ \frac{\sqrt{\pi \cdot \left(2 \cdot n\right)} \cdot {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(k \cdot -0.5\right)}}{\sqrt{k}}
\] |
|---|---|
associate-*r* [=>]99.4 | \[ \frac{\sqrt{\color{blue}{\left(\pi \cdot 2\right) \cdot n}} \cdot {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(k \cdot -0.5\right)}}{\sqrt{k}}
\] |
*-commutative [=>]99.4 | \[ \frac{\sqrt{\color{blue}{\left(2 \cdot \pi\right)} \cdot n} \cdot {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(k \cdot -0.5\right)}}{\sqrt{k}}
\] |
associate-*r* [=>]99.4 | \[ \frac{\sqrt{\left(2 \cdot \pi\right) \cdot n} \cdot {\color{blue}{\left(\left(\pi \cdot 2\right) \cdot n\right)}}^{\left(k \cdot -0.5\right)}}{\sqrt{k}}
\] |
*-commutative [=>]99.4 | \[ \frac{\sqrt{\left(2 \cdot \pi\right) \cdot n} \cdot {\left(\color{blue}{\left(2 \cdot \pi\right)} \cdot n\right)}^{\left(k \cdot -0.5\right)}}{\sqrt{k}}
\] |
Applied egg-rr99.3%
[Start]99.4 | \[ \frac{\sqrt{\left(2 \cdot \pi\right) \cdot n} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(k \cdot -0.5\right)}}{\sqrt{k}}
\] |
|---|---|
associate-/l* [=>]99.4 | \[ \color{blue}{\frac{\sqrt{\left(2 \cdot \pi\right) \cdot n}}{\frac{\sqrt{k}}{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(k \cdot -0.5\right)}}}}
\] |
div-inv [=>]99.3 | \[ \color{blue}{\sqrt{\left(2 \cdot \pi\right) \cdot n} \cdot \frac{1}{\frac{\sqrt{k}}{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(k \cdot -0.5\right)}}}}
\] |
associate-/l* [<=]99.3 | \[ \sqrt{\left(2 \cdot \pi\right) \cdot n} \cdot \color{blue}{\frac{1 \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(k \cdot -0.5\right)}}{\sqrt{k}}}
\] |
*-un-lft-identity [<=]99.3 | \[ \sqrt{\left(2 \cdot \pi\right) \cdot n} \cdot \frac{\color{blue}{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(k \cdot -0.5\right)}}}{\sqrt{k}}
\] |
associate-*l* [=>]99.3 | \[ \sqrt{\color{blue}{2 \cdot \left(\pi \cdot n\right)}} \cdot \frac{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(k \cdot -0.5\right)}}{\sqrt{k}}
\] |
associate-*l* [=>]99.3 | \[ \sqrt{2 \cdot \left(\pi \cdot n\right)} \cdot \frac{{\color{blue}{\left(2 \cdot \left(\pi \cdot n\right)\right)}}^{\left(k \cdot -0.5\right)}}{\sqrt{k}}
\] |
Simplified99.4%
[Start]99.3 | \[ \sqrt{2 \cdot \left(\pi \cdot n\right)} \cdot \frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(k \cdot -0.5\right)}}{\sqrt{k}}
\] |
|---|---|
*-commutative [=>]99.3 | \[ \color{blue}{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(k \cdot -0.5\right)}}{\sqrt{k}} \cdot \sqrt{2 \cdot \left(\pi \cdot n\right)}}
\] |
associate-*l/ [=>]99.4 | \[ \color{blue}{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(k \cdot -0.5\right)} \cdot \sqrt{2 \cdot \left(\pi \cdot n\right)}}{\sqrt{k}}}
\] |
associate-*r/ [<=]99.4 | \[ \color{blue}{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(k \cdot -0.5\right)} \cdot \frac{\sqrt{2 \cdot \left(\pi \cdot n\right)}}{\sqrt{k}}}
\] |
*-commutative [=>]99.4 | \[ {\color{blue}{\left(\left(\pi \cdot n\right) \cdot 2\right)}}^{\left(k \cdot -0.5\right)} \cdot \frac{\sqrt{2 \cdot \left(\pi \cdot n\right)}}{\sqrt{k}}
\] |
associate-*l* [=>]99.4 | \[ {\color{blue}{\left(\pi \cdot \left(n \cdot 2\right)\right)}}^{\left(k \cdot -0.5\right)} \cdot \frac{\sqrt{2 \cdot \left(\pi \cdot n\right)}}{\sqrt{k}}
\] |
*-commutative [<=]99.4 | \[ {\left(\pi \cdot \color{blue}{\left(2 \cdot n\right)}\right)}^{\left(k \cdot -0.5\right)} \cdot \frac{\sqrt{2 \cdot \left(\pi \cdot n\right)}}{\sqrt{k}}
\] |
*-commutative [=>]99.4 | \[ {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\color{blue}{\left(-0.5 \cdot k\right)}} \cdot \frac{\sqrt{2 \cdot \left(\pi \cdot n\right)}}{\sqrt{k}}
\] |
*-commutative [=>]99.4 | \[ {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(-0.5 \cdot k\right)} \cdot \frac{\sqrt{\color{blue}{\left(\pi \cdot n\right) \cdot 2}}}{\sqrt{k}}
\] |
associate-*l* [=>]99.4 | \[ {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(-0.5 \cdot k\right)} \cdot \frac{\sqrt{\color{blue}{\pi \cdot \left(n \cdot 2\right)}}}{\sqrt{k}}
\] |
*-commutative [<=]99.4 | \[ {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(-0.5 \cdot k\right)} \cdot \frac{\sqrt{\pi \cdot \color{blue}{\left(2 \cdot n\right)}}}{\sqrt{k}}
\] |
Final simplification99.4%
| Alternative 1 | |
|---|---|
| Accuracy | 99.3% |
| Cost | 26176 |
| Alternative 2 | |
|---|---|
| Accuracy | 99.3% |
| Cost | 20036 |
| Alternative 3 | |
|---|---|
| Accuracy | 99.1% |
| Cost | 19908 |
| Alternative 4 | |
|---|---|
| Accuracy | 99.3% |
| Cost | 19904 |
| Alternative 5 | |
|---|---|
| Accuracy | 67.1% |
| Cost | 19844 |
| Alternative 6 | |
|---|---|
| Accuracy | 67.1% |
| Cost | 19780 |
| Alternative 7 | |
|---|---|
| Accuracy | 65.7% |
| Cost | 19584 |
| Alternative 8 | |
|---|---|
| Accuracy | 65.7% |
| Cost | 19584 |
| Alternative 9 | |
|---|---|
| Accuracy | 49.6% |
| Cost | 13184 |
| Alternative 10 | |
|---|---|
| Accuracy | 49.6% |
| Cost | 13184 |
herbie shell --seed 2023129
(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))))