Average Error: 10.2 → 1.0
Time: 41.8s
Precision: binary64
Cost: 45632
\[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
\[\mathsf{expm1}\left(\mathsf{log1p}\left(\sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)\right)\right) \]
(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
 (expm1
  (log1p
   (asin
    (/
     (sqrt (- 1.0 (pow (/ Om Omc) 2.0)))
     (hypot 1.0 (* (/ t l) (sqrt 2.0))))))))
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) {
	return expm1(log1p(asin((sqrt((1.0 - pow((Om / Omc), 2.0))) / hypot(1.0, ((t / l) * sqrt(2.0)))))));
}
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) {
	return Math.expm1(Math.log1p(Math.asin((Math.sqrt((1.0 - Math.pow((Om / Omc), 2.0))) / Math.hypot(1.0, ((t / l) * Math.sqrt(2.0)))))));
}
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):
	return math.expm1(math.log1p(math.asin((math.sqrt((1.0 - math.pow((Om / Omc), 2.0))) / math.hypot(1.0, ((t / l) * math.sqrt(2.0)))))))
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)
	return expm1(log1p(asin(Float64(sqrt(Float64(1.0 - (Float64(Om / Omc) ^ 2.0))) / hypot(1.0, Float64(Float64(t / l) * sqrt(2.0)))))))
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_] := N[(Exp[N[Log[1 + N[ArcSin[N[(N[Sqrt[N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(N[(t / l), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]
\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)
\mathsf{expm1}\left(\mathsf{log1p}\left(\sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)\right)\right)

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 10.2

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

    \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)} \]
  3. Simplified1.0

    \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)} \]
    Proof
    (/.f64 (sqrt.f64 (-.f64 1 (pow.f64 (/.f64 Om Omc) 2))) (hypot.f64 1 (*.f64 (/.f64 t l) (sqrt.f64 2)))): 0 points increase in error, 0 points decrease in error
    (/.f64 (Rewrite<= *-rgt-identity_binary64 (*.f64 (sqrt.f64 (-.f64 1 (pow.f64 (/.f64 Om Omc) 2))) 1)) (hypot.f64 1 (*.f64 (/.f64 t l) (sqrt.f64 2)))): 0 points increase in error, 0 points decrease in error
    (Rewrite<= associate-*r/_binary64 (*.f64 (sqrt.f64 (-.f64 1 (pow.f64 (/.f64 Om Omc) 2))) (/.f64 1 (hypot.f64 1 (*.f64 (/.f64 t l) (sqrt.f64 2)))))): 0 points increase in error, 0 points decrease in error
  4. Applied egg-rr1.0

    \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - \color{blue}{\frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}}}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right) \]
  5. Applied egg-rr1.0

    \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)\right)\right)} \]
  6. Final simplification1.0

    \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)\right)\right) \]

Alternatives

