| Alternative 1 | |
|---|---|
| Error | 3.5 |
| Cost | 13248 |
\[\cos x \cdot e^{10 \cdot \left(x \cdot x\right)}
\]
(FPCore (x) :precision binary64 (* (cos x) (exp (* 10.0 (* x x)))))
(FPCore (x) :precision binary64 (* (cos x) (* (exp (* x (* x 5.0))) (exp (* 5.0 (* x x))))))
double code(double x) {
return cos(x) * exp((10.0 * (x * x)));
}
double code(double x) {
return cos(x) * (exp((x * (x * 5.0))) * exp((5.0 * (x * x))));
}
real(8) function code(x)
real(8), intent (in) :: x
code = cos(x) * exp((10.0d0 * (x * x)))
end function
real(8) function code(x)
real(8), intent (in) :: x
code = cos(x) * (exp((x * (x * 5.0d0))) * exp((5.0d0 * (x * x))))
end function
public static double code(double x) {
return Math.cos(x) * Math.exp((10.0 * (x * x)));
}
public static double code(double x) {
return Math.cos(x) * (Math.exp((x * (x * 5.0))) * Math.exp((5.0 * (x * x))));
}
def code(x): return math.cos(x) * math.exp((10.0 * (x * x)))
def code(x): return math.cos(x) * (math.exp((x * (x * 5.0))) * math.exp((5.0 * (x * x))))
function code(x) return Float64(cos(x) * exp(Float64(10.0 * Float64(x * x)))) end
function code(x) return Float64(cos(x) * Float64(exp(Float64(x * Float64(x * 5.0))) * exp(Float64(5.0 * Float64(x * x))))) end
function tmp = code(x) tmp = cos(x) * exp((10.0 * (x * x))); end
function tmp = code(x) tmp = cos(x) * (exp((x * (x * 5.0))) * exp((5.0 * (x * x)))); end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Exp[N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Exp[N[(x * N[(x * 5.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(5.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\cos x \cdot e^{10 \cdot \left(x \cdot x\right)}
\cos x \cdot \left(e^{x \cdot \left(x \cdot 5\right)} \cdot e^{5 \cdot \left(x \cdot x\right)}\right)
Results
Initial program 3.5
Applied egg-rr3.9
Applied egg-rr3.9
Applied egg-rr3.6
Applied egg-rr3.6
Simplified3.1
[Start]3.6 | \[ \cos x \cdot \left(e^{x \cdot \left(x \cdot 5\right)} \cdot \left(e^{x \cdot \left(x \cdot 5\right)} + 0\right)\right)
\] |
|---|---|
rational.json-simplify-4 [=>]3.6 | \[ \cos x \cdot \left(e^{x \cdot \left(x \cdot 5\right)} \cdot \color{blue}{e^{x \cdot \left(x \cdot 5\right)}}\right)
\] |
rational.json-simplify-2 [=>]3.6 | \[ \cos x \cdot \left(e^{x \cdot \left(x \cdot 5\right)} \cdot e^{x \cdot \color{blue}{\left(5 \cdot x\right)}}\right)
\] |
rational.json-simplify-43 [=>]3.1 | \[ \cos x \cdot \left(e^{x \cdot \left(x \cdot 5\right)} \cdot e^{\color{blue}{5 \cdot \left(x \cdot x\right)}}\right)
\] |
Final simplification3.1
| Alternative 1 | |
|---|---|
| Error | 3.5 |
| Cost | 13248 |
| Alternative 2 | |
|---|---|
| Error | 57.8 |
| Cost | 6784 |
| Alternative 3 | |
|---|---|
| Error | 57.8 |
| Cost | 6592 |
| Alternative 4 | |
|---|---|
| Error | 63.0 |
| Cost | 64 |
herbie shell --seed 2023074
(FPCore (x)
:name "ENA, Section 1.4, Exercise 1"
:precision binary64
:pre (and (<= 1.99 x) (<= x 2.01))
(* (cos x) (exp (* 10.0 (* x x)))))