| Alternative 1 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 12992 |
\[\sqrt{1 + e^{x}}
\]
(FPCore (x) :precision binary64 (sqrt (/ (- (exp (* 2.0 x)) 1.0) (- (exp x) 1.0))))
(FPCore (x) :precision binary64 (hypot 1.0 (exp (* x 0.5))))
double code(double x) {
return sqrt(((exp((2.0 * x)) - 1.0) / (exp(x) - 1.0)));
}
double code(double x) {
return hypot(1.0, exp((x * 0.5)));
}
public static double code(double x) {
return Math.sqrt(((Math.exp((2.0 * x)) - 1.0) / (Math.exp(x) - 1.0)));
}
public static double code(double x) {
return Math.hypot(1.0, Math.exp((x * 0.5)));
}
def code(x): return math.sqrt(((math.exp((2.0 * x)) - 1.0) / (math.exp(x) - 1.0)))
def code(x): return math.hypot(1.0, math.exp((x * 0.5)))
function code(x) return sqrt(Float64(Float64(exp(Float64(2.0 * x)) - 1.0) / Float64(exp(x) - 1.0))) end
function code(x) return hypot(1.0, exp(Float64(x * 0.5))) end
function tmp = code(x) tmp = sqrt(((exp((2.0 * x)) - 1.0) / (exp(x) - 1.0))); end
function tmp = code(x) tmp = hypot(1.0, exp((x * 0.5))); end
code[x_] := N[Sqrt[N[(N[(N[Exp[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision] / N[(N[Exp[x], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[x_] := N[Sqrt[1.0 ^ 2 + N[Exp[N[(x * 0.5), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]
\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}
\mathsf{hypot}\left(1, e^{x \cdot 0.5}\right)
Results
Initial program 36.1%
Simplified100.0%
[Start]36.1 | \[ \sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}
\] |
|---|---|
*-commutative [=>]36.1 | \[ \sqrt{\frac{e^{\color{blue}{x \cdot 2}} - 1}{e^{x} - 1}}
\] |
exp-lft-sqr [=>]36.5 | \[ \sqrt{\frac{\color{blue}{e^{x} \cdot e^{x}} - 1}{e^{x} - 1}}
\] |
difference-of-sqr-1 [=>]37.1 | \[ \sqrt{\frac{\color{blue}{\left(e^{x} + 1\right) \cdot \left(e^{x} - 1\right)}}{e^{x} - 1}}
\] |
associate-/l* [=>]37.1 | \[ \sqrt{\color{blue}{\frac{e^{x} + 1}{\frac{e^{x} - 1}{e^{x} - 1}}}}
\] |
*-inverses [=>]100.0 | \[ \sqrt{\frac{e^{x} + 1}{\color{blue}{1}}}
\] |
/-rgt-identity [=>]100.0 | \[ \sqrt{\color{blue}{e^{x} + 1}}
\] |
+-commutative [=>]100.0 | \[ \sqrt{\color{blue}{1 + e^{x}}}
\] |
Applied egg-rr100.0%
[Start]100.0 | \[ \sqrt{1 + e^{x}}
\] |
|---|---|
add-sqr-sqrt [=>]99.9 | \[ \sqrt{1 + \color{blue}{\sqrt{e^{x}} \cdot \sqrt{e^{x}}}}
\] |
hypot-1-def [=>]100.0 | \[ \color{blue}{\mathsf{hypot}\left(1, \sqrt{e^{x}}\right)}
\] |
Applied egg-rr100.0%
[Start]100.0 | \[ \mathsf{hypot}\left(1, \sqrt{e^{x}}\right)
\] |
|---|---|
pow1/2 [=>]100.0 | \[ \mathsf{hypot}\left(1, \color{blue}{{\left(e^{x}\right)}^{0.5}}\right)
\] |
pow-exp [=>]100.0 | \[ \mathsf{hypot}\left(1, \color{blue}{e^{x \cdot 0.5}}\right)
\] |
Final simplification100.0%
| Alternative 1 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 12992 |
| Alternative 2 | |
|---|---|
| Accuracy | 72.1% |
| Cost | 6464 |
| Alternative 3 | |
|---|---|
| Accuracy | 14.2% |
| Cost | 320 |
| Alternative 4 | |
|---|---|
| Accuracy | 2.9% |
| Cost | 192 |
| Alternative 5 | |
|---|---|
| Accuracy | 4.3% |
| Cost | 192 |
herbie shell --seed 2023146
(FPCore (x)
:name "sqrtexp (problem 3.4.4)"
:precision binary64
(sqrt (/ (- (exp (* 2.0 x)) 1.0) (- (exp x) 1.0))))