Alternative 1
Error1.0
Cost26624
\[\sin^{-1} \left(\frac{\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right) \]
Alternative 2
Error1.5
Cost19712
\[\sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, t \cdot \frac{\sqrt{2}}{\ell}\right)}\right) \]
Alternative 3
Error1.5
Cost19712
\[\sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right) \]
Alternative 4
Error16.7
Cost14160
\[\begin{array}{l} t_1 := \sin^{-1} \left(\sqrt{\frac{1}{1 + 2 \cdot \frac{t \cdot t}{\ell \cdot \ell}}}\right)\\ \mathbf{if}\;t \leq -5.8 \cdot 10^{+166}:\\ \;\;\;\;\sin^{-1} \left(\ell \cdot \frac{\frac{1}{t}}{\sqrt{2}}\right)\\ \mathbf{elif}\;t \leq -1.8 \cdot 10^{-101}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.85 \cdot 10^{-106}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{1 - \frac{Om}{Omc} \cdot \frac{Om}{Omc}}\right)\\ \mathbf{elif}\;t \leq 2.35 \cdot 10^{+145}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell}{t} \cdot {2}^{-0.5}\right)\\ \end{array} \]
Alternative 5
Error23.4
Cost13904
\[\begin{array}{l} t_1 := \sin^{-1} \left(\frac{\ell}{t} \cdot {2}^{-0.5}\right)\\ \mathbf{if}\;t \leq -2.25 \cdot 10^{+167}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -3.8 \cdot 10^{+55}:\\ \;\;\;\;\sin^{-1} \left(\frac{\frac{-\ell}{t}}{\sqrt{2}}\right)\\ \mathbf{elif}\;t \leq -3.3 \cdot 10^{+43}:\\ \;\;\;\;\sin^{-1} \left(\frac{\frac{\ell}{t}}{\sqrt{2}}\right)\\ \mathbf{elif}\;t \leq 7.4 \cdot 10^{+61}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{1 - \frac{Om}{Omc} \cdot \frac{Om}{Omc}}\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error23.4
Cost13904
\[\begin{array}{l} \mathbf{if}\;t \leq -2.7 \cdot 10^{+167}:\\ \;\;\;\;\sin^{-1} \left(\ell \cdot \frac{\frac{1}{t}}{\sqrt{2}}\right)\\ \mathbf{elif}\;t \leq -7 \cdot 10^{+62}:\\ \;\;\;\;\sin^{-1} \left(\frac{\frac{-\ell}{t}}{\sqrt{2}}\right)\\ \mathbf{elif}\;t \leq -6.4 \cdot 10^{+40}:\\ \;\;\;\;\sin^{-1} \left(\frac{\frac{\ell}{t}}{\sqrt{2}}\right)\\ \mathbf{elif}\;t \leq 1.25 \cdot 10^{+64}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{1 - \frac{Om}{Omc} \cdot \frac{Om}{Omc}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell}{t} \cdot {2}^{-0.5}\right)\\ \end{array} \]
Alternative 7
Error12.5
Cost13896
\[\begin{array}{l} \mathbf{if}\;t \leq -4.2 \cdot 10^{+176}:\\ \;\;\;\;\sin^{-1} \left(\ell \cdot \frac{\frac{1}{t}}{\sqrt{2}}\right)\\ \mathbf{elif}\;t \leq 2.35 \cdot 10^{+145}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{\frac{1}{1 + \frac{t}{\frac{\ell}{t}} \cdot \frac{2}{\ell}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell}{t} \cdot {2}^{-0.5}\right)\\ \end{array} \]
Alternative 8
Error23.6
Cost13712
\[\begin{array}{l} t_1 := \sin^{-1} \left(\frac{\ell}{t} \cdot {2}^{-0.5}\right)\\ \mathbf{if}\;t \leq -6 \cdot 10^{+171}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -2 \cdot 10^{+57}:\\ \;\;\;\;\sin^{-1} \left(\frac{-\ell}{t \cdot \sqrt{2}}\right)\\ \mathbf{elif}\;t \leq -5 \cdot 10^{+37}:\\ \;\;\;\;\sin^{-1} \left(\frac{\frac{\ell}{t}}{\sqrt{2}}\right)\\ \mathbf{elif}\;t \leq 5.2 \cdot 10^{+66}:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error23.6
Cost13712
\[\begin{array}{l} t_1 := \sin^{-1} \left(\frac{\ell}{t} \cdot {2}^{-0.5}\right)\\ \mathbf{if}\;t \leq -1.14 \cdot 10^{+170}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -2.2 \cdot 10^{+62}:\\ \;\;\;\;\sin^{-1} \left(\frac{\frac{-\ell}{t}}{\sqrt{2}}\right)\\ \mathbf{elif}\;t \leq -7.5 \cdot 10^{+36}:\\ \;\;\;\;\sin^{-1} \left(\frac{\frac{\ell}{t}}{\sqrt{2}}\right)\\ \mathbf{elif}\;t \leq 4.6 \cdot 10^{+67}:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error10.6
Cost13632
\[\sin^{-1} \left(\sqrt{\frac{1}{1 + \frac{t}{\ell} \cdot \frac{2 \cdot t}{\ell}}}\right) \]
Alternative 11
Error23.6
Cost13448
\[\begin{array}{l} t_1 := \sin^{-1} \left(\frac{\ell}{t} \cdot {2}^{-0.5}\right)\\ \mathbf{if}\;t \leq -7.5 \cdot 10^{+36}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 2.05 \cdot 10^{+58}:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 12
Error23.5
Cost13384
\[\begin{array}{l} t_1 := \sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\ \mathbf{if}\;t \leq -9.5 \cdot 10^{+43}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 5.8 \cdot 10^{+62}:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 13
Error23.6
Cost13384
\[\begin{array}{l} \mathbf{if}\;t \leq -8 \cdot 10^{+37}:\\ \;\;\;\;\sin^{-1} \left(\frac{\frac{\ell}{t}}{\sqrt{2}}\right)\\ \mathbf{elif}\;t \leq 2.3 \cdot 10^{+58}:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\ \end{array} \]
Alternative 14
Error23.5
Cost13384
\[\begin{array}{l} \mathbf{if}\;t \leq -1.26 \cdot 10^{+42}:\\ \;\;\;\;\sin^{-1} \left(\frac{\frac{\ell}{\sqrt{2}}}{t}\right)\\ \mathbf{elif}\;t \leq 9.2 \cdot 10^{+62}:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\ \end{array} \]
Alternative 15
Error31.6
Cost6464
\[\sin^{-1} 1 \]

Error

Reproduce

herbie shell --seed 2022339 
(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)))))))