?

Average Error: 10.4 → 0.8
Time: 15.1s
Precision: binary64
Cost: 27080

?

\[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
\[\begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \leq -1 \cdot 10^{+154}:\\ \;\;\;\;\sin^{-1} \left(-1 \cdot \frac{\ell}{\frac{t}{\sqrt{0.5}}}\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 4 \cdot 10^{+129}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5} \cdot \ell}{t}\right)\\ \end{array} \]
(FPCore (t l Om Omc)
 :precision binary64
 (asin
  (sqrt (/ (- 1.0 (pow (/ Om Omc) 2.0)) (+ 1.0 (* 2.0 (pow (/ t l) 2.0)))))))
(FPCore (t l Om Omc)
 :precision binary64
 (if (<= (/ t l) -1e+154)
   (asin (* -1.0 (/ l (/ t (sqrt 0.5)))))
   (if (<= (/ t l) 4e+129)
     (asin
      (sqrt
       (/ (- 1.0 (pow (/ Om Omc) 2.0)) (+ 1.0 (* 2.0 (pow (/ t l) 2.0))))))
     (asin (/ (* (sqrt 0.5) l) t)))))
double code(double t, double l, double Om, double Omc) {
	return asin(sqrt(((1.0 - pow((Om / Omc), 2.0)) / (1.0 + (2.0 * pow((t / l), 2.0))))));
}
double code(double t, double l, double Om, double Omc) {
	double tmp;
	if ((t / l) <= -1e+154) {
		tmp = asin((-1.0 * (l / (t / sqrt(0.5)))));
	} else if ((t / l) <= 4e+129) {
		tmp = asin(sqrt(((1.0 - pow((Om / Omc), 2.0)) / (1.0 + (2.0 * pow((t / l), 2.0))))));
	} else {
		tmp = asin(((sqrt(0.5) * l) / t));
	}
	return tmp;
}
real(8) function code(t, l, om, omc)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: omc
    code = asin(sqrt(((1.0d0 - ((om / omc) ** 2.0d0)) / (1.0d0 + (2.0d0 * ((t / l) ** 2.0d0))))))
end function
real(8) function code(t, l, om, omc)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: omc
    real(8) :: tmp
    if ((t / l) <= (-1d+154)) then
        tmp = asin(((-1.0d0) * (l / (t / sqrt(0.5d0)))))
    else if ((t / l) <= 4d+129) then
        tmp = asin(sqrt(((1.0d0 - ((om / omc) ** 2.0d0)) / (1.0d0 + (2.0d0 * ((t / l) ** 2.0d0))))))
    else
        tmp = asin(((sqrt(0.5d0) * l) / t))
    end if
    code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
	return Math.asin(Math.sqrt(((1.0 - Math.pow((Om / Omc), 2.0)) / (1.0 + (2.0 * Math.pow((t / l), 2.0))))));
}
public static double code(double t, double l, double Om, double Omc) {
	double tmp;
	if ((t / l) <= -1e+154) {
		tmp = Math.asin((-1.0 * (l / (t / Math.sqrt(0.5)))));
	} else if ((t / l) <= 4e+129) {
		tmp = Math.asin(Math.sqrt(((1.0 - Math.pow((Om / Omc), 2.0)) / (1.0 + (2.0 * Math.pow((t / l), 2.0))))));
	} else {
		tmp = Math.asin(((Math.sqrt(0.5) * l) / t));
	}
	return tmp;
}
def code(t, l, Om, Omc):
	return math.asin(math.sqrt(((1.0 - math.pow((Om / Omc), 2.0)) / (1.0 + (2.0 * math.pow((t / l), 2.0))))))
def code(t, l, Om, Omc):
	tmp = 0
	if (t / l) <= -1e+154:
		tmp = math.asin((-1.0 * (l / (t / math.sqrt(0.5)))))
	elif (t / l) <= 4e+129:
		tmp = math.asin(math.sqrt(((1.0 - math.pow((Om / Omc), 2.0)) / (1.0 + (2.0 * math.pow((t / l), 2.0))))))
	else:
		tmp = math.asin(((math.sqrt(0.5) * l) / t))
	return tmp
function code(t, l, Om, Omc)
	return asin(sqrt(Float64(Float64(1.0 - (Float64(Om / Omc) ^ 2.0)) / Float64(1.0 + Float64(2.0 * (Float64(t / l) ^ 2.0))))))
end
function code(t, l, Om, Omc)
	tmp = 0.0
	if (Float64(t / l) <= -1e+154)
		tmp = asin(Float64(-1.0 * Float64(l / Float64(t / sqrt(0.5)))));
	elseif (Float64(t / l) <= 4e+129)
		tmp = asin(sqrt(Float64(Float64(1.0 - (Float64(Om / Omc) ^ 2.0)) / Float64(1.0 + Float64(2.0 * (Float64(t / l) ^ 2.0))))));
	else
		tmp = asin(Float64(Float64(sqrt(0.5) * l) / t));
	end
	return tmp
