Average Error: 0.0 → 0.0
Time: 5.4s
Precision: binary64
Cost: 13376
\[\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right) \]
\[\log \left(\frac{1 + \sqrt{1 - x \cdot x}}{x}\right) \]
(FPCore (x)
 :precision binary64
 (log (+ (/ 1.0 x) (/ (sqrt (- 1.0 (* x x))) x))))
(FPCore (x) :precision binary64 (log (/ (+ 1.0 (sqrt (- 1.0 (* x x)))) x)))
double code(double x) {
	return log(((1.0 / x) + (sqrt((1.0 - (x * x))) / x)));
}
double code(double x) {
	return log(((1.0 + sqrt((1.0 - (x * x)))) / x));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = log(((1.0d0 / x) + (sqrt((1.0d0 - (x * x))) / x)))
end function
real(8) function code(x)
    real(8), intent (in) :: x
    code = log(((1.0d0 + sqrt((1.0d0 - (x * x)))) / x))
end function
public static double code(double x) {
	return Math.log(((1.0 / x) + (Math.sqrt((1.0 - (x * x))) / x)));
}
public static double code(double x) {
	return Math.log(((1.0 + Math.sqrt((1.0 - (x * x)))) / x));
}
def code(x):
	return math.log(((1.0 / x) + (math.sqrt((1.0 - (x * x))) / x)))
def code(x):
	return math.log(((1.0 + math.sqrt((1.0 - (x * x)))) / x))
function code(x)
	return log(Float64(Float64(1.0 / x) + Float64(sqrt(Float64(1.0 - Float64(x * x))) / x)))
end
function code(x)
	return log(Float64(Float64(1.0 + sqrt(Float64(1.0 - Float64(x * x)))) / x))
end
function tmp = code(x)
	tmp = log(((1.0 / x) + (sqrt((1.0 - (x * x))) / x)));
end
function tmp = code(x)
	tmp = log(((1.0 + sqrt((1.0 - (x * x)))) / x));
end
code[x_] := N[Log[N[(N[(1.0 / x), $MachinePrecision] + N[(N[Sqrt[N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[x_] := N[Log[N[(N[(1.0 + N[Sqrt[N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision]
\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right)
\log \left(\frac{1 + \sqrt{1 - x \cdot x}}{x}\right)

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right) \]
  2. Applied egg-rr0.1

    \[\leadsto \log \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\sqrt{1 - x \cdot x}}{x}\right)} - \left(1 - \frac{1}{x}\right)\right)} \]
  3. Simplified0.0

    \[\leadsto \log \color{blue}{\left(\frac{1 + \sqrt{1 - x \cdot x}}{x}\right)} \]
    Proof
    (log.f64 (/.f64 (+.f64 1 (sqrt.f64 (-.f64 1 (*.f64 x x)))) x)): 0 points increase in error, 0 points decrease in error
    (log.f64 (/.f64 (Rewrite<= *-rgt-identity_binary64 (*.f64 (+.f64 1 (sqrt.f64 (-.f64 1 (*.f64 x x)))) 1)) x)): 0 points increase in error, 0 points decrease in error
    (log.f64 (Rewrite<= associate-*r/_binary64 (*.f64 (+.f64 1 (sqrt.f64 (-.f64 1 (*.f64 x x)))) (/.f64 1 x)))): 0 points increase in error, 0 points decrease in error
    (log.f64 (*.f64 (Rewrite=> +-commutative_binary64 (+.f64 (sqrt.f64 (-.f64 1 (*.f64 x x))) 1)) (/.f64 1 x))): 0 points increase in error, 0 points decrease in error
    (log.f64 (Rewrite<= distribute-lft1-in_binary64 (+.f64 (*.f64 (sqrt.f64 (-.f64 1 (*.f64 x x))) (/.f64 1 x)) (/.f64 1 x)))): 3 points increase in error, 0 points decrease in error
    (log.f64 (+.f64 (Rewrite<= *-commutative_binary64 (*.f64 (/.f64 1 x) (sqrt.f64 (-.f64 1 (*.f64 x x))))) (/.f64 1 x))): 0 points increase in error, 3 points decrease in error
    (log.f64 (+.f64 (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 1 (sqrt.f64 (-.f64 1 (*.f64 x x)))) x)) (/.f64 1 x))): 0 points increase in error, 0 points decrease in error
    (log.f64 (+.f64 (/.f64 (Rewrite=> *-lft-identity_binary64 (sqrt.f64 (-.f64 1 (*.f64 x x)))) x) (/.f64 1 x))): 0 points increase in error, 0 points decrease in error
    (log.f64 (+.f64 (Rewrite<= expm1-log1p_binary64 (expm1.f64 (log1p.f64 (/.f64 (sqrt.f64 (-.f64 1 (*.f64 x x))) x)))) (/.f64 1 x))): 0 points increase in error, 0 points decrease in error
    (log.f64 (+.f64 (Rewrite<= expm1-def_binary64 (-.f64 (exp.f64 (log1p.f64 (/.f64 (sqrt.f64 (-.f64 1 (*.f64 x x))) x))) 1)) (/.f64 1 x))): 0 points increase in error, 0 points decrease in error
    (log.f64 (Rewrite<= associate--r-_binary64 (-.f64 (exp.f64 (log1p.f64 (/.f64 (sqrt.f64 (-.f64 1 (*.f64 x x))) x))) (-.f64 1 (/.f64 1 x))))): 0 points increase in error, 0 points decrease in error
  4. Final simplification0.0

    \[\leadsto \log \left(\frac{1 + \sqrt{1 - x \cdot x}}{x}\right) \]

Alternatives

Alternative 1
Error0.3
Cost6976
\[\log \left(x \cdot -0.5 + 2 \cdot \frac{1}{x}\right) \]
Alternative 2
Error0.6
Cost6656
\[-\log \left(x \cdot 0.5\right) \]
Alternative 3
Error0.6
Cost6592
\[\log \left(\frac{2}{x}\right) \]

Error

Reproduce

herbie shell --seed 2022343 
(FPCore (x)
  :name "Hyperbolic arc-(co)secant"
  :precision binary64
  (log (+ (/ 1.0 x) (/ (sqrt (- 1.0 (* x x))) x))))