(FPCore (x l t) :precision binary64 (/ (* (sqrt 2.0) t) (sqrt (- (* (/ (+ x 1.0) (- x 1.0)) (+ (* l l) (* 2.0 (* t t)))) (* l l)))))
(FPCore (x l t) :precision binary64 (if (<= t 0.0) (- (sqrt (/ (+ -1.0 x) (+ x 1.0)))) (/ (* t (sqrt 2.0)) (* (sqrt 2.0) (* t (sqrt (/ (+ x 1.0) (+ -1.0 x))))))))
double code(double x, double l, double t) {
return (sqrt(2.0) * t) / sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
}
double code(double x, double l, double t) {
double tmp;
if (t <= 0.0) {
tmp = -sqrt(((-1.0 + x) / (x + 1.0)));
} else {
tmp = (t * sqrt(2.0)) / (sqrt(2.0) * (t * sqrt(((x + 1.0) / (-1.0 + x)))));
}
return tmp;
}
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
code = (sqrt(2.0d0) * t) / sqrt(((((x + 1.0d0) / (x - 1.0d0)) * ((l * l) + (2.0d0 * (t * t)))) - (l * l)))
end function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: tmp
if (t <= 0.0d0) then
tmp = -sqrt((((-1.0d0) + x) / (x + 1.0d0)))
else
tmp = (t * sqrt(2.0d0)) / (sqrt(2.0d0) * (t * sqrt(((x + 1.0d0) / ((-1.0d0) + x)))))
end if
code = tmp
end function
public static double code(double x, double l, double t) {
return (Math.sqrt(2.0) * t) / Math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
}
public static double code(double x, double l, double t) {
double tmp;
if (t <= 0.0) {
tmp = -Math.sqrt(((-1.0 + x) / (x + 1.0)));
} else {
tmp = (t * Math.sqrt(2.0)) / (Math.sqrt(2.0) * (t * Math.sqrt(((x + 1.0) / (-1.0 + x)))));
}
return tmp;
}
def code(x, l, t): return (math.sqrt(2.0) * t) / math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)))
def code(x, l, t): tmp = 0 if t <= 0.0: tmp = -math.sqrt(((-1.0 + x) / (x + 1.0))) else: tmp = (t * math.sqrt(2.0)) / (math.sqrt(2.0) * (t * math.sqrt(((x + 1.0) / (-1.0 + x))))) return tmp
function code(x, l, t) return Float64(Float64(sqrt(2.0) * t) / sqrt(Float64(Float64(Float64(Float64(x + 1.0) / Float64(x - 1.0)) * Float64(Float64(l * l) + Float64(2.0 * Float64(t * t)))) - Float64(l * l)))) end
function code(x, l, t) tmp = 0.0 if (t <= 0.0) tmp = Float64(-sqrt(Float64(Float64(-1.0 + x) / Float64(x + 1.0)))); else tmp = Float64(Float64(t * sqrt(2.0)) / Float64(sqrt(2.0) * Float64(t * sqrt(Float64(Float64(x + 1.0) / Float64(-1.0 + x)))))); end return tmp end
function tmp = code(x, l, t) tmp = (sqrt(2.0) * t) / sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l))); end
function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= 0.0) tmp = -sqrt(((-1.0 + x) / (x + 1.0))); else tmp = (t * sqrt(2.0)) / (sqrt(2.0) * (t * sqrt(((x + 1.0) / (-1.0 + x))))); end tmp_2 = tmp; end
code[x_, l_, t_] := N[(N[(N[Sqrt[2.0], $MachinePrecision] * t), $MachinePrecision] / N[Sqrt[N[(N[(N[(N[(x + 1.0), $MachinePrecision] / N[(x - 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] + N[(2.0 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(l * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x_, l_, t_] := If[LessEqual[t, 0.0], (-N[Sqrt[N[(N[(-1.0 + x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), N[(N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[2.0], $MachinePrecision] * N[(t * N[Sqrt[N[(N[(x + 1.0), $MachinePrecision] / N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}
\begin{array}{l}
\mathbf{if}\;t \leq 0:\\
\;\;\;\;-\sqrt{\frac{-1 + x}{x + 1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot \sqrt{2}}{\sqrt{2} \cdot \left(t \cdot \sqrt{\frac{x + 1}{-1 + x}}\right)}\\
\end{array}
Results
if t < 0.0Initial program 42.4
Simplified42.4
Taylor expanded in t around -inf 14.3
Simplified14.3
Taylor expanded in t around 0 14.3
Simplified14.3
if 0.0 < t Initial program 43.2
Simplified43.2
Taylor expanded in t around inf 15.3
Simplified15.3
Final simplification14.8
herbie shell --seed 2022181
(FPCore (x l t)
:name "Toniolo and Linder, Equation (7)"
:precision binary64
(/ (* (sqrt 2.0) t) (sqrt (- (* (/ (+ x 1.0) (- x 1.0)) (+ (* l l) (* 2.0 (* t t)))) (* l l)))))