Average Error: 61.6 → 0.7
Time: 23.1s
Precision: binary64
Cost: 26304
\[-\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) \]
\[0.3333333333333333 \cdot \frac{-3}{\frac{\pi}{\frac{\log \tanh \left(\pi \cdot \left(f \cdot 0.25\right)\right)}{-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
 (*
  0.3333333333333333
  (/ -3.0 (/ PI (/ (log (tanh (* PI (* f 0.25)))) -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 0.3333333333333333 * (-3.0 / (((double) M_PI) / (log(tanh((((double) M_PI) * (f * 0.25)))) / -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 0.3333333333333333 * (-3.0 / (Math.PI / (Math.log(Math.tanh((Math.PI * (f * 0.25)))) / -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 0.3333333333333333 * (-3.0 / (math.pi / (math.log(math.tanh((math.pi * (f * 0.25)))) / -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(0.3333333333333333 * Float64(-3.0 / Float64(pi / Float64(log(tanh(Float64(pi * Float64(f * 0.25)))) / -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 = 0.3333333333333333 * (-3.0 / (pi / (log(tanh((pi * (f * 0.25)))) / -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[(0.3333333333333333 * N[(-3.0 / N[(Pi / N[(N[Log[N[Tanh[N[(Pi * N[(f * 0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / -0.25), $MachinePrecision]), $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)
0.3333333333333333 \cdot \frac{-3}{\frac{\pi}{\frac{\log \tanh \left(\pi \cdot \left(f \cdot 0.25\right)\right)}{-0.25}}}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 61.6

    \[-\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) \]
  2. Applied egg-rr15.1

    \[\leadsto -\color{blue}{\log \left(e^{\frac{\log \left(\frac{2 \cdot \cosh \left(\frac{\pi \cdot f}{4}\right)}{2 \cdot \sinh \left(\frac{\pi \cdot f}{4}\right)}\right)}{\pi \cdot 0.25}}\right)} \]
  3. Applied egg-rr0.7

    \[\leadsto -\color{blue}{0.3333333333333333 \cdot \left(3 \cdot \frac{\log \tanh \left(\pi \cdot \left(f \cdot 0.25\right)\right)}{\pi \cdot -0.25}\right)} \]
  4. Applied egg-rr0.7

    \[\leadsto -0.3333333333333333 \cdot \color{blue}{\frac{3}{\frac{\pi}{\frac{\log \tanh \left(\pi \cdot \left(f \cdot 0.25\right)\right)}{-0.25}}}} \]
  5. Final simplification0.7

    \[\leadsto 0.3333333333333333 \cdot \frac{-3}{\frac{\pi}{\frac{\log \tanh \left(\pi \cdot \left(f \cdot 0.25\right)\right)}{-0.25}}} \]

Alternatives

Alternative 1
Error0.6
Cost26240
\[\frac{-\log \left(\frac{1}{\tanh \left(\pi \cdot \left(f \cdot 0.25\right)\right)}\right)}{\pi \cdot 0.25} \]
Alternative 2
Error0.6
Cost26112
\[\frac{-\log \tanh \left(\pi \cdot \left(f \cdot 0.25\right)\right)}{\pi \cdot -0.25} \]
Alternative 3
Error2.6
Cost19776
\[\frac{\mathsf{log1p}\left(\frac{4}{\pi \cdot f} + -1\right) \cdot -4}{\pi} \]
Alternative 4
Error2.6
Cost19648
\[\frac{-4 \cdot \log \left(\frac{\frac{4}{\pi}}{f}\right)}{\pi} \]

Error

Reproduce

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