| Alternative 1 | |
|---|---|
| Error | 0.3 |
| Cost | 7040 |
\[-\log \left(\frac{x}{2 + \left(x \cdot x\right) \cdot -0.5}\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)
Results
Initial program 0.1
Applied egg-rr0.1
Applied egg-rr0.1
Simplified0.1
[Start]0.1 | \[ \log \left(\frac{\frac{1}{x} \cdot x + \frac{1}{x} \cdot \left(x \cdot \sqrt{1 - x \cdot x}\right)}{x}\right)
\] |
|---|---|
lft-mult-inverse [=>]0.1 | \[ \log \left(\frac{\color{blue}{1} + \frac{1}{x} \cdot \left(x \cdot \sqrt{1 - x \cdot x}\right)}{x}\right)
\] |
associate-*r* [=>]0.1 | \[ \log \left(\frac{1 + \color{blue}{\left(\frac{1}{x} \cdot x\right) \cdot \sqrt{1 - x \cdot x}}}{x}\right)
\] |
lft-mult-inverse [=>]0.1 | \[ \log \left(\frac{1 + \color{blue}{1} \cdot \sqrt{1 - x \cdot x}}{x}\right)
\] |
*-lft-identity [=>]0.1 | \[ \log \left(\frac{1 + \color{blue}{\sqrt{1 - x \cdot x}}}{x}\right)
\] |
Final simplification0.1
| Alternative 1 | |
|---|---|
| Error | 0.3 |
| Cost | 7040 |
| Alternative 2 | |
|---|---|
| Error | 0.3 |
| Cost | 6976 |
| Alternative 3 | |
|---|---|
| Error | 0.3 |
| Cost | 6976 |
| Alternative 4 | |
|---|---|
| Error | 0.6 |
| Cost | 6848 |
| Alternative 5 | |
|---|---|
| Error | 0.6 |
| Cost | 6592 |
herbie shell --seed 2023187
(FPCore (x)
:name "Hyperbolic arc-(co)secant"
:precision binary64
(log (+ (/ 1.0 x) (/ (sqrt (- 1.0 (* x x))) x))))