| Alternative 1 | |
|---|---|
| Error | 13.0 |
| Cost | 13640 |
(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}
Results
if (/.f64 t l) < -1.00000000000000004e154Initial program 34.8
Taylor expanded in t around -inf 8.8
Simplified8.8
[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)
\] |
Taylor expanded in Om around 0 0.6
Applied egg-rr0.6
Applied egg-rr0.6
if -1.00000000000000004e154 < (/.f64 t l) < 4e129Initial program 0.9
if 4e129 < (/.f64 t l) Initial program 31.4
Taylor expanded in t around inf 7.4
Simplified7.4
[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)
\] |
Taylor expanded in l around 0 7.4
Simplified7.4
[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)
\] |
Taylor expanded in Om around 0 0.6
Final simplification0.8
| Alternative 1 | |
|---|---|
| Error | 13.0 |
| Cost | 13640 |
| Alternative 2 | |
|---|---|
| Error | 2.0 |
| Cost | 13640 |
| Alternative 3 | |
|---|---|
| Error | 2.0 |
| Cost | 13640 |
| Alternative 4 | |
|---|---|
| Error | 2.0 |
| Cost | 13640 |
| Alternative 5 | |
|---|---|
| Error | 2.0 |
| Cost | 13640 |
| Alternative 6 | |
|---|---|
| Error | 23.2 |
| Cost | 13384 |
| Alternative 7 | |
|---|---|
| Error | 31.5 |
| Cost | 6464 |
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)))))))