Average Error: 41.0 → 0.0
Time: 4.4s
Precision: binary64
Cost: 12992
\[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}} \]
\[\sqrt{2 + \mathsf{expm1}\left(x\right)} \]
(FPCore (x)
 :precision binary64
 (sqrt (/ (- (exp (* 2.0 x)) 1.0) (- (exp x) 1.0))))
(FPCore (x) :precision binary64 (sqrt (+ 2.0 (expm1 x))))
double code(double x) {
	return sqrt(((exp((2.0 * x)) - 1.0) / (exp(x) - 1.0)));
}
double code(double x) {
	return sqrt((2.0 + expm1(x)));
}
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.sqrt((2.0 + Math.expm1(x)));
}
def code(x):
	return math.sqrt(((math.exp((2.0 * x)) - 1.0) / (math.exp(x) - 1.0)))
def code(x):
	return math.sqrt((2.0 + math.expm1(x)))
function code(x)
	return sqrt(Float64(Float64(exp(Float64(2.0 * x)) - 1.0) / Float64(exp(x) - 1.0)))
end
function code(x)
	return sqrt(Float64(2.0 + expm1(x)))
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[N[(2.0 + N[(Exp[x] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}
\sqrt{2 + \mathsf{expm1}\left(x\right)}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 41.0

    \[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}} \]
  2. Simplified0.0

    \[\leadsto \color{blue}{\sqrt{1 + e^{x}}} \]
    Proof

    [Start]41.0

    \[ \sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}} \]

    *-commutative [=>]41.0

    \[ \sqrt{\frac{e^{\color{blue}{x \cdot 2}} - 1}{e^{x} - 1}} \]

    exp-lft-sqr [=>]40.8

    \[ \sqrt{\frac{\color{blue}{e^{x} \cdot e^{x}} - 1}{e^{x} - 1}} \]

    difference-of-sqr-1 [=>]40.4

    \[ \sqrt{\frac{\color{blue}{\left(e^{x} + 1\right) \cdot \left(e^{x} - 1\right)}}{e^{x} - 1}} \]

    associate-/l* [=>]40.4

    \[ \sqrt{\color{blue}{\frac{e^{x} + 1}{\frac{e^{x} - 1}{e^{x} - 1}}}} \]

    *-inverses [=>]0.0

    \[ \sqrt{\frac{e^{x} + 1}{\color{blue}{1}}} \]

    /-rgt-identity [=>]0.0

    \[ \sqrt{\color{blue}{e^{x} + 1}} \]

    +-commutative [=>]0.0

    \[ \sqrt{\color{blue}{1 + e^{x}}} \]
  3. Applied egg-rr0.7

    \[\leadsto \color{blue}{\left(1 + \mathsf{hypot}\left(1, \sqrt{e^{x}}\right)\right) - 1} \]
  4. Simplified0.0

    \[\leadsto \color{blue}{\sqrt{2 + \mathsf{expm1}\left(x\right)}} \]
    Proof

    [Start]0.7

    \[ \left(1 + \mathsf{hypot}\left(1, \sqrt{e^{x}}\right)\right) - 1 \]

    +-commutative [=>]0.7

    \[ \color{blue}{\left(\mathsf{hypot}\left(1, \sqrt{e^{x}}\right) + 1\right)} - 1 \]

    associate--l+ [=>]0.0

    \[ \color{blue}{\mathsf{hypot}\left(1, \sqrt{e^{x}}\right) + \left(1 - 1\right)} \]

    metadata-eval [=>]0.0

    \[ \mathsf{hypot}\left(1, \sqrt{e^{x}}\right) + \color{blue}{0} \]

    +-rgt-identity [=>]0.0

    \[ \color{blue}{\mathsf{hypot}\left(1, \sqrt{e^{x}}\right)} \]

    hypot-1-def [<=]0.0

    \[ \color{blue}{\sqrt{1 + \sqrt{e^{x}} \cdot \sqrt{e^{x}}}} \]

    rem-square-sqrt [=>]0.0

    \[ \sqrt{1 + \color{blue}{e^{x}}} \]

    +-commutative [=>]0.0

    \[ \sqrt{\color{blue}{e^{x} + 1}} \]

    metadata-eval [<=]0.0

    \[ \sqrt{e^{x} + \color{blue}{\left(2 - 1\right)}} \]

    associate--l+ [<=]0.0

    \[ \sqrt{\color{blue}{\left(e^{x} + 2\right) - 1}} \]

    +-commutative [<=]0.0

    \[ \sqrt{\color{blue}{\left(2 + e^{x}\right)} - 1} \]

    associate--l+ [=>]0.0

    \[ \sqrt{\color{blue}{2 + \left(e^{x} - 1\right)}} \]

    expm1-def [=>]0.0

    \[ \sqrt{2 + \color{blue}{\mathsf{expm1}\left(x\right)}} \]
  5. Final simplification0.0

    \[\leadsto \sqrt{2 + \mathsf{expm1}\left(x\right)} \]

Alternatives

Alternative 1
Error0.0
Cost12992
\[\sqrt{1 + e^{x}} \]
Alternative 2
Error17.8
Cost6464
\[\sqrt{2} \]

Error

Reproduce

herbie shell --seed 2023017 
(FPCore (x)
  :name "sqrtexp (problem 3.4.4)"
  :precision binary64
  (sqrt (/ (- (exp (* 2.0 x)) 1.0) (- (exp x) 1.0))))