Toniolo and Linder, Equation (3a)

Percentage Accurate: 98.2% → 100.0%
Time: 18.0s
Alternatives: 11
Speedup: 1.4×

Specification

?
\[\begin{array}{l} \\ \sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)} \end{array} \]
(FPCore (l Om kx ky)
 :precision binary64
 (sqrt
  (*
   (/ 1.0 2.0)
   (+
    1.0
    (/
     1.0
     (sqrt
      (+
       1.0
       (*
        (pow (/ (* 2.0 l) Om) 2.0)
        (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))))))
double code(double l, double Om, double kx, double ky) {
	return sqrt(((1.0 / 2.0) * (1.0 + (1.0 / sqrt((1.0 + (pow(((2.0 * l) / Om), 2.0) * (pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))))))));
}
real(8) function code(l, om, kx, ky)
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: kx
    real(8), intent (in) :: ky
    code = sqrt(((1.0d0 / 2.0d0) * (1.0d0 + (1.0d0 / sqrt((1.0d0 + ((((2.0d0 * l) / om) ** 2.0d0) * ((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))))))))
end function
public static double code(double l, double Om, double kx, double ky) {
	return Math.sqrt(((1.0 / 2.0) * (1.0 + (1.0 / Math.sqrt((1.0 + (Math.pow(((2.0 * l) / Om), 2.0) * (Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))))))));
}
def code(l, Om, kx, ky):
	return math.sqrt(((1.0 / 2.0) * (1.0 + (1.0 / math.sqrt((1.0 + (math.pow(((2.0 * l) / Om), 2.0) * (math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))))))))
function code(l, Om, kx, ky)
	return sqrt(Float64(Float64(1.0 / 2.0) * Float64(1.0 + Float64(1.0 / sqrt(Float64(1.0 + Float64((Float64(Float64(2.0 * l) / Om) ^ 2.0) * Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))))))))
end
function tmp = code(l, Om, kx, ky)
	tmp = sqrt(((1.0 / 2.0) * (1.0 + (1.0 / sqrt((1.0 + ((((2.0 * l) / Om) ^ 2.0) * ((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))))))));
end
code[l_, Om_, kx_, ky_] := N[Sqrt[N[(N[(1.0 / 2.0), $MachinePrecision] * N[(1.0 + N[(1.0 / N[Sqrt[N[(1.0 + N[(N[Power[N[(N[(2.0 * l), $MachinePrecision] / Om), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 11 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 98.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)} \end{array} \]
(FPCore (l Om kx ky)
 :precision binary64
 (sqrt
  (*
   (/ 1.0 2.0)
   (+
    1.0
    (/
     1.0
     (sqrt
      (+
       1.0
       (*
        (pow (/ (* 2.0 l) Om) 2.0)
        (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))))))
double code(double l, double Om, double kx, double ky) {
	return sqrt(((1.0 / 2.0) * (1.0 + (1.0 / sqrt((1.0 + (pow(((2.0 * l) / Om), 2.0) * (pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))))))));
}
real(8) function code(l, om, kx, ky)
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: kx
    real(8), intent (in) :: ky
    code = sqrt(((1.0d0 / 2.0d0) * (1.0d0 + (1.0d0 / sqrt((1.0d0 + ((((2.0d0 * l) / om) ** 2.0d0) * ((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))))))))
end function
public static double code(double l, double Om, double kx, double ky) {
	return Math.sqrt(((1.0 / 2.0) * (1.0 + (1.0 / Math.sqrt((1.0 + (Math.pow(((2.0 * l) / Om), 2.0) * (Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))))))));
}
def code(l, Om, kx, ky):
	return math.sqrt(((1.0 / 2.0) * (1.0 + (1.0 / math.sqrt((1.0 + (math.pow(((2.0 * l) / Om), 2.0) * (math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))))))))
function code(l, Om, kx, ky)
	return sqrt(Float64(Float64(1.0 / 2.0) * Float64(1.0 + Float64(1.0 / sqrt(Float64(1.0 + Float64((Float64(Float64(2.0 * l) / Om) ^ 2.0) * Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))))))))
end
function tmp = code(l, Om, kx, ky)
	tmp = sqrt(((1.0 / 2.0) * (1.0 + (1.0 / sqrt((1.0 + ((((2.0 * l) / Om) ^ 2.0) * ((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))))))));
end
code[l_, Om_, kx_, ky_] := N[Sqrt[N[(N[(1.0 / 2.0), $MachinePrecision] * N[(1.0 + N[(1.0 / N[Sqrt[N[(1.0 + N[(N[Power[N[(N[(2.0 * l), $MachinePrecision] / Om), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)}
\end{array}

Alternative 1: 100.0% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \mathsf{hypot}\left(\sin kx, \sin ky\right)\right)}} \end{array} \]
(FPCore (l Om kx ky)
 :precision binary64
 (sqrt
  (+
   0.5
   (*
    0.5
    (/ 1.0 (hypot 1.0 (* (* l (/ 2.0 Om)) (hypot (sin kx) (sin ky)))))))))
double code(double l, double Om, double kx, double ky) {
	return sqrt((0.5 + (0.5 * (1.0 / hypot(1.0, ((l * (2.0 / Om)) * hypot(sin(kx), sin(ky))))))));
}
public static double code(double l, double Om, double kx, double ky) {
	return Math.sqrt((0.5 + (0.5 * (1.0 / Math.hypot(1.0, ((l * (2.0 / Om)) * Math.hypot(Math.sin(kx), Math.sin(ky))))))));
}
def code(l, Om, kx, ky):
	return math.sqrt((0.5 + (0.5 * (1.0 / math.hypot(1.0, ((l * (2.0 / Om)) * math.hypot(math.sin(kx), math.sin(ky))))))))
function code(l, Om, kx, ky)
	return sqrt(Float64(0.5 + Float64(0.5 * Float64(1.0 / hypot(1.0, Float64(Float64(l * Float64(2.0 / Om)) * hypot(sin(kx), sin(ky))))))))
end
function tmp = code(l, Om, kx, ky)
	tmp = sqrt((0.5 + (0.5 * (1.0 / hypot(1.0, ((l * (2.0 / Om)) * hypot(sin(kx), sin(ky))))))));
end
code[l_, Om_, kx_, ky_] := N[Sqrt[N[(0.5 + N[(0.5 * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[(l * N[(2.0 / Om), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \mathsf{hypot}\left(\sin kx, \sin ky\right)\right)}}
\end{array}
Derivation
  1. Initial program 98.5%

    \[\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)} \]
  2. Simplified98.5%

    \[\leadsto \color{blue}{\sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + {\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}} \]
  3. Step-by-step derivation
    1. add-sqr-sqrt98.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)} \cdot \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}}} \]
    2. hypot-1-def98.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}\right)}}} \]
    3. sqrt-prod98.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\right)}} \]
    4. unpow298.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{\frac{2}{\frac{Om}{\ell}} \cdot \frac{2}{\frac{Om}{\ell}}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    5. sqrt-prod54.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\sqrt{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{\frac{2}{\frac{Om}{\ell}}}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    6. add-sqr-sqrt98.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    7. associate-/r/98.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\frac{2}{Om} \cdot \ell\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    8. *-commutative98.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\ell \cdot \frac{2}{Om}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    9. unpow298.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\color{blue}{\sin kx \cdot \sin kx} + {\sin ky}^{2}}\right)}} \]
    10. unpow298.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\sin kx \cdot \sin kx + \color{blue}{\sin ky \cdot \sin ky}}\right)}} \]
    11. hypot-def100.0%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \color{blue}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\right)}} \]
  4. Applied egg-rr100.0%

    \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \mathsf{hypot}\left(\sin kx, \sin ky\right)\right)}}} \]
  5. Final simplification100.0%

    \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \mathsf{hypot}\left(\sin kx, \sin ky\right)\right)}} \]

Alternative 2: 93.6% accurate, 2.3× speedup?

\[\begin{array}{l} \\ \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, \ell \cdot \left(\frac{2}{Om} \cdot \sin ky\right)\right)}} \end{array} \]
(FPCore (l Om kx ky)
 :precision binary64
 (sqrt (+ 0.5 (/ 0.5 (hypot 1.0 (* l (* (/ 2.0 Om) (sin ky))))))))
double code(double l, double Om, double kx, double ky) {
	return sqrt((0.5 + (0.5 / hypot(1.0, (l * ((2.0 / Om) * sin(ky)))))));
}
public static double code(double l, double Om, double kx, double ky) {
	return Math.sqrt((0.5 + (0.5 / Math.hypot(1.0, (l * ((2.0 / Om) * Math.sin(ky)))))));
}
def code(l, Om, kx, ky):
	return math.sqrt((0.5 + (0.5 / math.hypot(1.0, (l * ((2.0 / Om) * math.sin(ky)))))))
function code(l, Om, kx, ky)
	return sqrt(Float64(0.5 + Float64(0.5 / hypot(1.0, Float64(l * Float64(Float64(2.0 / Om) * sin(ky)))))))
end
function tmp = code(l, Om, kx, ky)
	tmp = sqrt((0.5 + (0.5 / hypot(1.0, (l * ((2.0 / Om) * sin(ky)))))));
end
code[l_, Om_, kx_, ky_] := N[Sqrt[N[(0.5 + N[(0.5 / N[Sqrt[1.0 ^ 2 + N[(l * N[(N[(2.0 / Om), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, \ell \cdot \left(\frac{2}{Om} \cdot \sin ky\right)\right)}}
\end{array}
Derivation
  1. Initial program 98.5%

    \[\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)} \]
  2. Simplified98.5%

    \[\leadsto \color{blue}{\sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + {\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}} \]
  3. Step-by-step derivation
    1. add-sqr-sqrt98.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)} \cdot \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}}} \]
    2. hypot-1-def98.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}\right)}}} \]
    3. sqrt-prod98.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\right)}} \]
    4. unpow298.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{\frac{2}{\frac{Om}{\ell}} \cdot \frac{2}{\frac{Om}{\ell}}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    5. sqrt-prod54.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\sqrt{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{\frac{2}{\frac{Om}{\ell}}}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    6. add-sqr-sqrt98.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    7. associate-/r/98.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\frac{2}{Om} \cdot \ell\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    8. *-commutative98.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\ell \cdot \frac{2}{Om}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    9. unpow298.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\color{blue}{\sin kx \cdot \sin kx} + {\sin ky}^{2}}\right)}} \]
    10. unpow298.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\sin kx \cdot \sin kx + \color{blue}{\sin ky \cdot \sin ky}}\right)}} \]
    11. hypot-def100.0%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \color{blue}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\right)}} \]
  4. Applied egg-rr100.0%

    \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \mathsf{hypot}\left(\sin kx, \sin ky\right)\right)}}} \]
  5. Taylor expanded in kx around 0 94.0%

    \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \color{blue}{\sin ky}\right)}} \]
  6. Step-by-step derivation
    1. *-un-lft-identity94.0%

      \[\leadsto \color{blue}{1 \cdot \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sin ky\right)}}} \]
    2. un-div-inv94.0%

      \[\leadsto 1 \cdot \sqrt{0.5 + \color{blue}{\frac{0.5}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sin ky\right)}}} \]
  7. Applied egg-rr94.0%

    \[\leadsto \color{blue}{1 \cdot \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sin ky\right)}}} \]
  8. Step-by-step derivation
    1. *-lft-identity94.0%

      \[\leadsto \color{blue}{\sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sin ky\right)}}} \]
    2. associate-*l*94.0%

      \[\leadsto \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, \color{blue}{\ell \cdot \left(\frac{2}{Om} \cdot \sin ky\right)}\right)}} \]
  9. Simplified94.0%

    \[\leadsto \color{blue}{\sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, \ell \cdot \left(\frac{2}{Om} \cdot \sin ky\right)\right)}}} \]
  10. Final simplification94.0%

    \[\leadsto \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, \ell \cdot \left(\frac{2}{Om} \cdot \sin ky\right)\right)}} \]

