Average Error: 10.3 → 1.1
Time: 14.3s
Precision: binary64
Cost: 32832
\[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
\[\sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\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
 (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 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.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.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 asin(Float64(sqrt(Float64(1.0 - (Float64(Om / Omc) ^ 2.0))) / hypot(1.0, Float64(t / Float64(l / sqrt(2.0))))))
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 = code(t, l, Om, Omc)
	tmp = asin((sqrt((1.0 - ((Om / Omc) ^ 2.0))) / hypot(1.0, (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[ArcSin[N[(N[Sqrt[N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(t / N[(l / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)
\sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right)

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 10.3

    \[\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.1

    \[\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.1

    \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right)} \]
    Proof
    (/.f64 (sqrt.f64 (-.f64 1 (pow.f64 (/.f64 Om Omc) 2))) (hypot.f64 1 (/.f64 t (/.f64 l (sqrt.f64 2))))): 0 points increase in error, 0 points decrease in error
    (/.f64 (sqrt.f64 (-.f64 1 (Rewrite=> unpow2_binary64 (*.f64 (/.f64 Om Omc) (/.f64 Om Omc))))) (hypot.f64 1 (/.f64 t (/.f64 l (sqrt.f64 2))))): 0 points increase in error, 0 points decrease in error
    (/.f64 (sqrt.f64 (-.f64 1 (Rewrite<= times-frac_binary64 (/.f64 (*.f64 Om Om) (*.f64 Omc Omc))))) (hypot.f64 1 (/.f64 t (/.f64 l (sqrt.f64 2))))): 38 points increase in error, 0 points decrease in error
    (/.f64 (sqrt.f64 (-.f64 1 (/.f64 (Rewrite<= unpow2_binary64 (pow.f64 Om 2)) (*.f64 Omc Omc)))) (hypot.f64 1 (/.f64 t (/.f64 l (sqrt.f64 2))))): 0 points increase in error, 0 points decrease in error
    (/.f64 (sqrt.f64 (-.f64 1 (/.f64 (pow.f64 Om 2) (Rewrite<= unpow2_binary64 (pow.f64 Omc 2))))) (hypot.f64 1 (/.f64 t (/.f64 l (sqrt.f64 2))))): 0 points increase in error, 0 points decrease in error
    (/.f64 (Rewrite<= *-rgt-identity_binary64 (*.f64 (sqrt.f64 (-.f64 1 (/.f64 (pow.f64 Om 2) (pow.f64 Omc 2)))) 1)) (hypot.f64 1 (/.f64 t (/.f64 l (sqrt.f64 2))))): 0 points increase in error, 0 points decrease in error
    (/.f64 (*.f64 (sqrt.f64 (-.f64 1 (/.f64 (pow.f64 Om 2) (pow.f64 Omc 2)))) 1) (hypot.f64 1 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 t (sqrt.f64 2)) l)))): 12 points increase in error, 7 points decrease in error
    (/.f64 (*.f64 (sqrt.f64 (-.f64 1 (/.f64 (pow.f64 Om 2) (pow.f64 Omc 2)))) 1) (hypot.f64 1 (Rewrite<= associate-*l/_binary64 (*.f64 (/.f64 t l) (sqrt.f64 2))))): 10 points increase in error, 11 points decrease in error
    (Rewrite<= associate-*r/_binary64 (*.f64 (sqrt.f64 (-.f64 1 (/.f64 (pow.f64 Om 2) (pow.f64 Omc 2)))) (/.f64 1 (hypot.f64 1 (*.f64 (/.f64 t l) (sqrt.f64 2)))))): 0 points increase in error, 0 points decrease in error
    (*.f64 (sqrt.f64 (-.f64 1 (/.f64 (Rewrite=> unpow2_binary64 (*.f64 Om Om)) (pow.f64 Omc 2)))) (/.f64 1 (hypot.f64 1 (*.f64 (/.f64 t l) (sqrt.f64 2))))): 0 points increase in error, 0 points decrease in error
    (*.f64 (sqrt.f64 (-.f64 1 (/.f64 (*.f64 Om Om) (Rewrite=> unpow2_binary64 (*.f64 Omc Omc))))) (/.f64 1 (hypot.f64 1 (*.f64 (/.f64 t l) (sqrt.f64 2))))): 0 points increase in error, 0 points decrease in error
    (*.f64 (sqrt.f64 (-.f64 1 (Rewrite=> times-frac_binary64 (*.f64 (/.f64 Om Omc) (/.f64 Om Omc))))) (/.f64 1 (hypot.f64 1 (*.f64 (/.f64 t l) (sqrt.f64 2))))): 0 points increase in error, 38 points decrease in error
    (*.f64 (sqrt.f64 (-.f64 1 (Rewrite<= unpow2_binary64 (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. Final simplification1.1

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

Alternatives

Alternative 1
Error1.1
Cost32832
\[\sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \sqrt{2} \cdot \frac{t}{\ell}\right)}\right) \]
Alternative 2
Error1.8
Cost19712
\[\sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, \frac{t \cdot \sqrt{2}}{\ell}\right)}\right) \]
Alternative 3
Error2.0
Cost13896
\[\begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \leq -50000000:\\ \;\;\;\;\sin^{-1} \left(\frac{-\ell}{\frac{t}{\sqrt{0.5}}}\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 0.0001:\\ \;\;\;\;\sin^{-1} \left(\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)\\ \end{array} \]
Alternative 4
Error13.6
Cost13640
\[\begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \leq -5 \cdot 10^{+205}:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5}}{\frac{t}{\ell}}\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 0.0001:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\ \end{array} \]
Alternative 5
Error13.6
Cost13640
\[\begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \leq -5 \cdot 10^{+205}:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5}}{\frac{t}{\ell}}\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 0.0001:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)\\ \end{array} \]
Alternative 6
Error2.3
Cost13640
\[\begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \leq -50000000:\\ \;\;\;\;\sin^{-1} \left(\frac{-\ell}{\frac{t}{\sqrt{0.5}}}\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 0.0001:\\ \;\;\;\;\sin^{-1} \left(1 - \frac{t}{\ell} \cdot \frac{t}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)\\ \end{array} \]
Alternative 7
Error24.2
Cost13384
\[\begin{array}{l} \mathbf{if}\;\ell \leq -3.9 \cdot 10^{-114}:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{elif}\;\ell \leq 7.2 \cdot 10^{-136}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} 1\\ \end{array} \]
Alternative 8
Error24.1
Cost13384
\[\begin{array}{l} \mathbf{if}\;\ell \leq -7 \cdot 10^{-114}:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{elif}\;\ell \leq 3.7 \cdot 10^{-137}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell}{\frac{t}{\sqrt{0.5}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} 1\\ \end{array} \]
Alternative 9
Error32.2
Cost6464
\[\sin^{-1} 1 \]

Error

Reproduce

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