end
function tmp = code(t, l, Om, Omc)
	tmp = asin(sqrt(((1.0 - ((Om / Omc) ^ 2.0)) / (1.0 + (2.0 * ((t / l) ^ 2.0))))));
end
function tmp_2 = code(t, l, Om, Omc)
	tmp = 0.0;
	if ((t / l) <= -1e+154)
		tmp = asin((-1.0 * (l / (t / sqrt(0.5)))));
	elseif ((t / l) <= 4e+129)
		tmp = asin(sqrt(((1.0 - ((Om / Omc) ^ 2.0)) / (1.0 + (2.0 * ((t / l) ^ 2.0))))));
	else
		tmp = asin(((sqrt(0.5) * l) / t));
	end
	tmp_2 = tmp;
end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[Sqrt[N[(N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(2.0 * N[Power[N[(t / l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], -1e+154], N[ArcSin[N[(-1.0 * N[(l / N[(t / N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 4e+129], N[ArcSin[N[Sqrt[N[(N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(2.0 * N[Power[N[(t / l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[(N[Sqrt[0.5], $MachinePrecision] * l), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]]]
\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq -1 \cdot 10^{+154}:\\
\;\;\;\;\sin^{-1} \left(-1 \cdot \frac{\ell}{\frac{t}{\sqrt{0.5}}}\right)\\

\mathbf{elif}\;\frac{t}{\ell} \leq 4 \cdot 10^{+129}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)\\

\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5} \cdot \ell}{t}\right)\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 3 regimes
  2. if (/.f64 t l) < -1.00000000000000004e154

    1. Initial program 34.8

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Taylor expanded in t around -inf 8.8

      \[\leadsto \sin^{-1} \color{blue}{\left(-1 \cdot \left(\frac{\sqrt{0.5} \cdot \ell}{t} \cdot \sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right)\right)} \]
    3. Simplified8.8

      \[\leadsto \sin^{-1} \color{blue}{\left(\left(\ell \cdot \frac{\sqrt{0.5}}{t}\right) \cdot \left(-\sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right)\right)} \]
      Proof

      [Start]8.8

      \[ \sin^{-1} \left(-1 \cdot \left(\frac{\sqrt{0.5} \cdot \ell}{t} \cdot \sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right)\right) \]

      rational.json-simplify-43 [=>]8.8

      \[ \sin^{-1} \color{blue}{\left(\frac{\sqrt{0.5} \cdot \ell}{t} \cdot \left(\sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}} \cdot -1\right)\right)} \]

      rational.json-simplify-49 [=>]8.8

      \[ \sin^{-1} \left(\color{blue}{\left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)} \cdot \left(\sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}} \cdot -1\right)\right) \]

      rational.json-simplify-9 [=>]8.8

      \[ \sin^{-1} \left(\left(\ell \cdot \frac{\sqrt{0.5}}{t}\right) \cdot \color{blue}{\left(-\sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right)}\right) \]
    4. Taylor expanded in Om around 0 0.6

      \[\leadsto \sin^{-1} \color{blue}{\left(-1 \cdot \frac{\sqrt{0.5} \cdot \ell}{t}\right)} \]
    5. Applied egg-rr0.6

      \[\leadsto \sin^{-1} \left(-1 \cdot \color{blue}{\left(\frac{\sqrt{0.5}}{t} \cdot \ell\right)}\right) \]
    6. Applied egg-rr0.6

      \[\leadsto \sin^{-1} \left(-1 \cdot \color{blue}{\frac{\ell}{\frac{t}{\sqrt{0.5}}}}\right) \]

    if -1.00000000000000004e154 < (/.f64 t l) < 4e129

    1. Initial program 0.9

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]

    if 4e129 < (/.f64 t l)

    1. Initial program 31.4

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Taylor expanded in t around inf 7.4

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\sqrt{0.5} \cdot \ell}{t} \cdot \sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right)} \]
    3. Simplified7.4

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}} \cdot \left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)\right)} \]
      Proof

      [Start]7.4

      \[ \sin^{-1} \left(\frac{\sqrt{0.5} \cdot \ell}{t} \cdot \sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right) \]

      rational.json-simplify-2 [=>]7.4

      \[ \sin^{-1} \color{blue}{\left(\sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}} \cdot \frac{\sqrt{0.5} \cdot \ell}{t}\right)} \]

      rational.json-simplify-49 [=>]7.4

      \[ \sin^{-1} \left(\sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}} \cdot \color{blue}{\left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)}\right) \]
    4. Taylor expanded in l around 0 7.4

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\sqrt{0.5} \cdot \ell}{t} \cdot \sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right)} \]
    5. Simplified7.4

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\ell}{t} \cdot \sqrt{0.5 \cdot \left(1 - \frac{{Om}^{2}}{{Omc}^{2}}\right)}\right)} \]
      Proof

      [Start]7.4

      \[ \sin^{-1} \left(\frac{\sqrt{0.5} \cdot \ell}{t} \cdot \sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right) \]

      rational.json-simplify-2 [=>]7.4

      \[ \sin^{-1} \left(\frac{\color{blue}{\ell \cdot \sqrt{0.5}}}{t} \cdot \sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right) \]

      rational.json-simplify-49 [=>]7.4

      \[ \sin^{-1} \left(\color{blue}{\left(\sqrt{0.5} \cdot \frac{\ell}{t}\right)} \cdot \sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right) \]

      rational.json-simplify-2 [<=]7.4

      \[ \sin^{-1} \color{blue}{\left(\sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}} \cdot \left(\sqrt{0.5} \cdot \frac{\ell}{t}\right)\right)} \]

      rational.json-simplify-43 [<=]7.4

      \[ \sin^{-1} \color{blue}{\left(\frac{\ell}{t} \cdot \left(\sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}} \cdot \sqrt{0.5}\right)\right)} \]

      rational.json-simplify-2 [<=]7.4

      \[ \sin^{-1} \left(\frac{\ell}{t} \cdot \color{blue}{\left(\sqrt{0.5} \cdot \sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right)}\right) \]

      exponential.json-simplify-20 [=>]7.4

      \[ \sin^{-1} \left(\frac{\ell}{t} \cdot \color{blue}{\sqrt{\left(1 - \frac{{Om}^{2}}{{Omc}^{2}}\right) \cdot 0.5}}\right) \]

      rational.json-simplify-2 [=>]7.4

      \[ \sin^{-1} \left(\frac{\ell}{t} \cdot \sqrt{\color{blue}{0.5 \cdot \left(1 - \frac{{Om}^{2}}{{Omc}^{2}}\right)}}\right) \]
    6. Taylor expanded in Om around 0 0.6

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\sqrt{0.5} \cdot \ell}{t}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \leq -1 \cdot 10^{+154}:\\ \;\;\;\;\sin^{-1} \left(-1 \cdot \frac{\ell}{\frac{t}{\sqrt{0.5}}}\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 4 \cdot 10^{+129}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5} \cdot \ell}{t}\right)\\ \end{array} \]