Alternative 3: 73.9% accurate, 3.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq 9 \cdot 10^{-178}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot ky\right)}}\\ \end{array} \end{array} \]
(FPCore (l Om kx ky)
 :precision binary64
 (if (<= l 9e-178)
   1.0
   (sqrt (+ 0.5 (* 0.5 (/ 1.0 (hypot 1.0 (* (* l (/ 2.0 Om)) ky))))))))
double code(double l, double Om, double kx, double ky) {
	double tmp;
	if (l <= 9e-178) {
		tmp = 1.0;
	} else {
		tmp = sqrt((0.5 + (0.5 * (1.0 / hypot(1.0, ((l * (2.0 / Om)) * ky))))));
	}
	return tmp;
}
public static double code(double l, double Om, double kx, double ky) {
	double tmp;
	if (l <= 9e-178) {
		tmp = 1.0;
	} else {
		tmp = Math.sqrt((0.5 + (0.5 * (1.0 / Math.hypot(1.0, ((l * (2.0 / Om)) * ky))))));
	}
	return tmp;
}
def code(l, Om, kx, ky):
	tmp = 0
	if l <= 9e-178:
		tmp = 1.0
	else:
		tmp = math.sqrt((0.5 + (0.5 * (1.0 / math.hypot(1.0, ((l * (2.0 / Om)) * ky))))))
	return tmp
function code(l, Om, kx, ky)
	tmp = 0.0
	if (l <= 9e-178)
		tmp = 1.0;
	else
		tmp = sqrt(Float64(0.5 + Float64(0.5 * Float64(1.0 / hypot(1.0, Float64(Float64(l * Float64(2.0 / Om)) * ky))))));
	end
	return tmp
end
function tmp_2 = code(l, Om, kx, ky)
	tmp = 0.0;
	if (l <= 9e-178)
		tmp = 1.0;
	else
		tmp = sqrt((0.5 + (0.5 * (1.0 / hypot(1.0, ((l * (2.0 / Om)) * ky))))));
	end
	tmp_2 = tmp;
end
code[l_, Om_, kx_, ky_] := If[LessEqual[l, 9e-178], 1.0, N[Sqrt[N[(0.5 + N[(0.5 * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[(l * N[(2.0 / Om), $MachinePrecision]), $MachinePrecision] * ky), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 9 \cdot 10^{-178}:\\
\;\;\;\;1\\

\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot ky\right)}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 8.99999999999999957e-178

    1. Initial program 97.8%

      \[\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)} \]
    2. Simplified97.8%

      \[\leadsto \color{blue}{\sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + {\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}} \]
    3. Step-by-step derivation
      1. add-sqr-sqrt97.8%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)} \cdot \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}}} \]
      2. hypot-1-def97.8%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}\right)}}} \]
      3. sqrt-prod97.8%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\right)}} \]
      4. unpow297.8%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{\frac{2}{\frac{Om}{\ell}} \cdot \frac{2}{\frac{Om}{\ell}}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      5. sqrt-prod59.8%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\sqrt{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{\frac{2}{\frac{Om}{\ell}}}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      6. add-sqr-sqrt98.2%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      7. associate-/r/98.2%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\frac{2}{Om} \cdot \ell\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      8. *-commutative98.2%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\ell \cdot \frac{2}{Om}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      9. unpow298.2%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\color{blue}{\sin kx \cdot \sin kx} + {\sin ky}^{2}}\right)}} \]
      10. unpow298.2%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\sin kx \cdot \sin kx + \color{blue}{\sin ky \cdot \sin ky}}\right)}} \]
      11. hypot-def100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \color{blue}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\right)}} \]
    4. Applied egg-rr100.0%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \mathsf{hypot}\left(\sin kx, \sin ky\right)\right)}}} \]
    5. Taylor expanded in l around 0 71.4%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \color{blue}{1}} \]

    if 8.99999999999999957e-178 < l

    1. Initial program 99.3%

      \[\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)} \]
    2. Simplified99.3%

      \[\leadsto \color{blue}{\sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + {\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}} \]
    3. Step-by-step derivation
      1. add-sqr-sqrt99.3%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)} \cdot \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}}} \]
      2. hypot-1-def99.3%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}\right)}}} \]
      3. sqrt-prod99.3%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\right)}} \]
      4. unpow299.3%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{\frac{2}{\frac{Om}{\ell}} \cdot \frac{2}{\frac{Om}{\ell}}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      5. sqrt-prod47.8%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\sqrt{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{\frac{2}{\frac{Om}{\ell}}}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      6. add-sqr-sqrt99.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      7. associate-/r/99.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\frac{2}{Om} \cdot \ell\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      8. *-commutative99.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\ell \cdot \frac{2}{Om}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      9. unpow299.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\color{blue}{\sin kx \cdot \sin kx} + {\sin ky}^{2}}\right)}} \]
      10. unpow299.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\sin kx \cdot \sin kx + \color{blue}{\sin ky \cdot \sin ky}}\right)}} \]
      11. hypot-def100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \color{blue}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\right)}} \]
    4. Applied egg-rr100.0%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \mathsf{hypot}\left(\sin kx, \sin ky\right)\right)}}} \]
    5. Taylor expanded in kx around 0 93.7%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \color{blue}{\sin ky}\right)}} \]
    6. Taylor expanded in ky around 0 85.7%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \color{blue}{ky}\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification77.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 9 \cdot 10^{-178}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot ky\right)}}\\ \end{array} \]

Alternative 4: 68.8% accurate, 5.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;Om \leq 9.5 \cdot 10^{-170}:\\ \;\;\;\;\sqrt{0.5}\\ \mathbf{elif}\;Om \leq 6 \cdot 10^{+72}:\\ \;\;\;\;\sqrt{0.5 + 0.5 \cdot \frac{1}{1 + 2 \cdot \frac{ky \cdot ky}{\frac{Om \cdot Om}{\ell \cdot \ell}}}}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (l Om kx ky)
 :precision binary64
 (if (<= Om 9.5e-170)
   (sqrt 0.5)
   (if (<= Om 6e+72)
     (sqrt
      (+
       0.5
       (* 0.5 (/ 1.0 (+ 1.0 (* 2.0 (/ (* ky ky) (/ (* Om Om) (* l l)))))))))
     1.0)))
double code(double l, double Om, double kx, double ky) {
	double tmp;
	if (Om <= 9.5e-170) {
		tmp = sqrt(0.5);
	} else if (Om <= 6e+72) {
		tmp = sqrt((0.5 + (0.5 * (1.0 / (1.0 + (2.0 * ((ky * ky) / ((Om * Om) / (l * l)))))))));
	} else {
		tmp = 1.0;
	}
	return tmp;
}
real(8) function code(l, om, kx, ky)
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: kx
    real(8), intent (in) :: ky
    real(8) :: tmp
    if (om <= 9.5d-170) then
        tmp = sqrt(0.5d0)
    else if (om <= 6d+72) then
        tmp = sqrt((0.5d0 + (0.5d0 * (1.0d0 / (1.0d0 + (2.0d0 * ((ky * ky) / ((om * om) / (l * l)))))))))
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
public static double code(double l, double Om, double kx, double ky) {
	double tmp;
	if (Om <= 9.5e-170) {
		tmp = Math.sqrt(0.5);
	} else if (Om <= 6e+72) {
		tmp = Math.sqrt((0.5 + (0.5 * (1.0 / (1.0 + (2.0 * ((ky * ky) / ((Om * Om) / (l * l)))))))));
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(l, Om, kx, ky):
	tmp = 0
	if Om <= 9.5e-170:
		tmp = math.sqrt(0.5)
	elif Om <= 6e+72:
		tmp = math.sqrt((0.5 + (0.5 * (1.0 / (1.0 + (2.0 * ((ky * ky) / ((Om * Om) / (l * l)))))))))
	else:
		tmp = 1.0
	return tmp
function code(l, Om, kx, ky)
	tmp = 0.0
	if (Om <= 9.5e-170)
		tmp = sqrt(0.5);
	elseif (Om <= 6e+72)
		tmp = sqrt(Float64(0.5 + Float64(0.5 * Float64(1.0 / Float64(1.0 + Float64(2.0 * Float64(Float64(ky * ky) / Float64(Float64(Om * Om) / Float64(l * l)))))))));
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(l, Om, kx, ky)
	tmp = 0.0;
	if (Om <= 9.5e-170)
		tmp = sqrt(0.5);
	elseif (Om <= 6e+72)
		tmp = sqrt((0.5 + (0.5 * (1.0 / (1.0 + (2.0 * ((ky * ky) / ((Om * Om) / (l * l)))))))));
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[l_, Om_, kx_, ky_] := If[LessEqual[Om, 9.5e-170], N[Sqrt[0.5], $MachinePrecision], If[LessEqual[Om, 6e+72], N[Sqrt[N[(0.5 + N[(0.5 * N[(1.0 / N[(1.0 + N[(2.0 * N[(N[(ky * ky), $MachinePrecision] / N[(N[(Om * Om), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 1.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;Om \leq 9.5 \cdot 10^{-170}:\\
\;\;\;\;\sqrt{0.5}\\

\mathbf{elif}\;Om \leq 6 \cdot 10^{+72}:\\
\;\;\;\;\sqrt{0.5 + 0.5 \cdot \frac{1}{1 + 2 \cdot \frac{ky \cdot ky}{\frac{Om \cdot Om}{\ell \cdot \ell}}}}\\

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if Om < 9.5000000000000001e-170

    1. Initial program 99.3%

      \[\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)} \]
    2. Simplified99.3%

      \[\leadsto \color{blue}{\sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + {\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}} \]
    3. Taylor expanded in Om around 0 51.1%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{2 \cdot \left(\frac{\ell}{Om} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}}} \]
    4. Step-by-step derivation
      1. unpow251.1%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{2 \cdot \left(\frac{\ell}{Om} \cdot \sqrt{\color{blue}{\sin kx \cdot \sin kx} + {\sin ky}^{2}}\right)}} \]
      2. unpow251.1%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{2 \cdot \left(\frac{\ell}{Om} \cdot \sqrt{\sin kx \cdot \sin kx + \color{blue}{\sin ky \cdot \sin ky}}\right)}} \]
      3. hypot-def51.8%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{2 \cdot \left(\frac{\ell}{Om} \cdot \color{blue}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\right)}} \]
    5. Simplified51.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{2 \cdot \left(\frac{\ell}{Om} \cdot \mathsf{hypot}\left(\sin kx, \sin ky\right)\right)}}} \]
    6. Taylor expanded in l around inf 60.0%

      \[\leadsto \color{blue}{\sqrt{0.5}} \]

    if 9.5000000000000001e-170 < Om < 6.00000000000000006e72

    1. Initial program 95.6%

      \[\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)} \]
    2. Simplified95.6%

      \[\leadsto \color{blue}{\sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + {\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}} \]
    3. Taylor expanded in kx around 0 83.3%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + \color{blue}{4 \cdot \frac{{\ell}^{2} \cdot {\sin ky}^{2}}{{Om}^{2}}}}}} \]
    4. Step-by-step derivation
      1. *-commutative83.3%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + \color{blue}{\frac{{\ell}^{2} \cdot {\sin ky}^{2}}{{Om}^{2}} \cdot 4}}}} \]
      2. associate-/l*80.8%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + \color{blue}{\frac{{\ell}^{2}}{\frac{{Om}^{2}}{{\sin ky}^{2}}}} \cdot 4}}} \]
      3. associate-*l/80.8%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + \color{blue}{\frac{{\ell}^{2} \cdot 4}{\frac{{Om}^{2}}{{\sin ky}^{2}}}}}}} \]
      4. unpow280.8%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + \frac{\color{blue}{\left(\ell \cdot \ell\right)} \cdot 4}{\frac{{Om}^{2}}{{\sin ky}^{2}}}}}} \]
      5. unpow280.8%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + \frac{\left(\ell \cdot \ell\right) \cdot 4}{\frac{\color{blue}{Om \cdot Om}}{{\sin ky}^{2}}}}}} \]
    5. Simplified80.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + \color{blue}{\frac{\left(\ell \cdot \ell\right) \cdot 4}{\frac{Om \cdot Om}{{\sin ky}^{2}}}}}}} \]
    6. Taylor expanded in ky around 0 71.9%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{1 + 2 \cdot \frac{{ky}^{2} \cdot {\ell}^{2}}{{Om}^{2}}}}} \]
    7. Step-by-step derivation
      1. associate-/l*71.4%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{1 + 2 \cdot \color{blue}{\frac{{ky}^{2}}{\frac{{Om}^{2}}{{\ell}^{2}}}}}} \]
      2. unpow271.4%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{1 + 2 \cdot \frac{\color{blue}{ky \cdot ky}}{\frac{{Om}^{2}}{{\ell}^{2}}}}} \]
      3. unpow271.4%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{1 + 2 \cdot \frac{ky \cdot ky}{\frac{\color{blue}{Om \cdot Om}}{{\ell}^{2}}}}} \]
      4. unpow271.4%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{1 + 2 \cdot \frac{ky \cdot ky}{\frac{Om \cdot Om}{\color{blue}{\ell \cdot \ell}}}}} \]
    8. Simplified71.4%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{1 + 2 \cdot \frac{ky \cdot ky}{\frac{Om \cdot Om}{\ell \cdot \ell}}}}} \]

    if 6.00000000000000006e72 < Om

    1. Initial program 98.2%

      \[\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)} \]
    2. Simplified98.2%

      \[\leadsto \color{blue}{\sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + {\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}} \]
    3. Step-by-step derivation
      1. add-sqr-sqrt98.2%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)} \cdot \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}}} \]
      2. hypot-1-def98.2%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}\right)}}} \]
      3. sqrt-prod98.2%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\right)}} \]
      4. unpow298.2%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{\frac{2}{\frac{Om}{\ell}} \cdot \frac{2}{\frac{Om}{\ell}}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      5. sqrt-prod67.9%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\sqrt{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{\frac{2}{\frac{Om}{\ell}}}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      6. add-sqr-sqrt98.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      7. associate-/r/98.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\frac{2}{Om} \cdot \ell\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      8. *-commutative98.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\ell \cdot \frac{2}{Om}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      9. unpow298.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\color{blue}{\sin kx \cdot \sin kx} + {\sin ky}^{2}}\right)}} \]
      10. unpow298.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\sin kx \cdot \sin kx + \color{blue}{\sin ky \cdot \sin ky}}\right)}} \]
      11. hypot-def100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \color{blue}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\right)}} \]
    4. Applied egg-rr100.0%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \mathsf{hypot}\left(\sin kx, \sin ky\right)\right)}}} \]
    5. Taylor expanded in l around 0 91.9%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \color{blue}{1}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification68.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;Om \leq 9.5 \cdot 10^{-170}:\\ \;\;\;\;\sqrt{0.5}\\ \mathbf{elif}\;Om \leq 6 \cdot 10^{+72}:\\ \;\;\;\;\sqrt{0.5 + 0.5 \cdot \frac{1}{1 + 2 \cdot \frac{ky \cdot ky}{\frac{Om \cdot Om}{\ell \cdot \ell}}}}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]

