Hyperbolic arc-cosine

Percentage Accurate: 51.5% → 99.5%
Time: 6.4s
Alternatives: 3
Speedup: TODO×

Specification

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

Your Program's Arguments

Results

Enter valid numbers for all inputs

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 3 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Alternative 1?

\[\log \left(x \cdot 2 - \frac{0.5}{x}\right) \]
Derivation
  1. Initial program 52.3%

    \[\log \left(x + \sqrt{x \cdot x - 1}\right) \]
  2. Taylor expanded in x around inf 99.0%

    \[\leadsto \log \color{blue}{\left(2 \cdot x - 0.5 \cdot \frac{1}{x}\right)} \]
  3. Step-by-step derivation
    1. *-commutative99.0%

      \[\leadsto \log \left(\color{blue}{x \cdot 2} - 0.5 \cdot \frac{1}{x}\right) \]
    2. associate-*r/99.0%

      \[\leadsto \log \left(x \cdot 2 - \color{blue}{\frac{0.5 \cdot 1}{x}}\right) \]
    3. metadata-eval99.0%

      \[\leadsto \log \left(x \cdot 2 - \frac{\color{blue}{0.5}}{x}\right) \]
  4. Simplified99.0%

    \[\leadsto \log \color{blue}{\left(x \cdot 2 - \frac{0.5}{x}\right)} \]
  5. Final simplification99.0%

    \[\leadsto \log \left(x \cdot 2 - \frac{0.5}{x}\right) \]

Alternative 2?

\[\log \left(x + x\right) \]
Derivation
  1. Initial program 52.3%

    \[\log \left(x + \sqrt{x \cdot x - 1}\right) \]
  2. Taylor expanded in x around inf 98.4%

    \[\leadsto \log \left(x + \color{blue}{x}\right) \]
  3. Final simplification98.4%

    \[\leadsto \log \left(x + x\right) \]

Alternative 3?

\[-1 \]
Derivation
  1. Initial program 52.3%

    \[\log \left(x + \sqrt{x \cdot x - 1}\right) \]
  2. Taylor expanded in x around inf 98.4%

    \[\leadsto \log \left(x + \color{blue}{x}\right) \]
  3. Taylor expanded in x around 0 98.4%

    \[\leadsto \color{blue}{\log 2 + \log x} \]
  4. Simplified1.6%

    \[\leadsto \color{blue}{-1} \]
  5. Final simplification1.6%

    \[\leadsto -1 \]

Reproduce

?
herbie shell --seed 2023166 
(FPCore (x)
  :name "Hyperbolic arc-cosine"
  :precision binary64
  (log (+ x (sqrt (- (* x x) 1.0)))))