| Alternative 1 | |
|---|---|
| Error | 0.6 |
| Cost | 26112 |
\[\frac{-\log \tanh \left(\pi \cdot \left(f \cdot 0.25\right)\right)}{\pi \cdot -0.25}
\]
(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 (/ (* (log (sqrt (tanh (* f (* PI 0.25))))) -2.0) (* PI -0.25)))
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 (log(sqrt(tanh((f * (((double) M_PI) * 0.25))))) * -2.0) / (((double) M_PI) * -0.25);
}
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 (Math.log(Math.sqrt(Math.tanh((f * (Math.PI * 0.25))))) * -2.0) / (Math.PI * -0.25);
}
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 (math.log(math.sqrt(math.tanh((f * (math.pi * 0.25))))) * -2.0) / (math.pi * -0.25)
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(log(sqrt(tanh(Float64(f * Float64(pi * 0.25))))) * -2.0) / Float64(pi * -0.25)) 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 = (log(sqrt(tanh((f * (pi * 0.25))))) * -2.0) / (pi * -0.25); 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[(N[Log[N[Sqrt[N[Tanh[N[(f * N[(Pi * 0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * -2.0), $MachinePrecision] / N[(Pi * -0.25), $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)
\frac{\log \left(\sqrt{\tanh \left(f \cdot \left(\pi \cdot 0.25\right)\right)}\right) \cdot -2}{\pi \cdot -0.25}
Results
Initial program 61.5
Applied egg-rr2.8
Applied egg-rr0.6
Applied egg-rr0.6
Final simplification0.6
| Alternative 1 | |
|---|---|
| Error | 0.6 |
| Cost | 26112 |
| Alternative 2 | |
|---|---|
| Error | 2.7 |
| Cost | 26048 |
| Alternative 3 | |
|---|---|
| Error | 0.7 |
| Cost | 26048 |
| Alternative 4 | |
|---|---|
| Error | 62.9 |
| Cost | 19648 |
| Alternative 5 | |
|---|---|
| Error | 2.7 |
| Cost | 19648 |
| Alternative 6 | |
|---|---|
| Error | 2.7 |
| Cost | 19648 |

herbie shell --seed 2022312
(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)))))))))