Alternative 5: 52.6% accurate, 6.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq 5.8 \cdot 10^{+83} \lor \neg \left(\ell \leq 6.6 \cdot 10^{+142}\right) \land \ell \leq 1.22 \cdot 10^{+165}:\\ \;\;\;\;1 + \left(\frac{\ell}{\frac{Om}{\ell}} \cdot \frac{kx}{\frac{Om}{kx}}\right) \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5}\\ \end{array} \end{array} \]
(FPCore (l Om kx ky)
 :precision binary64
 (if (or (<= l 5.8e+83) (and (not (<= l 6.6e+142)) (<= l 1.22e+165)))
   (+ 1.0 (* (* (/ l (/ Om l)) (/ kx (/ Om kx))) -0.5))
   (sqrt 0.5)))
double code(double l, double Om, double kx, double ky) {
	double tmp;
	if ((l <= 5.8e+83) || (!(l <= 6.6e+142) && (l <= 1.22e+165))) {
		tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5);
	} else {
		tmp = sqrt(0.5);
	}
	return tmp;
}
real(8) function code(l, om, kx, ky)
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: kx
    real(8), intent (in) :: ky
    real(8) :: tmp
    if ((l <= 5.8d+83) .or. (.not. (l <= 6.6d+142)) .and. (l <= 1.22d+165)) then
        tmp = 1.0d0 + (((l / (om / l)) * (kx / (om / kx))) * (-0.5d0))
    else
        tmp = sqrt(0.5d0)
    end if
    code = tmp
end function
public static double code(double l, double Om, double kx, double ky) {
	double tmp;
	if ((l <= 5.8e+83) || (!(l <= 6.6e+142) && (l <= 1.22e+165))) {
		tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5);
	} else {
		tmp = Math.sqrt(0.5);
	}
	return tmp;
}
def code(l, Om, kx, ky):
	tmp = 0
	if (l <= 5.8e+83) or (not (l <= 6.6e+142) and (l <= 1.22e+165)):
		tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5)
	else:
		tmp = math.sqrt(0.5)
	return tmp
function code(l, Om, kx, ky)
	tmp = 0.0
	if ((l <= 5.8e+83) || (!(l <= 6.6e+142) && (l <= 1.22e+165)))
		tmp = Float64(1.0 + Float64(Float64(Float64(l / Float64(Om / l)) * Float64(kx / Float64(Om / kx))) * -0.5));
	else
		tmp = sqrt(0.5);
	end
	return tmp
end
function tmp_2 = code(l, Om, kx, ky)
	tmp = 0.0;
	if ((l <= 5.8e+83) || (~((l <= 6.6e+142)) && (l <= 1.22e+165)))
		tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5);
	else
		tmp = sqrt(0.5);
	end
	tmp_2 = tmp;
end
code[l_, Om_, kx_, ky_] := If[Or[LessEqual[l, 5.8e+83], And[N[Not[LessEqual[l, 6.6e+142]], $MachinePrecision], LessEqual[l, 1.22e+165]]], N[(1.0 + N[(N[(N[(l / N[(Om / l), $MachinePrecision]), $MachinePrecision] * N[(kx / N[(Om / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision], N[Sqrt[0.5], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 5.8 \cdot 10^{+83} \lor \neg \left(\ell \leq 6.6 \cdot 10^{+142}\right) \land \ell \leq 1.22 \cdot 10^{+165}:\\
\;\;\;\;1 + \left(\frac{\ell}{\frac{Om}{\ell}} \cdot \frac{kx}{\frac{Om}{kx}}\right) \cdot -0.5\\

\mathbf{else}:\\
\;\;\;\;\sqrt{0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 5.79999999999999999e83 or 6.6000000000000004e142 < l < 1.2199999999999999e165

    1. Initial program 98.2%

      \[\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)} \]
    2. Simplified98.2%

      \[\leadsto \color{blue}{\sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + {\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}} \]
    3. Step-by-step derivation
      1. add-sqr-sqrt98.2%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)} \cdot \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}}} \]
      2. hypot-1-def98.2%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}\right)}}} \]
      3. sqrt-prod98.2%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\right)}} \]
      4. unpow298.2%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{\frac{2}{\frac{Om}{\ell}} \cdot \frac{2}{\frac{Om}{\ell}}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      5. sqrt-prod56.3%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\sqrt{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{\frac{2}{\frac{Om}{\ell}}}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      6. add-sqr-sqrt98.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      7. associate-/r/98.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\frac{2}{Om} \cdot \ell\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      8. *-commutative98.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\ell \cdot \frac{2}{Om}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      9. unpow298.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\color{blue}{\sin kx \cdot \sin kx} + {\sin ky}^{2}}\right)}} \]
      10. unpow298.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\sin kx \cdot \sin kx + \color{blue}{\sin ky \cdot \sin ky}}\right)}} \]
      11. hypot-def100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \color{blue}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\right)}} \]
    4. Applied egg-rr100.0%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \mathsf{hypot}\left(\sin kx, \sin ky\right)\right)}}} \]
    5. Taylor expanded in ky around 0 92.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{2 \cdot \frac{\ell \cdot \sin kx}{Om}}\right)}} \]
    6. Step-by-step derivation
      1. associate-*r/92.8%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2 \cdot \left(\ell \cdot \sin kx\right)}{Om}}\right)}} \]
    7. Simplified92.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2 \cdot \left(\ell \cdot \sin kx\right)}{Om}}\right)}} \]
    8. Taylor expanded in kx around 0 44.7%

      \[\leadsto \color{blue}{1 + -0.5 \cdot \frac{{kx}^{2} \cdot {\ell}^{2}}{{Om}^{2}}} \]
    9. Step-by-step derivation
      1. *-commutative44.7%

        \[\leadsto 1 + \color{blue}{\frac{{kx}^{2} \cdot {\ell}^{2}}{{Om}^{2}} \cdot -0.5} \]
      2. *-commutative44.7%

        \[\leadsto 1 + \frac{\color{blue}{{\ell}^{2} \cdot {kx}^{2}}}{{Om}^{2}} \cdot -0.5 \]
      3. unpow244.7%

        \[\leadsto 1 + \frac{\color{blue}{\left(\ell \cdot \ell\right)} \cdot {kx}^{2}}{{Om}^{2}} \cdot -0.5 \]
      4. unpow244.7%

        \[\leadsto 1 + \frac{\left(\ell \cdot \ell\right) \cdot \color{blue}{\left(kx \cdot kx\right)}}{{Om}^{2}} \cdot -0.5 \]
      5. unpow244.7%

        \[\leadsto 1 + \frac{\left(\ell \cdot \ell\right) \cdot \left(kx \cdot kx\right)}{\color{blue}{Om \cdot Om}} \cdot -0.5 \]
    10. Simplified44.7%

      \[\leadsto \color{blue}{1 + \frac{\left(\ell \cdot \ell\right) \cdot \left(kx \cdot kx\right)}{Om \cdot Om} \cdot -0.5} \]
    11. Taylor expanded in l around 0 44.7%

      \[\leadsto 1 + \color{blue}{\frac{{kx}^{2} \cdot {\ell}^{2}}{{Om}^{2}}} \cdot -0.5 \]
    12. Step-by-step derivation
      1. unpow244.7%

        \[\leadsto 1 + \frac{\color{blue}{\left(kx \cdot kx\right)} \cdot {\ell}^{2}}{{Om}^{2}} \cdot -0.5 \]
      2. *-commutative44.7%

        \[\leadsto 1 + \frac{\color{blue}{{\ell}^{2} \cdot \left(kx \cdot kx\right)}}{{Om}^{2}} \cdot -0.5 \]
      3. unpow244.7%

        \[\leadsto 1 + \frac{{\ell}^{2} \cdot \left(kx \cdot kx\right)}{\color{blue}{Om \cdot Om}} \cdot -0.5 \]
      4. times-frac48.2%

        \[\leadsto 1 + \color{blue}{\left(\frac{{\ell}^{2}}{Om} \cdot \frac{kx \cdot kx}{Om}\right)} \cdot -0.5 \]
      5. unpow248.2%

        \[\leadsto 1 + \left(\frac{\color{blue}{\ell \cdot \ell}}{Om} \cdot \frac{kx \cdot kx}{Om}\right) \cdot -0.5 \]
      6. associate-/l*50.5%

        \[\leadsto 1 + \left(\color{blue}{\frac{\ell}{\frac{Om}{\ell}}} \cdot \frac{kx \cdot kx}{Om}\right) \cdot -0.5 \]
      7. associate-/l*53.7%

        \[\leadsto 1 + \left(\frac{\ell}{\frac{Om}{\ell}} \cdot \color{blue}{\frac{kx}{\frac{Om}{kx}}}\right) \cdot -0.5 \]
    13. Simplified53.7%

      \[\leadsto 1 + \color{blue}{\left(\frac{\ell}{\frac{Om}{\ell}} \cdot \frac{kx}{\frac{Om}{kx}}\right)} \cdot -0.5 \]

    if 5.79999999999999999e83 < l < 6.6000000000000004e142 or 1.2199999999999999e165 < l

    1. Initial program 100.0%

      \[\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)} \]
    2. Simplified100.0%

      \[\leadsto \color{blue}{\sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + {\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}} \]
    3. Taylor expanded in Om around 0 86.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{2 \cdot \left(\frac{\ell}{Om} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}}} \]
    4. Step-by-step derivation
      1. unpow286.5%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{2 \cdot \left(\frac{\ell}{Om} \cdot \sqrt{\color{blue}{\sin kx \cdot \sin kx} + {\sin ky}^{2}}\right)}} \]
      2. unpow286.5%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{2 \cdot \left(\frac{\ell}{Om} \cdot \sqrt{\sin kx \cdot \sin kx + \color{blue}{\sin ky \cdot \sin ky}}\right)}} \]
      3. hypot-def86.5%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{2 \cdot \left(\frac{\ell}{Om} \cdot \color{blue}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\right)}} \]
    5. Simplified86.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{2 \cdot \left(\frac{\ell}{Om} \cdot \mathsf{hypot}\left(\sin kx, \sin ky\right)\right)}}} \]
    6. Taylor expanded in l around inf 88.2%

      \[\leadsto \color{blue}{\sqrt{0.5}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification59.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 5.8 \cdot 10^{+83} \lor \neg \left(\ell \leq 6.6 \cdot 10^{+142}\right) \land \ell \leq 1.22 \cdot 10^{+165}:\\ \;\;\;\;1 + \left(\frac{\ell}{\frac{Om}{\ell}} \cdot \frac{kx}{\frac{Om}{kx}}\right) \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5}\\ \end{array} \]