Alternatives

Alternative 1
Error13.0
Cost13640
\[\begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \leq -1 \cdot 10^{+214}:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5}}{\frac{t}{\ell}}\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 0.05:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)\\ \end{array} \]
Alternative 2
Error2.0
Cost13640
\[\begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \leq -500:\\ \;\;\;\;\sin^{-1} \left(\sqrt{0.5} \cdot \frac{-\ell}{t}\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 0.05:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)\\ \end{array} \]
Alternative 3
Error2.0
Cost13640
\[\begin{array}{l} t_1 := \ell \cdot \frac{\sqrt{0.5}}{t}\\ \mathbf{if}\;\frac{t}{\ell} \leq -500:\\ \;\;\;\;\sin^{-1} \left(-1 \cdot t_1\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 0.05:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} t_1\\ \end{array} \]
Alternative 4
Error2.0
Cost13640
\[\begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \leq -500:\\ \;\;\;\;\sin^{-1} \left(-1 \cdot \frac{\ell}{\frac{t}{\sqrt{0.5}}}\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 0.05:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)\\ \end{array} \]
Alternative 5
Error2.0
Cost13640
\[\begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \leq -500:\\ \;\;\;\;\sin^{-1} \left(-1 \cdot \frac{\sqrt{0.5} \cdot \ell}{t}\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 0.05:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)\\ \end{array} \]
Alternative 6
Error23.2
Cost13384
\[\begin{array}{l} \mathbf{if}\;\ell \leq -2.7 \cdot 10^{-91}:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{elif}\;\ell \leq 3.8 \cdot 10^{-78}:\\ \;\;\;\;\sin^{-1} \left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} 1\\ \end{array} \]
Alternative 7
Error31.5
Cost6464
\[\sin^{-1} 1 \]

Error

Reproduce?

herbie shell --seed 2023073 
(FPCore (t l Om Omc)
  :name "Toniolo and Linder, Equation (2)"
  :precision binary64
  (asin (sqrt (/ (- 1.0 (pow (/ Om Omc) 2.0)) (+ 1.0 (* 2.0 (pow (/ t l) 2.0)))))))