| Alternative 1 | |
|---|---|
| Error | 2.2 |
| Cost | 52608 |
\[\frac{-4}{\pi} \cdot \log \left(\frac{\frac{4}{\pi}}{f} + f \cdot \left(0.0625 \cdot \frac{\pi}{0.5} + \frac{{\pi}^{3} \cdot -0.010416666666666666}{0.25 \cdot {\pi}^{2}}\right)\right)
\]
(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
(let* ((t_0 (+ (* 0.25 PI) (* 0.25 PI)))
(t_1 (/ PI t_0))
(t_2 (+ (* -0.25 t_1) (* 0.25 t_1)))
(t_3 (pow t_0 2.0))
(t_4 (* (pow PI 3.0) -0.0026041666666666665)))
(*
(+
(*
0.5
(*
(+
(* -0.25 (* t_3 (pow t_2 2.0)))
(*
t_0
(+ (* 0.0625 (/ (pow PI 2.0) t_0)) (* 2.0 (/ (+ t_4 t_4) t_3)))))
(pow f 2.0)))
(- (- (* 0.5 (* t_0 (* t_2 f))) (log f)) (log (/ PI 4.0))))
(/ -4.0 PI))))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) {
double t_0 = (0.25 * ((double) M_PI)) + (0.25 * ((double) M_PI));
double t_1 = ((double) M_PI) / t_0;
double t_2 = (-0.25 * t_1) + (0.25 * t_1);
double t_3 = pow(t_0, 2.0);
double t_4 = pow(((double) M_PI), 3.0) * -0.0026041666666666665;
return ((0.5 * (((-0.25 * (t_3 * pow(t_2, 2.0))) + (t_0 * ((0.0625 * (pow(((double) M_PI), 2.0) / t_0)) + (2.0 * ((t_4 + t_4) / t_3))))) * pow(f, 2.0))) + (((0.5 * (t_0 * (t_2 * f))) - log(f)) - log((((double) M_PI) / 4.0)))) * (-4.0 / ((double) M_PI));
}
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) {
double t_0 = (0.25 * Math.PI) + (0.25 * Math.PI);
double t_1 = Math.PI / t_0;
double t_2 = (-0.25 * t_1) + (0.25 * t_1);
double t_3 = Math.pow(t_0, 2.0);
double t_4 = Math.pow(Math.PI, 3.0) * -0.0026041666666666665;
return ((0.5 * (((-0.25 * (t_3 * Math.pow(t_2, 2.0))) + (t_0 * ((0.0625 * (Math.pow(Math.PI, 2.0) / t_0)) + (2.0 * ((t_4 + t_4) / t_3))))) * Math.pow(f, 2.0))) + (((0.5 * (t_0 * (t_2 * f))) - Math.log(f)) - Math.log((Math.PI / 4.0)))) * (-4.0 / Math.PI);
}
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): t_0 = (0.25 * math.pi) + (0.25 * math.pi) t_1 = math.pi / t_0 t_2 = (-0.25 * t_1) + (0.25 * t_1) t_3 = math.pow(t_0, 2.0) t_4 = math.pow(math.pi, 3.0) * -0.0026041666666666665 return ((0.5 * (((-0.25 * (t_3 * math.pow(t_2, 2.0))) + (t_0 * ((0.0625 * (math.pow(math.pi, 2.0) / t_0)) + (2.0 * ((t_4 + t_4) / t_3))))) * math.pow(f, 2.0))) + (((0.5 * (t_0 * (t_2 * f))) - math.log(f)) - math.log((math.pi / 4.0)))) * (-4.0 / math.pi)
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) t_0 = Float64(Float64(0.25 * pi) + Float64(0.25 * pi)) t_1 = Float64(pi / t_0) t_2 = Float64(Float64(-0.25 * t_1) + Float64(0.25 * t_1)) t_3 = t_0 ^ 2.0 t_4 = Float64((pi ^ 3.0) * -0.0026041666666666665) return Float64(Float64(Float64(0.5 * Float64(Float64(Float64(-0.25 * Float64(t_3 * (t_2 ^ 2.0))) + Float64(t_0 * Float64(Float64(0.0625 * Float64((pi ^ 2.0) / t_0)) + Float64(2.0 * Float64(Float64(t_4 + t_4) / t_3))))) * (f ^ 2.0))) + Float64(Float64(Float64(0.5 * Float64(t_0 * Float64(t_2 * f))) - log(f)) - log(Float64(pi / 4.0)))) * Float64(-4.0 / pi)) 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) t_0 = (0.25 * pi) + (0.25 * pi); t_1 = pi / t_0; t_2 = (-0.25 * t_1) + (0.25 * t_1); t_3 = t_0 ^ 2.0; t_4 = (pi ^ 3.0) * -0.0026041666666666665; tmp = ((0.5 * (((-0.25 * (t_3 * (t_2 ^ 2.0))) + (t_0 * ((0.0625 * ((pi ^ 2.0) / t_0)) + (2.0 * ((t_4 + t_4) / t_3))))) * (f ^ 2.0))) + (((0.5 * (t_0 * (t_2 * f))) - log(f)) - log((pi / 4.0)))) * (-4.0 / pi); 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_] := Block[{t$95$0 = N[(N[(0.25 * Pi), $MachinePrecision] + N[(0.25 * Pi), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(Pi / t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(-0.25 * t$95$1), $MachinePrecision] + N[(0.25 * t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Power[t$95$0, 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(N[Power[Pi, 3.0], $MachinePrecision] * -0.0026041666666666665), $MachinePrecision]}, N[(N[(N[(0.5 * N[(N[(N[(-0.25 * N[(t$95$3 * N[Power[t$95$2, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * N[(N[(0.0625 * N[(N[Power[Pi, 2.0], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(N[(t$95$4 + t$95$4), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Power[f, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(0.5 * N[(t$95$0 * N[(t$95$2 * f), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Log[f], $MachinePrecision]), $MachinePrecision] - N[Log[N[(Pi / 4.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-4.0 / Pi), $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)
\begin{array}{l}
t_0 := 0.25 \cdot \pi + 0.25 \cdot \pi\\
t_1 := \frac{\pi}{t_0}\\
t_2 := -0.25 \cdot t_1 + 0.25 \cdot t_1\\
t_3 := {t_0}^{2}\\
t_4 := {\pi}^{3} \cdot -0.0026041666666666665\\
\left(0.5 \cdot \left(\left(-0.25 \cdot \left(t_3 \cdot {t_2}^{2}\right) + t_0 \cdot \left(0.0625 \cdot \frac{{\pi}^{2}}{t_0} + 2 \cdot \frac{t_4 + t_4}{t_3}\right)\right) \cdot {f}^{2}\right) + \left(\left(0.5 \cdot \left(t_0 \cdot \left(t_2 \cdot f\right)\right) - \log f\right) - \log \left(\frac{\pi}{4}\right)\right)\right) \cdot \frac{-4}{\pi}
\end{array}
Results
Initial program 61.2
Simplified61.2
Taylor expanded in f around 0 2.2
Applied egg-rr2.2
Simplified2.2
Final simplification2.2
| Alternative 1 | |
|---|---|
| Error | 2.2 |
| Cost | 52608 |
| Alternative 2 | |
|---|---|
| Error | 2.5 |
| Cost | 26048 |
| Alternative 3 | |
|---|---|
| Error | 2.6 |
| Cost | 19648 |
| Alternative 4 | |
|---|---|
| Error | 60.5 |
| Cost | 13120 |
| Alternative 5 | |
|---|---|
| Error | 60.9 |
| Cost | 64 |
herbie shell --seed 2022338
(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)))))))))