Alternative 6: 69.1% accurate, 6.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq 6.5 \cdot 10^{+88}:\\ \;\;\;\;1\\ \mathbf{elif}\;\ell \leq 1.04 \cdot 10^{+142}:\\ \;\;\;\;\sqrt{0.5}\\ \mathbf{elif}\;\ell \leq 1.5 \cdot 10^{+165}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5}\\ \end{array} \end{array} \]
(FPCore (l Om kx ky)
 :precision binary64
 (if (<= l 6.5e+88)
   1.0
   (if (<= l 1.04e+142) (sqrt 0.5) (if (<= l 1.5e+165) 1.0 (sqrt 0.5)))))
double code(double l, double Om, double kx, double ky) {
	double tmp;
	if (l <= 6.5e+88) {
		tmp = 1.0;
	} else if (l <= 1.04e+142) {
		tmp = sqrt(0.5);
	} else if (l <= 1.5e+165) {
		tmp = 1.0;
	} else {
		tmp = sqrt(0.5);
	}
	return tmp;
}
real(8) function code(l, om, kx, ky)
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: kx
    real(8), intent (in) :: ky
    real(8) :: tmp
    if (l <= 6.5d+88) then
        tmp = 1.0d0
    else if (l <= 1.04d+142) then
        tmp = sqrt(0.5d0)
    else if (l <= 1.5d+165) then
        tmp = 1.0d0
    else
        tmp = sqrt(0.5d0)
    end if
    code = tmp
end function
public static double code(double l, double Om, double kx, double ky) {
	double tmp;
	if (l <= 6.5e+88) {
		tmp = 1.0;
	} else if (l <= 1.04e+142) {
		tmp = Math.sqrt(0.5);
	} else if (l <= 1.5e+165) {
		tmp = 1.0;
	} else {
		tmp = Math.sqrt(0.5);
	}
	return tmp;
}
def code(l, Om, kx, ky):
	tmp = 0
	if l <= 6.5e+88:
		tmp = 1.0
	elif l <= 1.04e+142:
		tmp = math.sqrt(0.5)
	elif l <= 1.5e+165:
		tmp = 1.0
	else:
		tmp = math.sqrt(0.5)
	return tmp
function code(l, Om, kx, ky)
	tmp = 0.0
	if (l <= 6.5e+88)
		tmp = 1.0;
	elseif (l <= 1.04e+142)
		tmp = sqrt(0.5);
	elseif (l <= 1.5e+165)
		tmp = 1.0;
	else
		tmp = sqrt(0.5);
	end
	return tmp
end
function tmp_2 = code(l, Om, kx, ky)
	tmp = 0.0;
	if (l <= 6.5e+88)
		tmp = 1.0;
	elseif (l <= 1.04e+142)
		tmp = sqrt(0.5);
	elseif (l <= 1.5e+165)
		tmp = 1.0;
	else
		tmp = sqrt(0.5);
	end
	tmp_2 = tmp;
end
code[l_, Om_, kx_, ky_] := If[LessEqual[l, 6.5e+88], 1.0, If[LessEqual[l, 1.04e+142], N[Sqrt[0.5], $MachinePrecision], If[LessEqual[l, 1.5e+165], 1.0, N[Sqrt[0.5], $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 6.5 \cdot 10^{+88}:\\
\;\;\;\;1\\

\mathbf{elif}\;\ell \leq 1.04 \cdot 10^{+142}:\\
\;\;\;\;\sqrt{0.5}\\

\mathbf{elif}\;\ell \leq 1.5 \cdot 10^{+165}:\\
\;\;\;\;1\\

\mathbf{else}:\\
\;\;\;\;\sqrt{0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 6.5000000000000002e88 or 1.04e142 < l < 1.49999999999999995e165

    1. Initial program 98.2%

      \[\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)} \]
    2. Simplified98.2%

      \[\leadsto \color{blue}{\sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + {\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}} \]
    3. Step-by-step derivation
      1. add-sqr-sqrt98.2%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)} \cdot \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}}} \]
      2. hypot-1-def98.2%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}\right)}}} \]
      3. sqrt-prod98.2%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\right)}} \]
      4. unpow298.2%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{\frac{2}{\frac{Om}{\ell}} \cdot \frac{2}{\frac{Om}{\ell}}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      5. sqrt-prod56.5%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\sqrt{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{\frac{2}{\frac{Om}{\ell}}}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      6. add-sqr-sqrt98.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      7. associate-/r/98.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\frac{2}{Om} \cdot \ell\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      8. *-commutative98.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\ell \cdot \frac{2}{Om}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      9. unpow298.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\color{blue}{\sin kx \cdot \sin kx} + {\sin ky}^{2}}\right)}} \]
      10. unpow298.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\sin kx \cdot \sin kx + \color{blue}{\sin ky \cdot \sin ky}}\right)}} \]
      11. hypot-def100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \color{blue}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\right)}} \]
    4. Applied egg-rr100.0%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \mathsf{hypot}\left(\sin kx, \sin ky\right)\right)}}} \]
    5. Taylor expanded in l around 0 72.2%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \color{blue}{1}} \]

    if 6.5000000000000002e88 < l < 1.04e142 or 1.49999999999999995e165 < l

    1. Initial program 100.0%

      \[\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)} \]
    2. Simplified100.0%

      \[\leadsto \color{blue}{\sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + {\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}} \]
    3. Taylor expanded in Om around 0 88.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{2 \cdot \left(\frac{\ell}{Om} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}}} \]
    4. Step-by-step derivation
      1. unpow288.5%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{2 \cdot \left(\frac{\ell}{Om} \cdot \sqrt{\color{blue}{\sin kx \cdot \sin kx} + {\sin ky}^{2}}\right)}} \]
      2. unpow288.5%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{2 \cdot \left(\frac{\ell}{Om} \cdot \sqrt{\sin kx \cdot \sin kx + \color{blue}{\sin ky \cdot \sin ky}}\right)}} \]
      3. hypot-def88.5%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{2 \cdot \left(\frac{\ell}{Om} \cdot \color{blue}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\right)}} \]
    5. Simplified88.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{2 \cdot \left(\frac{\ell}{Om} \cdot \mathsf{hypot}\left(\sin kx, \sin ky\right)\right)}}} \]
    6. Taylor expanded in l around inf 89.9%

      \[\leadsto \color{blue}{\sqrt{0.5}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification75.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 6.5 \cdot 10^{+88}:\\ \;\;\;\;1\\ \mathbf{elif}\;\ell \leq 1.04 \cdot 10^{+142}:\\ \;\;\;\;\sqrt{0.5}\\ \mathbf{elif}\;\ell \leq 1.5 \cdot 10^{+165}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5}\\ \end{array} \]

Alternative 7: 42.1% accurate, 37.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq 1.7 \cdot 10^{+186}:\\ \;\;\;\;1 + \left(\frac{\ell}{\frac{Om}{\ell}} \cdot \frac{kx}{\frac{Om}{kx}}\right) \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;1 + -0.5 \cdot \left(\left(\ell \cdot \left(\ell \cdot \left(kx \cdot kx\right)\right)\right) \cdot \frac{1}{Om \cdot Om}\right)\\ \end{array} \end{array} \]
(FPCore (l Om kx ky)
 :precision binary64
 (if (<= l 1.7e+186)
   (+ 1.0 (* (* (/ l (/ Om l)) (/ kx (/ Om kx))) -0.5))
   (+ 1.0 (* -0.5 (* (* l (* l (* kx kx))) (/ 1.0 (* Om Om)))))))
double code(double l, double Om, double kx, double ky) {
	double tmp;
	if (l <= 1.7e+186) {
		tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5);
	} else {
		tmp = 1.0 + (-0.5 * ((l * (l * (kx * kx))) * (1.0 / (Om * Om))));
	}
	return tmp;
}
real(8) function code(l, om, kx, ky)
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: kx
    real(8), intent (in) :: ky
    real(8) :: tmp
    if (l <= 1.7d+186) then
        tmp = 1.0d0 + (((l / (om / l)) * (kx / (om / kx))) * (-0.5d0))
    else
        tmp = 1.0d0 + ((-0.5d0) * ((l * (l * (kx * kx))) * (1.0d0 / (om * om))))
    end if
    code = tmp
