| Alternative 1 | |
|---|---|
| Error | 1.1 |
| Cost | 26048 |
\[\cos x \cdot {\left({\left(e^{5}\right)}^{x}\right)}^{\left(x + x\right)}
\]
(FPCore (x) :precision binary64 (* (cos x) (exp (* 10.0 (* x x)))))
(FPCore (x) :precision binary64 (* (cos x) (sqrt (pow (pow (exp 20.0) x) x))))
double code(double x) {
return cos(x) * exp((10.0 * (x * x)));
}
double code(double x) {
return cos(x) * sqrt(pow(pow(exp(20.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) * sqrt(((exp(20.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.sqrt(Math.pow(Math.pow(Math.exp(20.0), x), x));
}
def code(x): return math.cos(x) * math.exp((10.0 * (x * x)))
def code(x): return math.cos(x) * math.sqrt(math.pow(math.pow(math.exp(20.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) * sqrt(((exp(20.0) ^ x) ^ x))) end
function tmp = code(x) tmp = cos(x) * exp((10.0 * (x * x))); end
function tmp = code(x) tmp = cos(x) * sqrt(((exp(20.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[Sqrt[N[Power[N[Power[N[Exp[20.0], $MachinePrecision], x], $MachinePrecision], x], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\cos x \cdot e^{10 \cdot \left(x \cdot x\right)}
\cos x \cdot \sqrt{{\left({\left(e^{20}\right)}^{x}\right)}^{x}}
Results
Initial program 3.5
Applied egg-rr1.3
Applied egg-rr1.3
Simplified1.3
[Start]1.3 | \[ \cos x \cdot \left({\left(\sqrt{{\left(e^{10}\right)}^{x}}\right)}^{x} \cdot {\left(\sqrt{{\left(e^{10}\right)}^{x}}\right)}^{x}\right)
\] |
|---|---|
pow-sqr [=>]1.3 | \[ \cos x \cdot \color{blue}{{\left(\sqrt{{\left(e^{10}\right)}^{x}}\right)}^{\left(2 \cdot x\right)}}
\] |
*-commutative [=>]1.3 | \[ \cos x \cdot {\left(\sqrt{{\left(e^{10}\right)}^{x}}\right)}^{\color{blue}{\left(x \cdot 2\right)}}
\] |
Applied egg-rr0.4
Final simplification0.4
| Alternative 1 | |
|---|---|
| Error | 1.1 |
| Cost | 26048 |
| Alternative 2 | |
|---|---|
| Error | 0.4 |
| Cost | 26048 |
| Alternative 3 | |
|---|---|
| Error | 1.3 |
| Cost | 25920 |
| Alternative 4 | |
|---|---|
| Error | 3.0 |
| Cost | 19712 |
| Alternative 5 | |
|---|---|
| Error | 3.0 |
| Cost | 19712 |
| Alternative 6 | |
|---|---|
| Error | 3.0 |
| Cost | 19584 |
| Alternative 7 | |
|---|---|
| Error | 3.5 |
| Cost | 13248 |
| Alternative 8 | |
|---|---|
| Error | 57.8 |
| Cost | 6464 |
| Alternative 9 | |
|---|---|
| Error | 63.0 |
| Cost | 64 |
herbie shell --seed 2023039
(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)))))