| Alternative 1 | |
|---|---|
| Error | 0.6 |
| Cost | 13760 |
\[\frac{2 \cdot x + \left(0.3333333333333333 \cdot {x}^{3} + 0.016666666666666666 \cdot {x}^{5}\right)}{2}
\]
(FPCore (x) :precision binary64 (/ (- (exp x) (exp (- x))) 2.0))
(FPCore (x)
:precision binary64
(/
(+
(* 2.0 x)
(+
(* 0.3333333333333333 (pow x 3.0))
(+
(* 0.016666666666666666 (pow x 5.0))
(* 0.0003968253968253968 (pow x 7.0)))))
2.0))double code(double x) {
return (exp(x) - exp(-x)) / 2.0;
}
double code(double x) {
return ((2.0 * x) + ((0.3333333333333333 * pow(x, 3.0)) + ((0.016666666666666666 * pow(x, 5.0)) + (0.0003968253968253968 * pow(x, 7.0))))) / 2.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (exp(x) - exp(-x)) / 2.0d0
end function
real(8) function code(x)
real(8), intent (in) :: x
code = ((2.0d0 * x) + ((0.3333333333333333d0 * (x ** 3.0d0)) + ((0.016666666666666666d0 * (x ** 5.0d0)) + (0.0003968253968253968d0 * (x ** 7.0d0))))) / 2.0d0
end function
public static double code(double x) {
return (Math.exp(x) - Math.exp(-x)) / 2.0;
}
public static double code(double x) {
return ((2.0 * x) + ((0.3333333333333333 * Math.pow(x, 3.0)) + ((0.016666666666666666 * Math.pow(x, 5.0)) + (0.0003968253968253968 * Math.pow(x, 7.0))))) / 2.0;
}
def code(x): return (math.exp(x) - math.exp(-x)) / 2.0
def code(x): return ((2.0 * x) + ((0.3333333333333333 * math.pow(x, 3.0)) + ((0.016666666666666666 * math.pow(x, 5.0)) + (0.0003968253968253968 * math.pow(x, 7.0))))) / 2.0
function code(x) return Float64(Float64(exp(x) - exp(Float64(-x))) / 2.0) end
function code(x) return Float64(Float64(Float64(2.0 * x) + Float64(Float64(0.3333333333333333 * (x ^ 3.0)) + Float64(Float64(0.016666666666666666 * (x ^ 5.0)) + Float64(0.0003968253968253968 * (x ^ 7.0))))) / 2.0) end
function tmp = code(x) tmp = (exp(x) - exp(-x)) / 2.0; end
function tmp = code(x) tmp = ((2.0 * x) + ((0.3333333333333333 * (x ^ 3.0)) + ((0.016666666666666666 * (x ^ 5.0)) + (0.0003968253968253968 * (x ^ 7.0))))) / 2.0; end
code[x_] := N[(N[(N[Exp[x], $MachinePrecision] - N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
code[x_] := N[(N[(N[(2.0 * x), $MachinePrecision] + N[(N[(0.3333333333333333 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.016666666666666666 * N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision] + N[(0.0003968253968253968 * N[Power[x, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\frac{e^{x} - e^{-x}}{2}
\frac{2 \cdot x + \left(0.3333333333333333 \cdot {x}^{3} + \left(0.016666666666666666 \cdot {x}^{5} + 0.0003968253968253968 \cdot {x}^{7}\right)\right)}{2}
Results
Initial program 58.1
Taylor expanded in x around 0 0.6
Simplified0.6
[Start]0.6 | \[ \frac{2 \cdot x + \left(0.3333333333333333 \cdot {x}^{3} + \left(0.0003968253968253968 \cdot {x}^{7} + 0.016666666666666666 \cdot {x}^{5}\right)\right)}{2}
\] |
|---|---|
rational_best_45_simplify-73 [=>]0.6 | \[ \frac{2 \cdot x + \left(0.3333333333333333 \cdot {x}^{3} + \color{blue}{\left(0.016666666666666666 \cdot {x}^{5} + 0.0003968253968253968 \cdot {x}^{7}\right)}\right)}{2}
\] |
Final simplification0.6
| Alternative 1 | |
|---|---|
| Error | 0.6 |
| Cost | 13760 |
| Alternative 2 | |
|---|---|
| Error | 1.1 |
| Cost | 7040 |
| Alternative 3 | |
|---|---|
| Error | 0.7 |
| Cost | 7040 |
| Alternative 4 | |
|---|---|
| Error | 1.1 |
| Cost | 320 |
herbie shell --seed 2023098
(FPCore (x)
:name "Hyperbolic sine"
:precision binary64
(/ (- (exp x) (exp (- x))) 2.0))