end function
public static double code(double l, double Om, double kx, double ky) {
	double tmp;
	if (l <= 1.7e+186) {
		tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5);
	} else {
		tmp = 1.0 + (-0.5 * ((l * (l * (kx * kx))) * (1.0 / (Om * Om))));
	}
	return tmp;
}
def code(l, Om, kx, ky):
	tmp = 0
	if l <= 1.7e+186:
		tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5)
	else:
		tmp = 1.0 + (-0.5 * ((l * (l * (kx * kx))) * (1.0 / (Om * Om))))
	return tmp
function code(l, Om, kx, ky)
	tmp = 0.0
	if (l <= 1.7e+186)
		tmp = Float64(1.0 + Float64(Float64(Float64(l / Float64(Om / l)) * Float64(kx / Float64(Om / kx))) * -0.5));
	else
		tmp = Float64(1.0 + Float64(-0.5 * Float64(Float64(l * Float64(l * Float64(kx * kx))) * Float64(1.0 / Float64(Om * Om)))));
	end
	return tmp
end
function tmp_2 = code(l, Om, kx, ky)
	tmp = 0.0;
	if (l <= 1.7e+186)
		tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5);
	else
		tmp = 1.0 + (-0.5 * ((l * (l * (kx * kx))) * (1.0 / (Om * Om))));
	end
	tmp_2 = tmp;
end
code[l_, Om_, kx_, ky_] := If[LessEqual[l, 1.7e+186], N[(1.0 + N[(N[(N[(l / N[(Om / l), $MachinePrecision]), $MachinePrecision] * N[(kx / N[(Om / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-0.5 * N[(N[(l * N[(l * N[(kx * kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(Om * Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.7 \cdot 10^{+186}:\\
\;\;\;\;1 + \left(\frac{\ell}{\frac{Om}{\ell}} \cdot \frac{kx}{\frac{Om}{kx}}\right) \cdot -0.5\\

\mathbf{else}:\\
\;\;\;\;1 + -0.5 \cdot \left(\left(\ell \cdot \left(\ell \cdot \left(kx \cdot kx\right)\right)\right) \cdot \frac{1}{Om \cdot Om}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 1.70000000000000003e186

    1. Initial program 98.3%

      \[\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)} \]
    2. Simplified98.3%

      \[\leadsto \color{blue}{\sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + {\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}} \]
    3. Step-by-step derivation
      1. add-sqr-sqrt98.3%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)} \cdot \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}}} \]
      2. hypot-1-def98.3%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}\right)}}} \]
      3. sqrt-prod98.3%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\right)}} \]
      4. unpow298.3%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{\frac{2}{\frac{Om}{\ell}} \cdot \frac{2}{\frac{Om}{\ell}}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      5. sqrt-prod55.4%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\sqrt{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{\frac{2}{\frac{Om}{\ell}}}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      6. add-sqr-sqrt98.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      7. associate-/r/98.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\frac{2}{Om} \cdot \ell\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      8. *-commutative98.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\ell \cdot \frac{2}{Om}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      9. unpow298.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\color{blue}{\sin kx \cdot \sin kx} + {\sin ky}^{2}}\right)}} \]
      10. unpow298.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\sin kx \cdot \sin kx + \color{blue}{\sin ky \cdot \sin ky}}\right)}} \]
      11. hypot-def100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \color{blue}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\right)}} \]
    4. Applied egg-rr100.0%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \mathsf{hypot}\left(\sin kx, \sin ky\right)\right)}}} \]
    5. Taylor expanded in ky around 0 92.9%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{2 \cdot \frac{\ell \cdot \sin kx}{Om}}\right)}} \]
    6. Step-by-step derivation
      1. associate-*r/92.9%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2 \cdot \left(\ell \cdot \sin kx\right)}{Om}}\right)}} \]
    7. Simplified92.9%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2 \cdot \left(\ell \cdot \sin kx\right)}{Om}}\right)}} \]
    8. Taylor expanded in kx around 0 42.1%

      \[\leadsto \color{blue}{1 + -0.5 \cdot \frac{{kx}^{2} \cdot {\ell}^{2}}{{Om}^{2}}} \]
    9. Step-by-step derivation
      1. *-commutative42.1%

        \[\leadsto 1 + \color{blue}{\frac{{kx}^{2} \cdot {\ell}^{2}}{{Om}^{2}} \cdot -0.5} \]
      2. *-commutative42.1%

        \[\leadsto 1 + \frac{\color{blue}{{\ell}^{2} \cdot {kx}^{2}}}{{Om}^{2}} \cdot -0.5 \]
      3. unpow242.1%

        \[\leadsto 1 + \frac{\color{blue}{\left(\ell \cdot \ell\right)} \cdot {kx}^{2}}{{Om}^{2}} \cdot -0.5 \]
      4. unpow242.1%

        \[\leadsto 1 + \frac{\left(\ell \cdot \ell\right) \cdot \color{blue}{\left(kx \cdot kx\right)}}{{Om}^{2}} \cdot -0.5 \]
      5. unpow242.1%

        \[\leadsto 1 + \frac{\left(\ell \cdot \ell\right) \cdot \left(kx \cdot kx\right)}{\color{blue}{Om \cdot Om}} \cdot -0.5 \]
    10. Simplified42.1%

      \[\leadsto \color{blue}{1 + \frac{\left(\ell \cdot \ell\right) \cdot \left(kx \cdot kx\right)}{Om \cdot Om} \cdot -0.5} \]
    11. Taylor expanded in l around 0 42.1%

      \[\leadsto 1 + \color{blue}{\frac{{kx}^{2} \cdot {\ell}^{2}}{{Om}^{2}}} \cdot -0.5 \]
    12. Step-by-step derivation
      1. unpow242.1%

        \[\leadsto 1 + \frac{\color{blue}{\left(kx \cdot kx\right)} \cdot {\ell}^{2}}{{Om}^{2}} \cdot -0.5 \]
      2. *-commutative42.1%

        \[\leadsto 1 + \frac{\color{blue}{{\ell}^{2} \cdot \left(kx \cdot kx\right)}}{{Om}^{2}} \cdot -0.5 \]
      3. unpow242.1%

        \[\leadsto 1 + \frac{{\ell}^{2} \cdot \left(kx \cdot kx\right)}{\color{blue}{Om \cdot Om}} \cdot -0.5 \]
      4. times-frac45.4%

        \[\leadsto 1 + \color{blue}{\left(\frac{{\ell}^{2}}{Om} \cdot \frac{kx \cdot kx}{Om}\right)} \cdot -0.5 \]
      5. unpow245.4%

        \[\leadsto 1 + \left(\frac{\color{blue}{\ell \cdot \ell}}{Om} \cdot \frac{kx \cdot kx}{Om}\right) \cdot -0.5 \]
      6. associate-/l*47.6%

        \[\leadsto 1 + \left(\color{blue}{\frac{\ell}{\frac{Om}{\ell}}} \cdot \frac{kx \cdot kx}{Om}\right) \cdot -0.5 \]
      7. associate-/l*50.6%

        \[\leadsto 1 + \left(\frac{\ell}{\frac{Om}{\ell}} \cdot \color{blue}{\frac{kx}{\frac{Om}{kx}}}\right) \cdot -0.5 \]
    13. Simplified50.6%

      \[\leadsto 1 + \color{blue}{\left(\frac{\ell}{\frac{Om}{\ell}} \cdot \frac{kx}{\frac{Om}{kx}}\right)} \cdot -0.5 \]

    if 1.70000000000000003e186 < l

    1. Initial program 100.0%

      \[\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)} \]
    2. Simplified100.0%

      \[\leadsto \color{blue}{\sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + {\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}} \]
    3. Step-by-step derivation
      1. add-sqr-sqrt100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)} \cdot \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}}} \]
      2. hypot-1-def100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}\right)}}} \]
      3. sqrt-prod100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\right)}} \]
      4. unpow2100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{\frac{2}{\frac{Om}{\ell}} \cdot \frac{2}{\frac{Om}{\ell}}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      5. sqrt-prod46.2%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\sqrt{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{\frac{2}{\frac{Om}{\ell}}}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      6. add-sqr-sqrt100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      7. associate-/r/100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\frac{2}{Om} \cdot \ell\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      8. *-commutative100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\ell \cdot \frac{2}{Om}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      9. unpow2100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\color{blue}{\sin kx \cdot \sin kx} + {\sin ky}^{2}}\right)}} \]
      10. unpow2100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\sin kx \cdot \sin kx + \color{blue}{\sin ky \cdot \sin ky}}\right)}} \]
      11. hypot-def100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \color{blue}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\right)}} \]
    4. Applied egg-rr100.0%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \mathsf{hypot}\left(\sin kx, \sin ky\right)\right)}}} \]
    5. Taylor expanded in ky around 0 93.3%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{2 \cdot \frac{\ell \cdot \sin kx}{Om}}\right)}} \]
    6. Step-by-step derivation
      1. associate-*r/93.3%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2 \cdot \left(\ell \cdot \sin kx\right)}{Om}}\right)}} \]
    7. Simplified93.3%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2 \cdot \left(\ell \cdot \sin kx\right)}{Om}}\right)}} \]
    8. Taylor expanded in kx around 0 0.4%

      \[\leadsto \color{blue}{1 + -0.5 \cdot \frac{{kx}^{2} \cdot {\ell}^{2}}{{Om}^{2}}} \]
    9. Step-by-step derivation
      1. *-commutative0.4%

        \[\leadsto 1 + \color{blue}{\frac{{kx}^{2} \cdot {\ell}^{2}}{{Om}^{2}} \cdot -0.5} \]
      2. *-commutative0.4%

        \[\leadsto 1 + \frac{\color{blue}{{\ell}^{2} \cdot {kx}^{2}}}{{Om}^{2}} \cdot -0.5 \]
      3. unpow20.4%

        \[\leadsto 1 + \frac{\color{blue}{\left(\ell \cdot \ell\right)} \cdot {kx}^{2}}{{Om}^{2}} \cdot -0.5 \]
      4. unpow20.4%

        \[\leadsto 1 + \frac{\left(\ell \cdot \ell\right) \cdot \color{blue}{\left(kx \cdot kx\right)}}{{Om}^{2}} \cdot -0.5 \]
      5. unpow20.4%

        \[\leadsto 1 + \frac{\left(\ell \cdot \ell\right) \cdot \left(kx \cdot kx\right)}{\color{blue}{Om \cdot Om}} \cdot -0.5 \]
    10. Simplified0.4%

      \[\leadsto \color{blue}{1 + \frac{\left(\ell \cdot \ell\right) \cdot \left(kx \cdot kx\right)}{Om \cdot Om} \cdot -0.5} \]
    11. Step-by-step derivation
      1. div-inv0.4%

        \[\leadsto 1 + \color{blue}{\left(\left(\left(\ell \cdot \ell\right) \cdot \left(kx \cdot kx\right)\right) \cdot \frac{1}{Om \cdot Om}\right)} \cdot -0.5 \]
      2. associate-*l*2.7%

        \[\leadsto 1 + \left(\color{blue}{\left(\ell \cdot \left(\ell \cdot \left(kx \cdot kx\right)\right)\right)} \cdot \frac{1}{Om \cdot Om}\right) \cdot -0.5 \]
    12. Applied egg-rr2.7%

      \[\leadsto 1 + \color{blue}{\left(\left(\ell \cdot \left(\ell \cdot \left(kx \cdot kx\right)\right)\right) \cdot \frac{1}{Om \cdot Om}\right)} \cdot -0.5 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification45.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 1.7 \cdot 10^{+186}:\\ \;\;\;\;1 + \left(\frac{\ell}{\frac{Om}{\ell}} \cdot \frac{kx}{\frac{Om}{kx}}\right) \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;1 + -0.5 \cdot \left(\left(\ell \cdot \left(\ell \cdot \left(kx \cdot kx\right)\right)\right) \cdot \frac{1}{Om \cdot Om}\right)\\ \end{array} \]

