| Alternative 1 | |
|---|---|
| Error | 2.4 |
| Cost | 26944 |
(FPCore (f)
:precision binary64
(-
(*
(/ 1.0 (/ PI 4.0))
(log
(/
(+ (exp (* (/ PI 4.0) f)) (exp (- (* (/ PI 4.0) f))))
(- (exp (* (/ PI 4.0) f)) (exp (- (* (/ PI 4.0) f)))))))))(FPCore (f) :precision binary64 (+ (* -4.0 (/ (- (log (/ 4.0 PI)) (log f)) PI)) (* PI (* (pow f 2.0) -0.08333333333333333))))
double code(double f) {
return -((1.0 / (((double) M_PI) / 4.0)) * log(((exp(((((double) M_PI) / 4.0) * f)) + exp(-((((double) M_PI) / 4.0) * f))) / (exp(((((double) M_PI) / 4.0) * f)) - exp(-((((double) M_PI) / 4.0) * f))))));
}
double code(double f) {
return (-4.0 * ((log((4.0 / ((double) M_PI))) - log(f)) / ((double) M_PI))) + (((double) M_PI) * (pow(f, 2.0) * -0.08333333333333333));
}
public static double code(double f) {
return -((1.0 / (Math.PI / 4.0)) * Math.log(((Math.exp(((Math.PI / 4.0) * f)) + Math.exp(-((Math.PI / 4.0) * f))) / (Math.exp(((Math.PI / 4.0) * f)) - Math.exp(-((Math.PI / 4.0) * f))))));
}
public static double code(double f) {
return (-4.0 * ((Math.log((4.0 / Math.PI)) - Math.log(f)) / Math.PI)) + (Math.PI * (Math.pow(f, 2.0) * -0.08333333333333333));
}
def code(f): return -((1.0 / (math.pi / 4.0)) * math.log(((math.exp(((math.pi / 4.0) * f)) + math.exp(-((math.pi / 4.0) * f))) / (math.exp(((math.pi / 4.0) * f)) - math.exp(-((math.pi / 4.0) * f))))))
def code(f): return (-4.0 * ((math.log((4.0 / math.pi)) - math.log(f)) / math.pi)) + (math.pi * (math.pow(f, 2.0) * -0.08333333333333333))
function code(f) return Float64(-Float64(Float64(1.0 / Float64(pi / 4.0)) * log(Float64(Float64(exp(Float64(Float64(pi / 4.0) * f)) + exp(Float64(-Float64(Float64(pi / 4.0) * f)))) / Float64(exp(Float64(Float64(pi / 4.0) * f)) - exp(Float64(-Float64(Float64(pi / 4.0) * f)))))))) end
function code(f) return Float64(Float64(-4.0 * Float64(Float64(log(Float64(4.0 / pi)) - log(f)) / pi)) + Float64(pi * Float64((f ^ 2.0) * -0.08333333333333333))) end
function tmp = code(f) tmp = -((1.0 / (pi / 4.0)) * log(((exp(((pi / 4.0) * f)) + exp(-((pi / 4.0) * f))) / (exp(((pi / 4.0) * f)) - exp(-((pi / 4.0) * f)))))); end
function tmp = code(f) tmp = (-4.0 * ((log((4.0 / pi)) - log(f)) / pi)) + (pi * ((f ^ 2.0) * -0.08333333333333333)); end
code[f_] := (-N[(N[(1.0 / N[(Pi / 4.0), $MachinePrecision]), $MachinePrecision] * N[Log[N[(N[(N[Exp[N[(N[(Pi / 4.0), $MachinePrecision] * f), $MachinePrecision]], $MachinePrecision] + N[Exp[(-N[(N[(Pi / 4.0), $MachinePrecision] * f), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] / N[(N[Exp[N[(N[(Pi / 4.0), $MachinePrecision] * f), $MachinePrecision]], $MachinePrecision] - N[Exp[(-N[(N[(Pi / 4.0), $MachinePrecision] * f), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])
code[f_] := N[(N[(-4.0 * N[(N[(N[Log[N[(4.0 / Pi), $MachinePrecision]], $MachinePrecision] - N[Log[f], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision] + N[(Pi * N[(N[Power[f, 2.0], $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
-\frac{1}{\frac{\pi}{4}} \cdot \log \left(\frac{e^{\frac{\pi}{4} \cdot f} + e^{-\frac{\pi}{4} \cdot f}}{e^{\frac{\pi}{4} \cdot f} - e^{-\frac{\pi}{4} \cdot f}}\right)
-4 \cdot \frac{\log \left(\frac{4}{\pi}\right) - \log f}{\pi} + \pi \cdot \left({f}^{2} \cdot -0.08333333333333333\right)
Results
Initial program 61.4
Simplified61.4
[Start]61.4 | \[ -\frac{1}{\frac{\pi}{4}} \cdot \log \left(\frac{e^{\frac{\pi}{4} \cdot f} + e^{-\frac{\pi}{4} \cdot f}}{e^{\frac{\pi}{4} \cdot f} - e^{-\frac{\pi}{4} \cdot f}}\right)
\] |
|---|---|
rational_best_45_simplify-12 [=>]61.4 | \[ \color{blue}{\left(\frac{1}{\frac{\pi}{4}} \cdot \log \left(\frac{e^{\frac{\pi}{4} \cdot f} + e^{-\frac{\pi}{4} \cdot f}}{e^{\frac{\pi}{4} \cdot f} - e^{-\frac{\pi}{4} \cdot f}}\right)\right) \cdot -1}
\] |
rational_best_45_simplify-91 [=>]61.4 | \[ \color{blue}{-1 \cdot \left(\frac{1}{\frac{\pi}{4}} \cdot \log \left(\frac{e^{\frac{\pi}{4} \cdot f} + e^{-\frac{\pi}{4} \cdot f}}{e^{\frac{\pi}{4} \cdot f} - e^{-\frac{\pi}{4} \cdot f}}\right)\right)}
\] |
rational_best_45_simplify-91 [=>]61.4 | \[ -1 \cdot \color{blue}{\left(\log \left(\frac{e^{\frac{\pi}{4} \cdot f} + e^{-\frac{\pi}{4} \cdot f}}{e^{\frac{\pi}{4} \cdot f} - e^{-\frac{\pi}{4} \cdot f}}\right) \cdot \frac{1}{\frac{\pi}{4}}\right)}
\] |
rational_best_45_simplify-25 [=>]61.4 | \[ \color{blue}{\log \left(\frac{e^{\frac{\pi}{4} \cdot f} + e^{-\frac{\pi}{4} \cdot f}}{e^{\frac{\pi}{4} \cdot f} - e^{-\frac{\pi}{4} \cdot f}}\right) \cdot \left(-1 \cdot \frac{1}{\frac{\pi}{4}}\right)}
\] |
Taylor expanded in f around 0 2.5
Simplified2.5
[Start]2.5 | \[ \log \left(\frac{e^{\frac{\pi}{4} \cdot f} + e^{\frac{\pi}{4} \cdot \left(-f\right)}}{\left(0.25 \cdot \pi - -0.25 \cdot \pi\right) \cdot f + {f}^{3} \cdot \left(0.0026041666666666665 \cdot {\pi}^{3} - -0.0026041666666666665 \cdot {\pi}^{3}\right)}\right) \cdot \left(-\frac{1}{\frac{\pi}{4}}\right)
\] |
|---|---|
rational_best_45_simplify-91 [=>]2.5 | \[ \log \left(\frac{e^{\frac{\pi}{4} \cdot f} + e^{\frac{\pi}{4} \cdot \left(-f\right)}}{\left(0.25 \cdot \pi - \color{blue}{\pi \cdot -0.25}\right) \cdot f + {f}^{3} \cdot \left(0.0026041666666666665 \cdot {\pi}^{3} - -0.0026041666666666665 \cdot {\pi}^{3}\right)}\right) \cdot \left(-\frac{1}{\frac{\pi}{4}}\right)
\] |
rational_best_45_simplify-95 [=>]2.5 | \[ \log \left(\frac{e^{\frac{\pi}{4} \cdot f} + e^{\frac{\pi}{4} \cdot \left(-f\right)}}{\color{blue}{\left(\pi \cdot \left(0.25 - -0.25\right)\right)} \cdot f + {f}^{3} \cdot \left(0.0026041666666666665 \cdot {\pi}^{3} - -0.0026041666666666665 \cdot {\pi}^{3}\right)}\right) \cdot \left(-\frac{1}{\frac{\pi}{4}}\right)
\] |
metadata-eval [=>]2.5 | \[ \log \left(\frac{e^{\frac{\pi}{4} \cdot f} + e^{\frac{\pi}{4} \cdot \left(-f\right)}}{\left(\pi \cdot \color{blue}{0.5}\right) \cdot f + {f}^{3} \cdot \left(0.0026041666666666665 \cdot {\pi}^{3} - -0.0026041666666666665 \cdot {\pi}^{3}\right)}\right) \cdot \left(-\frac{1}{\frac{\pi}{4}}\right)
\] |
rational_best_45_simplify-91 [=>]2.5 | \[ \log \left(\frac{e^{\frac{\pi}{4} \cdot f} + e^{\frac{\pi}{4} \cdot \left(-f\right)}}{\left(\pi \cdot 0.5\right) \cdot f + {f}^{3} \cdot \left(0.0026041666666666665 \cdot {\pi}^{3} - \color{blue}{{\pi}^{3} \cdot -0.0026041666666666665}\right)}\right) \cdot \left(-\frac{1}{\frac{\pi}{4}}\right)
\] |
rational_best_45_simplify-95 [=>]2.5 | \[ \log \left(\frac{e^{\frac{\pi}{4} \cdot f} + e^{\frac{\pi}{4} \cdot \left(-f\right)}}{\left(\pi \cdot 0.5\right) \cdot f + {f}^{3} \cdot \color{blue}{\left({\pi}^{3} \cdot \left(0.0026041666666666665 - -0.0026041666666666665\right)\right)}}\right) \cdot \left(-\frac{1}{\frac{\pi}{4}}\right)
\] |
metadata-eval [=>]2.5 | \[ \log \left(\frac{e^{\frac{\pi}{4} \cdot f} + e^{\frac{\pi}{4} \cdot \left(-f\right)}}{\left(\pi \cdot 0.5\right) \cdot f + {f}^{3} \cdot \left({\pi}^{3} \cdot \color{blue}{0.005208333333333333}\right)}\right) \cdot \left(-\frac{1}{\frac{\pi}{4}}\right)
\] |
Taylor expanded in f around 0 2.4
Simplified2.4
[Start]2.4 | \[ \left(0.5 \cdot \left({f}^{2} \cdot \left(-0.25 \cdot {\left(-0.25 \cdot \pi + 0.25 \cdot \pi\right)}^{2} + 0.5 \cdot \left(\left(0.125 \cdot \pi - 0.041666666666666664 \cdot \pi\right) \cdot \pi\right)\right)\right) + \left(0.5 \cdot \left(f \cdot \left(-0.25 \cdot \pi + 0.25 \cdot \pi\right)\right) + \left(\log \left(\frac{4}{\pi}\right) + -1 \cdot \log f\right)\right)\right) \cdot \left(-\frac{1}{\frac{\pi}{4}}\right)
\] |
|---|---|
rational_best_45_simplify-80 [=>]2.4 | \[ \left(0.5 \cdot \left({f}^{2} \cdot \left(-0.25 \cdot {\left(-0.25 \cdot \pi + 0.25 \cdot \pi\right)}^{2} + 0.5 \cdot \left(\left(0.125 \cdot \pi - 0.041666666666666664 \cdot \pi\right) \cdot \pi\right)\right)\right) + \color{blue}{\left(\log \left(\frac{4}{\pi}\right) + \left(0.5 \cdot \left(f \cdot \left(-0.25 \cdot \pi + 0.25 \cdot \pi\right)\right) + -1 \cdot \log f\right)\right)}\right) \cdot \left(-\frac{1}{\frac{\pi}{4}}\right)
\] |
rational_best_45_simplify-80 [=>]2.4 | \[ \color{blue}{\left(\log \left(\frac{4}{\pi}\right) + \left(0.5 \cdot \left({f}^{2} \cdot \left(-0.25 \cdot {\left(-0.25 \cdot \pi + 0.25 \cdot \pi\right)}^{2} + 0.5 \cdot \left(\left(0.125 \cdot \pi - 0.041666666666666664 \cdot \pi\right) \cdot \pi\right)\right)\right) + \left(0.5 \cdot \left(f \cdot \left(-0.25 \cdot \pi + 0.25 \cdot \pi\right)\right) + -1 \cdot \log f\right)\right)\right)} \cdot \left(-\frac{1}{\frac{\pi}{4}}\right)
\] |
Taylor expanded in f around 0 2.3
Simplified2.3
[Start]2.3 | \[ -4 \cdot \frac{\log \left(\frac{4}{\pi}\right) - \log f}{\pi} + -0.08333333333333333 \cdot \left({f}^{2} \cdot \pi\right)
\] |
|---|---|
rational_best_45_simplify-25 [=>]2.3 | \[ -4 \cdot \frac{\log \left(\frac{4}{\pi}\right) - \log f}{\pi} + \color{blue}{{f}^{2} \cdot \left(-0.08333333333333333 \cdot \pi\right)}
\] |
rational_best_45_simplify-91 [=>]2.3 | \[ -4 \cdot \frac{\log \left(\frac{4}{\pi}\right) - \log f}{\pi} + {f}^{2} \cdot \color{blue}{\left(\pi \cdot -0.08333333333333333\right)}
\] |
rational_best_45_simplify-25 [=>]2.3 | \[ -4 \cdot \frac{\log \left(\frac{4}{\pi}\right) - \log f}{\pi} + \color{blue}{\pi \cdot \left({f}^{2} \cdot -0.08333333333333333\right)}
\] |
Final simplification2.3
| Alternative 1 | |
|---|---|
| Error | 2.4 |
| Cost | 26944 |
| Alternative 2 | |
|---|---|
| Error | 2.7 |
| Cost | 26048 |
| Alternative 3 | |
|---|---|
| Error | 2.8 |
| Cost | 19840 |
| Alternative 4 | |
|---|---|
| Error | 61.3 |
| Cost | 13120 |
herbie shell --seed 2023098
(FPCore (f)
:name "VandenBroeck and Keller, Equation (20)"
:precision binary64
(- (* (/ 1.0 (/ PI 4.0)) (log (/ (+ (exp (* (/ PI 4.0) f)) (exp (- (* (/ PI 4.0) f)))) (- (exp (* (/ PI 4.0) f)) (exp (- (* (/ PI 4.0) f)))))))))