Alternative 8: 42.1% accurate, 42.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq 7.5 \cdot 10^{+185}:\\ \;\;\;\;1 + \left(\frac{\ell}{\frac{Om}{\ell}} \cdot \frac{kx}{\frac{Om}{kx}}\right) \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;1 + -0.5 \cdot \frac{\ell \cdot \left(\ell \cdot \left(kx \cdot kx\right)\right)}{Om \cdot Om}\\ \end{array} \end{array} \]
(FPCore (l Om kx ky)
 :precision binary64
 (if (<= l 7.5e+185)
   (+ 1.0 (* (* (/ l (/ Om l)) (/ kx (/ Om kx))) -0.5))
   (+ 1.0 (* -0.5 (/ (* l (* l (* kx kx))) (* Om Om))))))
double code(double l, double Om, double kx, double ky) {
	double tmp;
	if (l <= 7.5e+185) {
		tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5);
	} else {
		tmp = 1.0 + (-0.5 * ((l * (l * (kx * kx))) / (Om * Om)));
	}
	return tmp;
}
real(8) function code(l, om, kx, ky)
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: kx
    real(8), intent (in) :: ky
    real(8) :: tmp
    if (l <= 7.5d+185) then
        tmp = 1.0d0 + (((l / (om / l)) * (kx / (om / kx))) * (-0.5d0))
    else
        tmp = 1.0d0 + ((-0.5d0) * ((l * (l * (kx * kx))) / (om * om)))
    end if
    code = tmp
end function
public static double code(double l, double Om, double kx, double ky) {
	double tmp;
	if (l <= 7.5e+185) {
		tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5);
	} else {
		tmp = 1.0 + (-0.5 * ((l * (l * (kx * kx))) / (Om * Om)));
	}
	return tmp;
}
def code(l, Om, kx, ky):
	tmp = 0
	if l <= 7.5e+185:
		tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5)
	else:
		tmp = 1.0 + (-0.5 * ((l * (l * (kx * kx))) / (Om * Om)))
	return tmp
function code(l, Om, kx, ky)
	tmp = 0.0
	if (l <= 7.5e+185)
		tmp = Float64(1.0 + Float64(Float64(Float64(l / Float64(Om / l)) * Float64(kx / Float64(Om / kx))) * -0.5));
	else
		tmp = Float64(1.0 + Float64(-0.5 * Float64(Float64(l * Float64(l * Float64(kx * kx))) / Float64(Om * Om))));
	end
	return tmp
end
function tmp_2 = code(l, Om, kx, ky)
	tmp = 0.0;
	if (l <= 7.5e+185)
		tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5);
	else
		tmp = 1.0 + (-0.5 * ((l * (l * (kx * kx))) / (Om * Om)));
	end
	tmp_2 = tmp;
end
code[l_, Om_, kx_, ky_] := If[LessEqual[l, 7.5e+185], N[(1.0 + N[(N[(N[(l / N[(Om / l), $MachinePrecision]), $MachinePrecision] * N[(kx / N[(Om / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-0.5 * N[(N[(l * N[(l * N[(kx * kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(Om * Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 7.5 \cdot 10^{+185}:\\
\;\;\;\;1 + \left(\frac{\ell}{\frac{Om}{\ell}} \cdot \frac{kx}{\frac{Om}{kx}}\right) \cdot -0.5\\

\mathbf{else}:\\
\;\;\;\;1 + -0.5 \cdot \frac{\ell \cdot \left(\ell \cdot \left(kx \cdot kx\right)\right)}{Om \cdot Om}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 7.49999999999999955e185

    1. Initial program 98.3%

      \[\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)} \]
    2. Simplified98.3%

      \[\leadsto \color{blue}{\sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + {\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}} \]
    3. Step-by-step derivation
      1. add-sqr-sqrt98.3%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)} \cdot \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}}} \]
      2. hypot-1-def98.3%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}\right)}}} \]
      3. sqrt-prod98.3%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\right)}} \]
      4. unpow298.3%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{\frac{2}{\frac{Om}{\ell}} \cdot \frac{2}{\frac{Om}{\ell}}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      5. sqrt-prod55.4%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\sqrt{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{\frac{2}{\frac{Om}{\ell}}}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      6. add-sqr-sqrt98.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      7. associate-/r/98.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\frac{2}{Om} \cdot \ell\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      8. *-commutative98.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\ell \cdot \frac{2}{Om}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      9. unpow298.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\color{blue}{\sin kx \cdot \sin kx} + {\sin ky}^{2}}\right)}} \]
      10. unpow298.6%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\sin kx \cdot \sin kx + \color{blue}{\sin ky \cdot \sin ky}}\right)}} \]
      11. hypot-def100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \color{blue}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\right)}} \]
    4. Applied egg-rr100.0%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \mathsf{hypot}\left(\sin kx, \sin ky\right)\right)}}} \]
    5. Taylor expanded in ky around 0 92.9%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{2 \cdot \frac{\ell \cdot \sin kx}{Om}}\right)}} \]
    6. Step-by-step derivation
      1. associate-*r/92.9%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2 \cdot \left(\ell \cdot \sin kx\right)}{Om}}\right)}} \]
    7. Simplified92.9%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2 \cdot \left(\ell \cdot \sin kx\right)}{Om}}\right)}} \]
    8. Taylor expanded in kx around 0 42.1%

      \[\leadsto \color{blue}{1 + -0.5 \cdot \frac{{kx}^{2} \cdot {\ell}^{2}}{{Om}^{2}}} \]
    9. Step-by-step derivation
      1. *-commutative42.1%

        \[\leadsto 1 + \color{blue}{\frac{{kx}^{2} \cdot {\ell}^{2}}{{Om}^{2}} \cdot -0.5} \]
      2. *-commutative42.1%

        \[\leadsto 1 + \frac{\color{blue}{{\ell}^{2} \cdot {kx}^{2}}}{{Om}^{2}} \cdot -0.5 \]
      3. unpow242.1%

        \[\leadsto 1 + \frac{\color{blue}{\left(\ell \cdot \ell\right)} \cdot {kx}^{2}}{{Om}^{2}} \cdot -0.5 \]
      4. unpow242.1%

        \[\leadsto 1 + \frac{\left(\ell \cdot \ell\right) \cdot \color{blue}{\left(kx \cdot kx\right)}}{{Om}^{2}} \cdot -0.5 \]
      5. unpow242.1%

        \[\leadsto 1 + \frac{\left(\ell \cdot \ell\right) \cdot \left(kx \cdot kx\right)}{\color{blue}{Om \cdot Om}} \cdot -0.5 \]
    10. Simplified42.1%

      \[\leadsto \color{blue}{1 + \frac{\left(\ell \cdot \ell\right) \cdot \left(kx \cdot kx\right)}{Om \cdot Om} \cdot -0.5} \]
    11. Taylor expanded in l around 0 42.1%

      \[\leadsto 1 + \color{blue}{\frac{{kx}^{2} \cdot {\ell}^{2}}{{Om}^{2}}} \cdot -0.5 \]
    12. Step-by-step derivation
      1. unpow242.1%

        \[\leadsto 1 + \frac{\color{blue}{\left(kx \cdot kx\right)} \cdot {\ell}^{2}}{{Om}^{2}} \cdot -0.5 \]
      2. *-commutative42.1%

        \[\leadsto 1 + \frac{\color{blue}{{\ell}^{2} \cdot \left(kx \cdot kx\right)}}{{Om}^{2}} \cdot -0.5 \]
      3. unpow242.1%

        \[\leadsto 1 + \frac{{\ell}^{2} \cdot \left(kx \cdot kx\right)}{\color{blue}{Om \cdot Om}} \cdot -0.5 \]
      4. times-frac45.4%

        \[\leadsto 1 + \color{blue}{\left(\frac{{\ell}^{2}}{Om} \cdot \frac{kx \cdot kx}{Om}\right)} \cdot -0.5 \]
      5. unpow245.4%

        \[\leadsto 1 + \left(\frac{\color{blue}{\ell \cdot \ell}}{Om} \cdot \frac{kx \cdot kx}{Om}\right) \cdot -0.5 \]
      6. associate-/l*47.6%

        \[\leadsto 1 + \left(\color{blue}{\frac{\ell}{\frac{Om}{\ell}}} \cdot \frac{kx \cdot kx}{Om}\right) \cdot -0.5 \]
      7. associate-/l*50.6%

        \[\leadsto 1 + \left(\frac{\ell}{\frac{Om}{\ell}} \cdot \color{blue}{\frac{kx}{\frac{Om}{kx}}}\right) \cdot -0.5 \]
    13. Simplified50.6%

      \[\leadsto 1 + \color{blue}{\left(\frac{\ell}{\frac{Om}{\ell}} \cdot \frac{kx}{\frac{Om}{kx}}\right)} \cdot -0.5 \]

    if 7.49999999999999955e185 < l

    1. Initial program 100.0%

      \[\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)} \]
    2. Simplified100.0%

      \[\leadsto \color{blue}{\sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + {\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}} \]
    3. Step-by-step derivation
      1. add-sqr-sqrt100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)} \cdot \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}}} \]
      2. hypot-1-def100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}\right)}}} \]
      3. sqrt-prod100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\right)}} \]
      4. unpow2100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{\frac{2}{\frac{Om}{\ell}} \cdot \frac{2}{\frac{Om}{\ell}}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      5. sqrt-prod46.2%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\sqrt{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{\frac{2}{\frac{Om}{\ell}}}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      6. add-sqr-sqrt100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      7. associate-/r/100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\frac{2}{Om} \cdot \ell\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      8. *-commutative100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\ell \cdot \frac{2}{Om}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
      9. unpow2100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\color{blue}{\sin kx \cdot \sin kx} + {\sin ky}^{2}}\right)}} \]
      10. unpow2100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\sin kx \cdot \sin kx + \color{blue}{\sin ky \cdot \sin ky}}\right)}} \]
      11. hypot-def100.0%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \color{blue}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\right)}} \]
    4. Applied egg-rr100.0%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \mathsf{hypot}\left(\sin kx, \sin ky\right)\right)}}} \]
    5. Taylor expanded in ky around 0 93.3%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{2 \cdot \frac{\ell \cdot \sin kx}{Om}}\right)}} \]
    6. Step-by-step derivation
      1. associate-*r/93.3%

        \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2 \cdot \left(\ell \cdot \sin kx\right)}{Om}}\right)}} \]
    7. Simplified93.3%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2 \cdot \left(\ell \cdot \sin kx\right)}{Om}}\right)}} \]
    8. Taylor expanded in kx around 0 0.4%

      \[\leadsto \color{blue}{1 + -0.5 \cdot \frac{{kx}^{2} \cdot {\ell}^{2}}{{Om}^{2}}} \]
    9. Step-by-step derivation
      1. *-commutative0.4%

        \[\leadsto 1 + \color{blue}{\frac{{kx}^{2} \cdot {\ell}^{2}}{{Om}^{2}} \cdot -0.5} \]
      2. *-commutative0.4%

        \[\leadsto 1 + \frac{\color{blue}{{\ell}^{2} \cdot {kx}^{2}}}{{Om}^{2}} \cdot -0.5 \]
      3. unpow20.4%

        \[\leadsto 1 + \frac{\color{blue}{\left(\ell \cdot \ell\right)} \cdot {kx}^{2}}{{Om}^{2}} \cdot -0.5 \]
      4. unpow20.4%

        \[\leadsto 1 + \frac{\left(\ell \cdot \ell\right) \cdot \color{blue}{\left(kx \cdot kx\right)}}{{Om}^{2}} \cdot -0.5 \]
      5. unpow20.4%

        \[\leadsto 1 + \frac{\left(\ell \cdot \ell\right) \cdot \left(kx \cdot kx\right)}{\color{blue}{Om \cdot Om}} \cdot -0.5 \]
    10. Simplified0.4%

      \[\leadsto \color{blue}{1 + \frac{\left(\ell \cdot \ell\right) \cdot \left(kx \cdot kx\right)}{Om \cdot Om} \cdot -0.5} \]
    11. Taylor expanded in l around 0 0.4%

      \[\leadsto 1 + \frac{\color{blue}{{kx}^{2} \cdot {\ell}^{2}}}{Om \cdot Om} \cdot -0.5 \]
    12. Step-by-step derivation
      1. unpow20.4%

        \[\leadsto 1 + \frac{\color{blue}{\left(kx \cdot kx\right)} \cdot {\ell}^{2}}{Om \cdot Om} \cdot -0.5 \]
      2. *-commutative0.4%

        \[\leadsto 1 + \frac{\color{blue}{{\ell}^{2} \cdot \left(kx \cdot kx\right)}}{Om \cdot Om} \cdot -0.5 \]
      3. unpow20.4%

        \[\leadsto 1 + \frac{\color{blue}{\left(\ell \cdot \ell\right)} \cdot \left(kx \cdot kx\right)}{Om \cdot Om} \cdot -0.5 \]
      4. associate-*r*2.7%

        \[\leadsto 1 + \frac{\color{blue}{\ell \cdot \left(\ell \cdot \left(kx \cdot kx\right)\right)}}{Om \cdot Om} \cdot -0.5 \]
    13. Simplified2.7%

      \[\leadsto 1 + \frac{\color{blue}{\ell \cdot \left(\ell \cdot \left(kx \cdot kx\right)\right)}}{Om \cdot Om} \cdot -0.5 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification45.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 7.5 \cdot 10^{+185}:\\ \;\;\;\;1 + \left(\frac{\ell}{\frac{Om}{\ell}} \cdot \frac{kx}{\frac{Om}{kx}}\right) \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;1 + -0.5 \cdot \frac{\ell \cdot \left(\ell \cdot \left(kx \cdot kx\right)\right)}{Om \cdot Om}\\ \end{array} \]

Alternative 9: 33.3% accurate, 48.1× speedup?

\[\begin{array}{l} \\ 1 + \frac{ky \cdot ky}{\frac{Om \cdot Om}{\ell \cdot \ell}} \cdot -0.5 \end{array} \]
(FPCore (l Om kx ky)
 :precision binary64
 (+ 1.0 (* (/ (* ky ky) (/ (* Om Om) (* l l))) -0.5)))
double code(double l, double Om, double kx, double ky) {
	return 1.0 + (((ky * ky) / ((Om * Om) / (l * l))) * -0.5);
}
real(8) function code(l, om, kx, ky)
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: kx
    real(8), intent (in) :: ky
    code = 1.0d0 + (((ky * ky) / ((om * om) / (l * l))) * (-0.5d0))
end function
public static double code(double l, double Om, double kx, double ky) {
	return 1.0 + (((ky * ky) / ((Om * Om) / (l * l))) * -0.5);
}
def code(l, Om, kx, ky):
	return 1.0 + (((ky * ky) / ((Om * Om) / (l * l))) * -0.5)
function code(l, Om, kx, ky)
	return Float64(1.0 + Float64(Float64(Float64(ky * ky) / Float64(Float64(Om * Om) / Float64(l * l))) * -0.5))
end
function tmp = code(l, Om, kx, ky)
	tmp = 1.0 + (((ky * ky) / ((Om * Om) / (l * l))) * -0.5);
end
code[l_, Om_, kx_, ky_] := N[(1.0 + N[(N[(N[(ky * ky), $MachinePrecision] / N[(N[(Om * Om), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
1 + \frac{ky \cdot ky}{\frac{Om \cdot Om}{\ell \cdot \ell}} \cdot -0.5
\end{array}
Derivation
  1. Initial program 98.5%

    \[\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)} \]
  2. Simplified98.5%

    \[\leadsto \color{blue}{\sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + {\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}} \]
  3. Step-by-step derivation
    1. add-sqr-sqrt98.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)} \cdot \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}}} \]
    2. hypot-1-def98.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}\right)}}} \]
    3. sqrt-prod98.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\right)}} \]
    4. unpow298.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{\frac{2}{\frac{Om}{\ell}} \cdot \frac{2}{\frac{Om}{\ell}}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    5. sqrt-prod54.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\sqrt{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{\frac{2}{\frac{Om}{\ell}}}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    6. add-sqr-sqrt98.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    7. associate-/r/98.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\frac{2}{Om} \cdot \ell\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    8. *-commutative98.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\ell \cdot \frac{2}{Om}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    9. unpow298.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\color{blue}{\sin kx \cdot \sin kx} + {\sin ky}^{2}}\right)}} \]
    10. unpow298.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\sin kx \cdot \sin kx + \color{blue}{\sin ky \cdot \sin ky}}\right)}} \]
    11. hypot-def100.0%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \color{blue}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\right)}} \]
  4. Applied egg-rr100.0%

    \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \mathsf{hypot}\left(\sin kx, \sin ky\right)\right)}}} \]
  5. Taylor expanded in kx around 0 94.0%

    \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \color{blue}{\sin ky}\right)}} \]
  6. Taylor expanded in ky around 0 36.5%

    \[\leadsto \color{blue}{1 + -0.5 \cdot \frac{{ky}^{2} \cdot {\ell}^{2}}{{Om}^{2}}} \]
  7. Step-by-step derivation
    1. associate-/l*36.6%

      \[\leadsto 1 + -0.5 \cdot \color{blue}{\frac{{ky}^{2}}{\frac{{Om}^{2}}{{\ell}^{2}}}} \]
    2. unpow236.6%

      \[\leadsto 1 + -0.5 \cdot \frac{\color{blue}{ky \cdot ky}}{\frac{{Om}^{2}}{{\ell}^{2}}} \]
    3. unpow236.6%

      \[\leadsto 1 + -0.5 \cdot \frac{ky \cdot ky}{\frac{\color{blue}{Om \cdot Om}}{{\ell}^{2}}} \]
    4. unpow236.6%

      \[\leadsto 1 + -0.5 \cdot \frac{ky \cdot ky}{\frac{Om \cdot Om}{\color{blue}{\ell \cdot \ell}}} \]
  8. Simplified36.6%

    \[\leadsto \color{blue}{1 + -0.5 \cdot \frac{ky \cdot ky}{\frac{Om \cdot Om}{\ell \cdot \ell}}} \]
  9. Final simplification36.6%

    \[\leadsto 1 + \frac{ky \cdot ky}{\frac{Om \cdot Om}{\ell \cdot \ell}} \cdot -0.5 \]

Alternative 10: 39.2% accurate, 48.1× speedup?

\[\begin{array}{l} \\ 1 + -0.5 \cdot \left(\left(kx \cdot kx\right) \cdot \left(\frac{\ell}{Om} \cdot \frac{\ell}{Om}\right)\right) \end{array} \]
(FPCore (l Om kx ky)
 :precision binary64
 (+ 1.0 (* -0.5 (* (* kx kx) (* (/ l Om) (/ l Om))))))
double code(double l, double Om, double kx, double ky) {
	return 1.0 + (-0.5 * ((kx * kx) * ((l / Om) * (l / Om))));
}
real(8) function code(l, om, kx, ky)
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: kx
    real(8), intent (in) :: ky
    code = 1.0d0 + ((-0.5d0) * ((kx * kx) * ((l / om) * (l / om))))
end function
public static double code(double l, double Om, double kx, double ky) {
	return 1.0 + (-0.5 * ((kx * kx) * ((l / Om) * (l / Om))));
}
def code(l, Om, kx, ky):
	return 1.0 + (-0.5 * ((kx * kx) * ((l / Om) * (l / Om))))
function code(l, Om, kx, ky)
	return Float64(1.0 + Float64(-0.5 * Float64(Float64(kx * kx) * Float64(Float64(l / Om) * Float64(l / Om)))))
end
function tmp = code(l, Om, kx, ky)
	tmp = 1.0 + (-0.5 * ((kx * kx) * ((l / Om) * (l / Om))));
end
code[l_, Om_, kx_, ky_] := N[(1.0 + N[(-0.5 * N[(N[(kx * kx), $MachinePrecision] * N[(N[(l / Om), $MachinePrecision] * N[(l / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
1 + -0.5 \cdot \left(\left(kx \cdot kx\right) \cdot \left(\frac{\ell}{Om} \cdot \frac{\ell}{Om}\right)\right)
\end{array}
Derivation
  1. Initial program 98.5%

    \[\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)} \]
  2. Simplified98.5%

    \[\leadsto \color{blue}{\sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + {\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}} \]
  3. Step-by-step derivation
    1. add-sqr-sqrt98.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)} \cdot \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}}} \]
    2. hypot-1-def98.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}\right)}}} \]
    3. sqrt-prod98.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\right)}} \]
    4. unpow298.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{\frac{2}{\frac{Om}{\ell}} \cdot \frac{2}{\frac{Om}{\ell}}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    5. sqrt-prod54.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\sqrt{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{\frac{2}{\frac{Om}{\ell}}}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    6. add-sqr-sqrt98.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    7. associate-/r/98.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\frac{2}{Om} \cdot \ell\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    8. *-commutative98.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\ell \cdot \frac{2}{Om}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    9. unpow298.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\color{blue}{\sin kx \cdot \sin kx} + {\sin ky}^{2}}\right)}} \]
    10. unpow298.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\sin kx \cdot \sin kx + \color{blue}{\sin ky \cdot \sin ky}}\right)}} \]
    11. hypot-def100.0%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \color{blue}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\right)}} \]
  4. Applied egg-rr100.0%

    \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \mathsf{hypot}\left(\sin kx, \sin ky\right)\right)}}} \]
  5. Taylor expanded in ky around 0 93.0%

    \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{2 \cdot \frac{\ell \cdot \sin kx}{Om}}\right)}} \]
  6. Step-by-step derivation
    1. associate-*r/93.0%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2 \cdot \left(\ell \cdot \sin kx\right)}{Om}}\right)}} \]
  7. Simplified93.0%

    \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2 \cdot \left(\ell \cdot \sin kx\right)}{Om}}\right)}} \]
  8. Taylor expanded in kx around 0 37.9%

    \[\leadsto \color{blue}{1 + -0.5 \cdot \frac{{kx}^{2} \cdot {\ell}^{2}}{{Om}^{2}}} \]
  9. Step-by-step derivation
    1. *-commutative37.9%

      \[\leadsto 1 + \color{blue}{\frac{{kx}^{2} \cdot {\ell}^{2}}{{Om}^{2}} \cdot -0.5} \]
    2. *-commutative37.9%

      \[\leadsto 1 + \frac{\color{blue}{{\ell}^{2} \cdot {kx}^{2}}}{{Om}^{2}} \cdot -0.5 \]
    3. unpow237.9%

      \[\leadsto 1 + \frac{\color{blue}{\left(\ell \cdot \ell\right)} \cdot {kx}^{2}}{{Om}^{2}} \cdot -0.5 \]
    4. unpow237.9%

      \[\leadsto 1 + \frac{\left(\ell \cdot \ell\right) \cdot \color{blue}{\left(kx \cdot kx\right)}}{{Om}^{2}} \cdot -0.5 \]
    5. unpow237.9%

      \[\leadsto 1 + \frac{\left(\ell \cdot \ell\right) \cdot \left(kx \cdot kx\right)}{\color{blue}{Om \cdot Om}} \cdot -0.5 \]
  10. Simplified37.9%

    \[\leadsto \color{blue}{1 + \frac{\left(\ell \cdot \ell\right) \cdot \left(kx \cdot kx\right)}{Om \cdot Om} \cdot -0.5} \]
  11. Step-by-step derivation
    1. *-un-lft-identity37.9%

      \[\leadsto 1 + \color{blue}{\left(1 \cdot \frac{\left(\ell \cdot \ell\right) \cdot \left(kx \cdot kx\right)}{Om \cdot Om}\right)} \cdot -0.5 \]
    2. associate-/l*36.7%

      \[\leadsto 1 + \left(1 \cdot \color{blue}{\frac{\ell \cdot \ell}{\frac{Om \cdot Om}{kx \cdot kx}}}\right) \cdot -0.5 \]
  12. Applied egg-rr36.7%

    \[\leadsto 1 + \color{blue}{\left(1 \cdot \frac{\ell \cdot \ell}{\frac{Om \cdot Om}{kx \cdot kx}}\right)} \cdot -0.5 \]
  13. Step-by-step derivation
    1. *-lft-identity36.7%

      \[\leadsto 1 + \color{blue}{\frac{\ell \cdot \ell}{\frac{Om \cdot Om}{kx \cdot kx}}} \cdot -0.5 \]
    2. unpow236.7%

      \[\leadsto 1 + \frac{\color{blue}{{\ell}^{2}}}{\frac{Om \cdot Om}{kx \cdot kx}} \cdot -0.5 \]
    3. unpow236.7%

      \[\leadsto 1 + \frac{{\ell}^{2}}{\frac{\color{blue}{{Om}^{2}}}{kx \cdot kx}} \cdot -0.5 \]
    4. associate-/r/37.7%

      \[\leadsto 1 + \color{blue}{\left(\frac{{\ell}^{2}}{{Om}^{2}} \cdot \left(kx \cdot kx\right)\right)} \cdot -0.5 \]
    5. unpow237.7%

      \[\leadsto 1 + \left(\frac{\color{blue}{\ell \cdot \ell}}{{Om}^{2}} \cdot \left(kx \cdot kx\right)\right) \cdot -0.5 \]
    6. unpow237.7%

      \[\leadsto 1 + \left(\frac{\ell \cdot \ell}{\color{blue}{Om \cdot Om}} \cdot \left(kx \cdot kx\right)\right) \cdot -0.5 \]
    7. times-frac43.6%

      \[\leadsto 1 + \left(\color{blue}{\left(\frac{\ell}{Om} \cdot \frac{\ell}{Om}\right)} \cdot \left(kx \cdot kx\right)\right) \cdot -0.5 \]
  14. Simplified43.6%

    \[\leadsto 1 + \color{blue}{\left(\left(\frac{\ell}{Om} \cdot \frac{\ell}{Om}\right) \cdot \left(kx \cdot kx\right)\right)} \cdot -0.5 \]
  15. Final simplification43.6%

    \[\leadsto 1 + -0.5 \cdot \left(\left(kx \cdot kx\right) \cdot \left(\frac{\ell}{Om} \cdot \frac{\ell}{Om}\right)\right) \]

Alternative 11: 41.8% accurate, 48.1× speedup?

\[\begin{array}{l} \\ 1 + \left(\frac{\ell}{\frac{Om}{\ell}} \cdot \frac{kx}{\frac{Om}{kx}}\right) \cdot -0.5 \end{array} \]
(FPCore (l Om kx ky)
 :precision binary64
 (+ 1.0 (* (* (/ l (/ Om l)) (/ kx (/ Om kx))) -0.5)))
double code(double l, double Om, double kx, double ky) {
	return 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5);
}
real(8) function code(l, om, kx, ky)
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: kx
    real(8), intent (in) :: ky
    code = 1.0d0 + (((l / (om / l)) * (kx / (om / kx))) * (-0.5d0))
end function
public static double code(double l, double Om, double kx, double ky) {
	return 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5);
}
def code(l, Om, kx, ky):
	return 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5)
function code(l, Om, kx, ky)
	return Float64(1.0 + Float64(Float64(Float64(l / Float64(Om / l)) * Float64(kx / Float64(Om / kx))) * -0.5))
end
function tmp = code(l, Om, kx, ky)
	tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5);
end
code[l_, Om_, kx_, ky_] := N[(1.0 + N[(N[(N[(l / N[(Om / l), $MachinePrecision]), $MachinePrecision] * N[(kx / N[(Om / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
1 + \left(\frac{\ell}{\frac{Om}{\ell}} \cdot \frac{kx}{\frac{Om}{kx}}\right) \cdot -0.5
\end{array}
Derivation
  1. Initial program 98.5%

    \[\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)} \]
  2. Simplified98.5%

    \[\leadsto \color{blue}{\sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + {\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}} \]
  3. Step-by-step derivation
    1. add-sqr-sqrt98.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)} \cdot \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}}} \]
    2. hypot-1-def98.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}\right)}}} \]
    3. sqrt-prod98.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{{\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\right)}} \]
    4. unpow298.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{\frac{2}{\frac{Om}{\ell}} \cdot \frac{2}{\frac{Om}{\ell}}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    5. sqrt-prod54.5%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\sqrt{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{\frac{2}{\frac{Om}{\ell}}}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    6. add-sqr-sqrt98.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2}{\frac{Om}{\ell}}} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    7. associate-/r/98.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\frac{2}{Om} \cdot \ell\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    8. *-commutative98.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\ell \cdot \frac{2}{Om}\right)} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}} \]
    9. unpow298.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\color{blue}{\sin kx \cdot \sin kx} + {\sin ky}^{2}}\right)}} \]
    10. unpow298.8%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \sqrt{\sin kx \cdot \sin kx + \color{blue}{\sin ky \cdot \sin ky}}\right)}} \]
    11. hypot-def100.0%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \color{blue}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\right)}} \]
  4. Applied egg-rr100.0%

    \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \mathsf{hypot}\left(\sin kx, \sin ky\right)\right)}}} \]
  5. Taylor expanded in ky around 0 93.0%

    \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{2 \cdot \frac{\ell \cdot \sin kx}{Om}}\right)}} \]
  6. Step-by-step derivation
    1. associate-*r/93.0%

      \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2 \cdot \left(\ell \cdot \sin kx\right)}{Om}}\right)}} \]
  7. Simplified93.0%

    \[\leadsto \sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{2 \cdot \left(\ell \cdot \sin kx\right)}{Om}}\right)}} \]
  8. Taylor expanded in kx around 0 37.9%

    \[\leadsto \color{blue}{1 + -0.5 \cdot \frac{{kx}^{2} \cdot {\ell}^{2}}{{Om}^{2}}} \]
  9. Step-by-step derivation
    1. *-commutative37.9%

      \[\leadsto 1 + \color{blue}{\frac{{kx}^{2} \cdot {\ell}^{2}}{{Om}^{2}} \cdot -0.5} \]
    2. *-commutative37.9%

      \[\leadsto 1 + \frac{\color{blue}{{\ell}^{2} \cdot {kx}^{2}}}{{Om}^{2}} \cdot -0.5 \]
    3. unpow237.9%

      \[\leadsto 1 + \frac{\color{blue}{\left(\ell \cdot \ell\right)} \cdot {kx}^{2}}{{Om}^{2}} \cdot -0.5 \]
    4. unpow237.9%

      \[\leadsto 1 + \frac{\left(\ell \cdot \ell\right) \cdot \color{blue}{\left(kx \cdot kx\right)}}{{Om}^{2}} \cdot -0.5 \]
    5. unpow237.9%

      \[\leadsto 1 + \frac{\left(\ell \cdot \ell\right) \cdot \left(kx \cdot kx\right)}{\color{blue}{Om \cdot Om}} \cdot -0.5 \]
  10. Simplified37.9%

    \[\leadsto \color{blue}{1 + \frac{\left(\ell \cdot \ell\right) \cdot \left(kx \cdot kx\right)}{Om \cdot Om} \cdot -0.5} \]
  11. Taylor expanded in l around 0 37.9%

    \[\leadsto 1 + \color{blue}{\frac{{kx}^{2} \cdot {\ell}^{2}}{{Om}^{2}}} \cdot -0.5 \]
  12. Step-by-step derivation
    1. unpow237.9%

      \[\leadsto 1 + \frac{\color{blue}{\left(kx \cdot kx\right)} \cdot {\ell}^{2}}{{Om}^{2}} \cdot -0.5 \]
    2. *-commutative37.9%

      \[\leadsto 1 + \frac{\color{blue}{{\ell}^{2} \cdot \left(kx \cdot kx\right)}}{{Om}^{2}} \cdot -0.5 \]
    3. unpow237.9%

      \[\leadsto 1 + \frac{{\ell}^{2} \cdot \left(kx \cdot kx\right)}{\color{blue}{Om \cdot Om}} \cdot -0.5 \]
    4. times-frac40.8%

      \[\leadsto 1 + \color{blue}{\left(\frac{{\ell}^{2}}{Om} \cdot \frac{kx \cdot kx}{Om}\right)} \cdot -0.5 \]
    5. unpow240.8%

      \[\leadsto 1 + \left(\frac{\color{blue}{\ell \cdot \ell}}{Om} \cdot \frac{kx \cdot kx}{Om}\right) \cdot -0.5 \]
    6. associate-/l*42.8%

      \[\leadsto 1 + \left(\color{blue}{\frac{\ell}{\frac{Om}{\ell}}} \cdot \frac{kx \cdot kx}{Om}\right) \cdot -0.5 \]
    7. associate-/l*45.5%

      \[\leadsto 1 + \left(\frac{\ell}{\frac{Om}{\ell}} \cdot \color{blue}{\frac{kx}{\frac{Om}{kx}}}\right) \cdot -0.5 \]
  13. Simplified45.5%

    \[\leadsto 1 + \color{blue}{\left(\frac{\ell}{\frac{Om}{\ell}} \cdot \frac{kx}{\frac{Om}{kx}}\right)} \cdot -0.5 \]
  14. Final simplification45.5%

    \[\leadsto 1 + \left(\frac{\ell}{\frac{Om}{\ell}} \cdot \frac{kx}{\frac{Om}{kx}}\right) \cdot -0.5 \]

Reproduce

?
herbie shell --seed 2023293 
(FPCore (l Om kx ky)
  :name "Toniolo and Linder, Equation (3a)"
  :precision binary64
  (sqrt (* (/ 1.0 2.0) (+ 1.0 (/ 1.0 (sqrt (+ 1.0 (* (pow (/ (* 2.0 l) Om) 2.0) (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))))))