Toniolo and Linder, Equation (3b), real

Percentage Accurate: 94.1% → 99.7%
Time: 4.5s
Alternatives: 16
Speedup: 1.2×

Specification

?
\[\begin{array}{l} \\ \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \end{array} \]
(FPCore (kx ky th)
 :precision binary64
 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
	return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(kx, ky, th)
use fmin_fmax_functions
    real(8), intent (in) :: kx
    real(8), intent (in) :: ky
    real(8), intent (in) :: th
    code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
	return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th):
	return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th)
	return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th))
end
function tmp = code(kx, ky, th)
	tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th);
end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}

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 16 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: 94.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \end{array} \]
(FPCore (kx ky th)
 :precision binary64
 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
	return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(kx, ky, th)
use fmin_fmax_functions
    real(8), intent (in) :: kx
    real(8), intent (in) :: ky
    real(8), intent (in) :: th
    code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
	return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th):
	return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th)
	return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th))
end
function tmp = code(kx, ky, th)
	tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th);
end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}

Alternative 1: 99.7% accurate, 1.2× speedup?

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

\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\end{array}
Derivation
  1. Initial program 94.1%

    \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
  2. Step-by-step derivation
    1. lift-sqrt.f64N/A

      \[\leadsto \frac{\sin ky}{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
    2. lift-+.f64N/A

      \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
    3. +-commutativeN/A

      \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
    4. lift-pow.f64N/A

      \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
    5. unpow2N/A

      \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
    6. lift-pow.f64N/A

      \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \sin ky + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
    7. unpow2N/A

      \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \sin ky + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
    8. lower-hypot.f6499.7

      \[\leadsto \frac{\sin ky}{\color{blue}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}} \cdot \sin th \]
  3. Applied rewrites99.7%

    \[\leadsto \frac{\sin ky}{\color{blue}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}} \cdot \sin th \]
  4. Add Preprocessing

Alternative 2: 99.6% accurate, 1.2× speedup?

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

\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}
\end{array}
Derivation
  1. Initial program 94.1%

    \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
  2. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th} \]
    2. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
    3. associate-*l/N/A

      \[\leadsto \color{blue}{\frac{\sin ky \cdot \sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
    4. associate-/l*N/A

      \[\leadsto \color{blue}{\sin ky \cdot \frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
    5. lower-*.f64N/A

      \[\leadsto \color{blue}{\sin ky \cdot \frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
    6. lower-/.f6494.1

      \[\leadsto \sin ky \cdot \color{blue}{\frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
    7. lift-sqrt.f64N/A

      \[\leadsto \sin ky \cdot \frac{\sin th}{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
    8. lift-+.f64N/A

      \[\leadsto \sin ky \cdot \frac{\sin th}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
    9. lift-pow.f64N/A

      \[\leadsto \sin ky \cdot \frac{\sin th}{\sqrt{\color{blue}{{\sin kx}^{2}} + {\sin ky}^{2}}} \]
    10. unpow2N/A

      \[\leadsto \sin ky \cdot \frac{\sin th}{\sqrt{\color{blue}{\sin kx \cdot \sin kx} + {\sin ky}^{2}}} \]
    11. lift-pow.f64N/A

      \[\leadsto \sin ky \cdot \frac{\sin th}{\sqrt{\sin kx \cdot \sin kx + \color{blue}{{\sin ky}^{2}}}} \]
    12. unpow2N/A

      \[\leadsto \sin ky \cdot \frac{\sin th}{\sqrt{\sin kx \cdot \sin kx + \color{blue}{\sin ky \cdot \sin ky}}} \]
    13. lower-hypot.f6499.6

      \[\leadsto \sin ky \cdot \frac{\sin th}{\color{blue}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}} \]
  3. Applied rewrites99.6%

    \[\leadsto \color{blue}{\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}} \]
  4. Add Preprocessing

Alternative 3: 69.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\ t_2 := \cos \left(kx + kx\right)\\ \mathbf{if}\;t\_1 \leq -0.99:\\ \;\;\;\;\frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - 0.5\right)}} \cdot \sin th\\ \mathbf{elif}\;t\_1 \leq -0.4:\\ \;\;\;\;\frac{th \cdot \sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - t\_2 \cdot 0.5\right)\right)}}\\ \mathbf{elif}\;t\_1 \leq 0.7:\\ \;\;\;\;\frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot t\_2}} \cdot \sin th\\ \mathbf{elif}\;t\_1 \leq 2:\\ \;\;\;\;\sin th\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin ky}{\sin kx} \cdot \sin th\\ \end{array} \end{array} \]
(FPCore (kx ky th)
 :precision binary64
 (let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
        (t_2 (cos (+ kx kx))))
   (if (<= t_1 -0.99)
     (* (/ (sin ky) (sqrt (fma (sin ky) (sin ky) (- 0.5 0.5)))) (sin th))
     (if (<= t_1 -0.4)
       (/
        (* th (sin ky))
        (sqrt (- 0.5 (- (* (cos (+ ky ky)) 0.5) (- 0.5 (* t_2 0.5))))))
       (if (<= t_1 0.7)
         (* (/ (sin ky) (sqrt (- 0.5 (* 0.5 t_2)))) (sin th))
         (if (<= t_1 2.0) (sin th) (* (/ (sin ky) (sin kx)) (sin th))))))))
double code(double kx, double ky, double th) {
	double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
	double t_2 = cos((kx + kx));
	double tmp;
	if (t_1 <= -0.99) {
		tmp = (sin(ky) / sqrt(fma(sin(ky), sin(ky), (0.5 - 0.5)))) * sin(th);
	} else if (t_1 <= -0.4) {
		tmp = (th * sin(ky)) / sqrt((0.5 - ((cos((ky + ky)) * 0.5) - (0.5 - (t_2 * 0.5)))));
	} else if (t_1 <= 0.7) {
		tmp = (sin(ky) / sqrt((0.5 - (0.5 * t_2)))) * sin(th);
	} else if (t_1 <= 2.0) {
		tmp = sin(th);
	} else {
		tmp = (sin(ky) / sin(kx)) * sin(th);
	}
	return tmp;
}
function code(kx, ky, th)
	t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))
	t_2 = cos(Float64(kx + kx))
	tmp = 0.0
	if (t_1 <= -0.99)
		tmp = Float64(Float64(sin(ky) / sqrt(fma(sin(ky), sin(ky), Float64(0.5 - 0.5)))) * sin(th));
	elseif (t_1 <= -0.4)
		tmp = Float64(Float64(th * sin(ky)) / sqrt(Float64(0.5 - Float64(Float64(cos(Float64(ky + ky)) * 0.5) - Float64(0.5 - Float64(t_2 * 0.5))))));
	elseif (t_1 <= 0.7)
		tmp = Float64(Float64(sin(ky) / sqrt(Float64(0.5 - Float64(0.5 * t_2)))) * sin(th));
	elseif (t_1 <= 2.0)
		tmp = sin(th);
	else
		tmp = Float64(Float64(sin(ky) / sin(kx)) * sin(th));
	end
	return tmp
end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -0.99], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Sin[ky], $MachinePrecision] * N[Sin[ky], $MachinePrecision] + N[(0.5 - 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.4], N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(0.5 - N[(N[(N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision] - N[(0.5 - N[(t$95$2 * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.7], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(0.5 - N[(0.5 * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[Sin[th], $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_2 := \cos \left(kx + kx\right)\\
\mathbf{if}\;t\_1 \leq -0.99:\\
\;\;\;\;\frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - 0.5\right)}} \cdot \sin th\\

\mathbf{elif}\;t\_1 \leq -0.4:\\
\;\;\;\;\frac{th \cdot \sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - t\_2 \cdot 0.5\right)\right)}}\\

\mathbf{elif}\;t\_1 \leq 0.7:\\
\;\;\;\;\frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot t\_2}} \cdot \sin th\\

\mathbf{elif}\;t\_1 \leq 2:\\
\;\;\;\;\sin th\\

\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\sin kx} \cdot \sin th\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.98999999999999999

    1. Initial program 86.2%

      \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
      2. +-commutativeN/A

        \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
      3. lower-+.f6486.2

        \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
      4. lift-pow.f64N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
      5. unpow2N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
      6. lift-sin.f64N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
      7. lift-sin.f64N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
      8. sqr-sin-aN/A

        \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
      9. lower--.f64N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
      10. lower-*.f64N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
      11. lower-cos.f64N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
      12. lower-*.f6465.3

        \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
      13. lift-pow.f64N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
      14. unpow2N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
      15. lift-sin.f64N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
      16. lift-sin.f64N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
      17. sqr-sin-aN/A

        \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
      18. lower--.f64N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
      19. lower-*.f64N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
      20. lower-cos.f64N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
      21. lower-*.f6464.9

        \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
    3. Applied rewrites64.9%

      \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
    4. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
      2. lift--.f64N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
      4. lift-cos.f64N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
      6. sqr-sin-a-revN/A

        \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
      7. lift-sin.f64N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
      8. lift-sin.f64N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
      9. lift-fma.f6486.0

        \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
      10. lift-*.f64N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
      11. *-commutativeN/A

        \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)}} \cdot \sin th \]
      12. lower-*.f6486.0

        \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)}} \cdot \sin th \]
      13. lift-*.f64N/A

        \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
      14. count-2-revN/A

        \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
      15. lower-+.f6486.0

        \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)}} \cdot \sin th \]
    5. Applied rewrites86.0%

      \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)}}} \cdot \sin th \]
    6. Taylor expanded in kx around 0

      \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\frac{1}{2}}\right)}} \cdot \sin th \]
    7. Step-by-step derivation
      1. Applied rewrites83.8%

        \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \color{blue}{0.5}\right)}} \cdot \sin th \]

      if -0.98999999999999999 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.40000000000000002

      1. Initial program 99.3%

        \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
      2. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th} \]
        2. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
        3. associate-*l/N/A

          \[\leadsto \color{blue}{\frac{\sin ky \cdot \sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
        4. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{\sin ky \cdot \sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
        5. *-commutativeN/A

          \[\leadsto \frac{\color{blue}{\sin th \cdot \sin ky}}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \]
        6. lower-*.f6499.3

          \[\leadsto \frac{\color{blue}{\sin th \cdot \sin ky}}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \]
        7. lift-sqrt.f64N/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
        8. lift-+.f64N/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
        9. lift-pow.f64N/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{{\sin kx}^{2}} + {\sin ky}^{2}}} \]
        10. unpow2N/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\sin kx \cdot \sin kx} + {\sin ky}^{2}}} \]
        11. lift-pow.f64N/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\sin kx \cdot \sin kx + \color{blue}{{\sin ky}^{2}}}} \]
        12. unpow2N/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\sin kx \cdot \sin kx + \color{blue}{\sin ky \cdot \sin ky}}} \]
        13. lower-hypot.f6499.3

          \[\leadsto \frac{\sin th \cdot \sin ky}{\color{blue}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}} \]
      3. Applied rewrites99.3%

        \[\leadsto \color{blue}{\frac{\sin th \cdot \sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}} \]
      4. Step-by-step derivation
        1. lift-hypot.f64N/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\color{blue}{\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}}} \]
        2. lift-sin.f64N/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\sin kx} \cdot \sin kx + \sin ky \cdot \sin ky}} \]
        3. lift-sin.f64N/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\sin kx \cdot \color{blue}{\sin kx} + \sin ky \cdot \sin ky}} \]
        4. sqr-sin-a-revN/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)} + \sin ky \cdot \sin ky}} \]
        5. lift-*.f64N/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right) + \sin ky \cdot \sin ky}} \]
        6. lift-cos.f64N/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right) + \sin ky \cdot \sin ky}} \]
        7. lift-*.f64N/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right) + \sin ky \cdot \sin ky}} \]
        8. lift--.f64N/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)} + \sin ky \cdot \sin ky}} \]
        9. lift-sin.f64N/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \color{blue}{\sin ky} \cdot \sin ky}} \]
        10. lift-sin.f64N/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \sin ky \cdot \color{blue}{\sin ky}}} \]
        11. sqr-sin-a-revN/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}}} \]
        12. lift-*.f64N/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right)}} \]
        13. lift-cos.f64N/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right)}} \]
        14. lift-*.f64N/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right)}} \]
        15. lift--.f64N/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}}} \]
        16. +-commutativeN/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \]
        17. lift--.f64N/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \]
        18. associate-+l-N/A

          \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \]
      5. Applied rewrites98.9%

        \[\leadsto \frac{\sin th \cdot \sin ky}{\color{blue}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \]
      6. Taylor expanded in th around 0

        \[\leadsto \frac{\color{blue}{th} \cdot \sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \left(kx + kx\right) \cdot \frac{1}{2}\right)\right)}} \]
      7. Step-by-step derivation
        1. Applied rewrites51.0%

          \[\leadsto \frac{\color{blue}{th} \cdot \sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}} \]

        if -0.40000000000000002 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.69999999999999996

        1. Initial program 99.2%

          \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
        2. Step-by-step derivation
          1. lift-+.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
          2. +-commutativeN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
          3. lower-+.f6499.2

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
          4. lift-pow.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
          5. unpow2N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
          6. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
          7. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
          8. sqr-sin-aN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
          9. lower--.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
          10. lower-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
          11. lower-cos.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
          12. lower-*.f6499.0

            \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
          13. lift-pow.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
          14. unpow2N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
          15. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
          16. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
          17. sqr-sin-aN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          18. lower--.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          19. lower-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          20. lower-cos.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          21. lower-*.f6478.4

            \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
        3. Applied rewrites78.4%

          \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
        4. Step-by-step derivation
          1. lift-+.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          2. lift--.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
          3. associate-+l-N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
          4. lower--.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
          5. lower--.f6478.4

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{\left(0.5 \cdot \cos \left(2 \cdot ky\right) - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
          6. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
          7. *-commutativeN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot \frac{1}{2}} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
          8. lower-*.f6478.4

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot 0.5} - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
          9. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(2 \cdot ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
          10. count-2-revN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
          11. lower-+.f6478.4

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot 0.5 - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
          12. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
          13. *-commutativeN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
          14. lower-*.f6478.4

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)\right)}} \cdot \sin th \]
          15. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
          16. count-2-revN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
          17. lower-+.f6478.4

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)\right)}} \cdot \sin th \]
        5. Applied rewrites78.4%

          \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \cdot \sin th \]
        6. Step-by-step derivation
          1. lift--.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\left(\frac{1}{2} - \cos \left(kx + kx\right) \cdot \frac{1}{2}\right)}\right)}} \cdot \sin th \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(kx + kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
          3. *-commutativeN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
          4. lift-cos.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
          5. lift-+.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
          6. count-2-revN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
          7. sqr-sin-a-revN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx \cdot \sin kx}\right)}} \cdot \sin th \]
          8. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx} \cdot \sin kx\right)}} \cdot \sin th \]
          9. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \sin kx \cdot \color{blue}{\sin kx}\right)}} \cdot \sin th \]
          10. pow2N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{{\sin kx}^{2}}\right)}} \cdot \sin th \]
          11. pow-to-expN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          12. lower-exp.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          13. lower-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - e^{\color{blue}{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          14. lower-log.f6439.5

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - e^{\color{blue}{\log \sin kx} \cdot 2}\right)}} \cdot \sin th \]
        7. Applied rewrites39.5%

          \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
        8. Taylor expanded in ky around 0

          \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
        9. Step-by-step derivation
          1. pow2N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
          2. sqr-sin-a-revN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}} \cdot \sin th \]
          3. lift-cos.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \cdot \sin th \]
          4. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \cdot \sin th \]
          5. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}}} \cdot \sin th \]
          6. lift--.f6463.8

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{0.5 \cdot \cos \left(2 \cdot kx\right)}}} \cdot \sin th \]
          7. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \cdot \sin th \]
          8. count-2-revN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(kx + kx\right)}} \cdot \sin th \]
          9. lift-+.f6463.8

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}} \cdot \sin th \]
        10. Applied rewrites63.8%

          \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}}} \cdot \sin th \]

        if 0.69999999999999996 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2

        1. Initial program 99.6%

          \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
        2. Step-by-step derivation
          1. lift-+.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
          2. +-commutativeN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
          3. lower-+.f6499.6

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
          4. lift-pow.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
          5. unpow2N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
          6. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
          7. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
          8. sqr-sin-aN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
          9. lower--.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
          10. lower-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
          11. lower-cos.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
          12. lower-*.f6480.0

            \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
          13. lift-pow.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
          14. unpow2N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
          15. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
          16. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
          17. sqr-sin-aN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          18. lower--.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          19. lower-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          20. lower-cos.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          21. lower-*.f6479.5

            \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
        3. Applied rewrites79.5%

          \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
        4. Step-by-step derivation
          1. lift-+.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          2. lift--.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
          3. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
          4. lift-cos.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
          5. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
          6. sqr-sin-a-revN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
          7. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
          8. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
          9. lift-fma.f6499.2

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          10. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          11. *-commutativeN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)}} \cdot \sin th \]
          12. lower-*.f6499.2

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)}} \cdot \sin th \]
          13. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
          14. count-2-revN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
          15. lower-+.f6499.2

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)}} \cdot \sin th \]
        5. Applied rewrites99.2%

          \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)}}} \cdot \sin th \]
        6. Taylor expanded in kx around 0

          \[\leadsto \color{blue}{\sin th} \]
        7. Step-by-step derivation
          1. lift-sin.f6478.7

            \[\leadsto \sin th \]
        8. Applied rewrites78.7%

          \[\leadsto \color{blue}{\sin th} \]

        if 2 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64)))))

        1. Initial program 2.6%

          \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
        2. Step-by-step derivation
          1. lift-+.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
          2. +-commutativeN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
          3. lower-+.f642.6

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
          4. lift-pow.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
          5. unpow2N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
          6. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
          7. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
          8. sqr-sin-aN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
          9. lower--.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
          10. lower-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
          11. lower-cos.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
          12. lower-*.f642.6

            \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
          13. lift-pow.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
          14. unpow2N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
          15. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
          16. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
          17. sqr-sin-aN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          18. lower--.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          19. lower-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          20. lower-cos.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          21. lower-*.f642.6

            \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
        3. Applied rewrites2.6%

          \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
        4. Step-by-step derivation
          1. lift-+.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          2. lift--.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
          3. associate-+l-N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
          4. lower--.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
          5. lower--.f642.6

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{\left(0.5 \cdot \cos \left(2 \cdot ky\right) - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
          6. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
          7. *-commutativeN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot \frac{1}{2}} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
          8. lower-*.f642.6

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot 0.5} - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
          9. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(2 \cdot ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
          10. count-2-revN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
          11. lower-+.f642.6

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot 0.5 - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
          12. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
          13. *-commutativeN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
          14. lower-*.f642.6

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)\right)}} \cdot \sin th \]
          15. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
          16. count-2-revN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
          17. lower-+.f642.6

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)\right)}} \cdot \sin th \]
        5. Applied rewrites2.6%

          \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \cdot \sin th \]
        6. Step-by-step derivation
          1. lift--.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\left(\frac{1}{2} - \cos \left(kx + kx\right) \cdot \frac{1}{2}\right)}\right)}} \cdot \sin th \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(kx + kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
          3. *-commutativeN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
          4. lift-cos.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
          5. lift-+.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
          6. count-2-revN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
          7. sqr-sin-a-revN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx \cdot \sin kx}\right)}} \cdot \sin th \]
          8. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx} \cdot \sin kx\right)}} \cdot \sin th \]
          9. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \sin kx \cdot \color{blue}{\sin kx}\right)}} \cdot \sin th \]
          10. pow2N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{{\sin kx}^{2}}\right)}} \cdot \sin th \]
          11. pow-to-expN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          12. lower-exp.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          13. lower-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - e^{\color{blue}{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          14. lower-log.f641.5

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - e^{\color{blue}{\log \sin kx} \cdot 2}\right)}} \cdot \sin th \]
        7. Applied rewrites1.5%

          \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
        8. Taylor expanded in ky around 0

          \[\leadsto \frac{\sin ky}{\color{blue}{\sin kx}} \cdot \sin th \]
        9. Step-by-step derivation
          1. lift-sin.f6429.8

            \[\leadsto \frac{\sin ky}{\sin kx} \cdot \sin th \]
        10. Applied rewrites29.8%

          \[\leadsto \frac{\sin ky}{\color{blue}{\sin kx}} \cdot \sin th \]
      8. Recombined 5 regimes into one program.
      9. Add Preprocessing

      Alternative 4: 65.0% accurate, 0.3× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\ t_2 := \cos \left(kx + kx\right)\\ t_3 := \cos \left(ky + ky\right)\\ \mathbf{if}\;t\_1 \leq -0.99:\\ \;\;\;\;\frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, 0.5 - 0.5 \cdot t\_3\right)}} \cdot \sin th\\ \mathbf{elif}\;t\_1 \leq -0.4:\\ \;\;\;\;\frac{th \cdot \sin ky}{\sqrt{0.5 - \left(t\_3 \cdot 0.5 - \left(0.5 - t\_2 \cdot 0.5\right)\right)}}\\ \mathbf{elif}\;t\_1 \leq 0.7:\\ \;\;\;\;\frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot t\_2}} \cdot \sin th\\ \mathbf{elif}\;t\_1 \leq 2:\\ \;\;\;\;\sin th\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin ky}{\sin kx} \cdot \sin th\\ \end{array} \end{array} \]
      (FPCore (kx ky th)
       :precision binary64
       (let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
              (t_2 (cos (+ kx kx)))
              (t_3 (cos (+ ky ky))))
         (if (<= t_1 -0.99)
           (* (/ (sin ky) (sqrt (fma kx kx (- 0.5 (* 0.5 t_3))))) (sin th))
           (if (<= t_1 -0.4)
             (/ (* th (sin ky)) (sqrt (- 0.5 (- (* t_3 0.5) (- 0.5 (* t_2 0.5))))))
             (if (<= t_1 0.7)
               (* (/ (sin ky) (sqrt (- 0.5 (* 0.5 t_2)))) (sin th))
               (if (<= t_1 2.0) (sin th) (* (/ (sin ky) (sin kx)) (sin th))))))))
      double code(double kx, double ky, double th) {
      	double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
      	double t_2 = cos((kx + kx));
      	double t_3 = cos((ky + ky));
      	double tmp;
      	if (t_1 <= -0.99) {
      		tmp = (sin(ky) / sqrt(fma(kx, kx, (0.5 - (0.5 * t_3))))) * sin(th);
      	} else if (t_1 <= -0.4) {
      		tmp = (th * sin(ky)) / sqrt((0.5 - ((t_3 * 0.5) - (0.5 - (t_2 * 0.5)))));
      	} else if (t_1 <= 0.7) {
      		tmp = (sin(ky) / sqrt((0.5 - (0.5 * t_2)))) * sin(th);
      	} else if (t_1 <= 2.0) {
      		tmp = sin(th);
      	} else {
      		tmp = (sin(ky) / sin(kx)) * sin(th);
      	}
      	return tmp;
      }
      
      function code(kx, ky, th)
      	t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))
      	t_2 = cos(Float64(kx + kx))
      	t_3 = cos(Float64(ky + ky))
      	tmp = 0.0
      	if (t_1 <= -0.99)
      		tmp = Float64(Float64(sin(ky) / sqrt(fma(kx, kx, Float64(0.5 - Float64(0.5 * t_3))))) * sin(th));
      	elseif (t_1 <= -0.4)
      		tmp = Float64(Float64(th * sin(ky)) / sqrt(Float64(0.5 - Float64(Float64(t_3 * 0.5) - Float64(0.5 - Float64(t_2 * 0.5))))));
      	elseif (t_1 <= 0.7)
      		tmp = Float64(Float64(sin(ky) / sqrt(Float64(0.5 - Float64(0.5 * t_2)))) * sin(th));
      	elseif (t_1 <= 2.0)
      		tmp = sin(th);
      	else
      		tmp = Float64(Float64(sin(ky) / sin(kx)) * sin(th));
      	end
      	return tmp
      end
      
      code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -0.99], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(kx * kx + N[(0.5 - N[(0.5 * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.4], N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(0.5 - N[(N[(t$95$3 * 0.5), $MachinePrecision] - N[(0.5 - N[(t$95$2 * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.7], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(0.5 - N[(0.5 * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[Sin[th], $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
      t_2 := \cos \left(kx + kx\right)\\
      t_3 := \cos \left(ky + ky\right)\\
      \mathbf{if}\;t\_1 \leq -0.99:\\
      \;\;\;\;\frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, 0.5 - 0.5 \cdot t\_3\right)}} \cdot \sin th\\
      
      \mathbf{elif}\;t\_1 \leq -0.4:\\
      \;\;\;\;\frac{th \cdot \sin ky}{\sqrt{0.5 - \left(t\_3 \cdot 0.5 - \left(0.5 - t\_2 \cdot 0.5\right)\right)}}\\
      
      \mathbf{elif}\;t\_1 \leq 0.7:\\
      \;\;\;\;\frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot t\_2}} \cdot \sin th\\
      
      \mathbf{elif}\;t\_1 \leq 2:\\
      \;\;\;\;\sin th\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\sin ky}{\sin kx} \cdot \sin th\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 5 regimes
      2. if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.98999999999999999

        1. Initial program 86.2%

          \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
        2. Step-by-step derivation
          1. lift-+.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
          2. +-commutativeN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
          3. lower-+.f6486.2

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
          4. lift-pow.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
          5. unpow2N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
          6. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
          7. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
          8. sqr-sin-aN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
          9. lower--.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
          10. lower-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
          11. lower-cos.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
          12. lower-*.f6465.3

            \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
          13. lift-pow.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
          14. unpow2N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
          15. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
          16. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
          17. sqr-sin-aN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          18. lower--.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          19. lower-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          20. lower-cos.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          21. lower-*.f6464.9

            \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
        3. Applied rewrites64.9%

          \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
        4. Step-by-step derivation
          1. lift-+.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          2. lift--.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
          3. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
          4. lift-cos.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
          5. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
          6. sqr-sin-a-revN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
          7. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
          8. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
          9. lift-fma.f6486.0

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          10. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          11. *-commutativeN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)}} \cdot \sin th \]
          12. lower-*.f6486.0

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)}} \cdot \sin th \]
          13. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
          14. count-2-revN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
          15. lower-+.f6486.0

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)}} \cdot \sin th \]
        5. Applied rewrites86.0%

          \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)}}} \cdot \sin th \]
        6. Taylor expanded in kx around 0

          \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
        7. Step-by-step derivation
          1. unpow2N/A

            \[\leadsto \frac{\sin ky}{\sqrt{kx \cdot kx + {\color{blue}{\sin ky}}^{2}}} \cdot \sin th \]
          2. pow2N/A

            \[\leadsto \frac{\sin ky}{\sqrt{kx \cdot kx + \sin ky \cdot \color{blue}{\sin ky}}} \cdot \sin th \]
          3. sqr-sin-a-revN/A

            \[\leadsto \frac{\sin ky}{\sqrt{kx \cdot kx + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right)}} \cdot \sin th \]
          4. lower-fma.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, \color{blue}{kx}, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}} \cdot \sin th \]
          5. lift-cos.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}} \cdot \sin th \]
          6. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}} \cdot \sin th \]
          7. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}} \cdot \sin th \]
          8. lift--.f6462.7

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, 0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right)}} \cdot \sin th \]
          9. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}} \cdot \sin th \]
          10. count-2-revN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(ky + ky\right)\right)}} \cdot \sin th \]
          11. lift-+.f6462.7

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, 0.5 - 0.5 \cdot \cos \left(ky + ky\right)\right)}} \cdot \sin th \]
        8. Applied rewrites62.7%

          \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(kx, kx, 0.5 - 0.5 \cdot \cos \left(ky + ky\right)\right)}}} \cdot \sin th \]

        if -0.98999999999999999 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.40000000000000002

        1. Initial program 99.3%

          \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
        2. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th} \]
          2. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
          3. associate-*l/N/A

            \[\leadsto \color{blue}{\frac{\sin ky \cdot \sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
          4. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\sin ky \cdot \sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
          5. *-commutativeN/A

            \[\leadsto \frac{\color{blue}{\sin th \cdot \sin ky}}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \]
          6. lower-*.f6499.3

            \[\leadsto \frac{\color{blue}{\sin th \cdot \sin ky}}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \]
          7. lift-sqrt.f64N/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
          8. lift-+.f64N/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
          9. lift-pow.f64N/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{{\sin kx}^{2}} + {\sin ky}^{2}}} \]
          10. unpow2N/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\sin kx \cdot \sin kx} + {\sin ky}^{2}}} \]
          11. lift-pow.f64N/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\sin kx \cdot \sin kx + \color{blue}{{\sin ky}^{2}}}} \]
          12. unpow2N/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\sin kx \cdot \sin kx + \color{blue}{\sin ky \cdot \sin ky}}} \]
          13. lower-hypot.f6499.3

            \[\leadsto \frac{\sin th \cdot \sin ky}{\color{blue}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}} \]
        3. Applied rewrites99.3%

          \[\leadsto \color{blue}{\frac{\sin th \cdot \sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}} \]
        4. Step-by-step derivation
          1. lift-hypot.f64N/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\color{blue}{\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}}} \]
          2. lift-sin.f64N/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\sin kx} \cdot \sin kx + \sin ky \cdot \sin ky}} \]
          3. lift-sin.f64N/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\sin kx \cdot \color{blue}{\sin kx} + \sin ky \cdot \sin ky}} \]
          4. sqr-sin-a-revN/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)} + \sin ky \cdot \sin ky}} \]
          5. lift-*.f64N/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right) + \sin ky \cdot \sin ky}} \]
          6. lift-cos.f64N/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right) + \sin ky \cdot \sin ky}} \]
          7. lift-*.f64N/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right) + \sin ky \cdot \sin ky}} \]
          8. lift--.f64N/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)} + \sin ky \cdot \sin ky}} \]
          9. lift-sin.f64N/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \color{blue}{\sin ky} \cdot \sin ky}} \]
          10. lift-sin.f64N/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \sin ky \cdot \color{blue}{\sin ky}}} \]
          11. sqr-sin-a-revN/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}}} \]
          12. lift-*.f64N/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right)}} \]
          13. lift-cos.f64N/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right)}} \]
          14. lift-*.f64N/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right)}} \]
          15. lift--.f64N/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}}} \]
          16. +-commutativeN/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \]
          17. lift--.f64N/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \]
          18. associate-+l-N/A

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \]
        5. Applied rewrites98.9%

          \[\leadsto \frac{\sin th \cdot \sin ky}{\color{blue}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \]
        6. Taylor expanded in th around 0

          \[\leadsto \frac{\color{blue}{th} \cdot \sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \left(kx + kx\right) \cdot \frac{1}{2}\right)\right)}} \]
        7. Step-by-step derivation
          1. Applied rewrites51.0%

            \[\leadsto \frac{\color{blue}{th} \cdot \sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}} \]

          if -0.40000000000000002 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.69999999999999996

          1. Initial program 99.2%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6499.0

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6478.4

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites78.4%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. associate-+l-N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            4. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            5. lower--.f6478.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{\left(0.5 \cdot \cos \left(2 \cdot ky\right) - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            6. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            7. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot \frac{1}{2}} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            8. lower-*.f6478.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot 0.5} - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            9. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(2 \cdot ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            10. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            11. lower-+.f6478.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot 0.5 - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            12. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            13. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            14. lower-*.f6478.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)\right)}} \cdot \sin th \]
            15. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            16. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            17. lower-+.f6478.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)\right)}} \cdot \sin th \]
          5. Applied rewrites78.4%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \cdot \sin th \]
          6. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\left(\frac{1}{2} - \cos \left(kx + kx\right) \cdot \frac{1}{2}\right)}\right)}} \cdot \sin th \]
            2. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(kx + kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            3. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            5. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            6. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            7. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx \cdot \sin kx}\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx} \cdot \sin kx\right)}} \cdot \sin th \]
            9. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \sin kx \cdot \color{blue}{\sin kx}\right)}} \cdot \sin th \]
            10. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{{\sin kx}^{2}}\right)}} \cdot \sin th \]
            11. pow-to-expN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            12. lower-exp.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            13. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - e^{\color{blue}{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            14. lower-log.f6439.5

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - e^{\color{blue}{\log \sin kx} \cdot 2}\right)}} \cdot \sin th \]
          7. Applied rewrites39.5%

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          8. Taylor expanded in ky around 0

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
          9. Step-by-step derivation
            1. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            2. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}} \cdot \sin th \]
            3. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \cdot \sin th \]
            4. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \cdot \sin th \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}}} \cdot \sin th \]
            6. lift--.f6463.8

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{0.5 \cdot \cos \left(2 \cdot kx\right)}}} \cdot \sin th \]
            7. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \cdot \sin th \]
            8. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(kx + kx\right)}} \cdot \sin th \]
            9. lift-+.f6463.8

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}} \cdot \sin th \]
          10. Applied rewrites63.8%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}}} \cdot \sin th \]

          if 0.69999999999999996 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2

          1. Initial program 99.6%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6499.6

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6480.0

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6479.5

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites79.5%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            6. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            9. lift-fma.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            10. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            11. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)}} \cdot \sin th \]
            12. lower-*.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)}} \cdot \sin th \]
            13. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            14. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            15. lower-+.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)}} \cdot \sin th \]
          5. Applied rewrites99.2%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)}}} \cdot \sin th \]
          6. Taylor expanded in kx around 0

            \[\leadsto \color{blue}{\sin th} \]
          7. Step-by-step derivation
            1. lift-sin.f6478.7

              \[\leadsto \sin th \]
          8. Applied rewrites78.7%

            \[\leadsto \color{blue}{\sin th} \]

          if 2 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64)))))

          1. Initial program 2.6%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites2.6%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. associate-+l-N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            4. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            5. lower--.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{\left(0.5 \cdot \cos \left(2 \cdot ky\right) - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            6. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            7. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot \frac{1}{2}} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            8. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot 0.5} - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            9. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(2 \cdot ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            10. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            11. lower-+.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot 0.5 - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            12. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            13. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            14. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)\right)}} \cdot \sin th \]
            15. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            16. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            17. lower-+.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)\right)}} \cdot \sin th \]
          5. Applied rewrites2.6%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \cdot \sin th \]
          6. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\left(\frac{1}{2} - \cos \left(kx + kx\right) \cdot \frac{1}{2}\right)}\right)}} \cdot \sin th \]
            2. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(kx + kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            3. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            5. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            6. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            7. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx \cdot \sin kx}\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx} \cdot \sin kx\right)}} \cdot \sin th \]
            9. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \sin kx \cdot \color{blue}{\sin kx}\right)}} \cdot \sin th \]
            10. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{{\sin kx}^{2}}\right)}} \cdot \sin th \]
            11. pow-to-expN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            12. lower-exp.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            13. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - e^{\color{blue}{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            14. lower-log.f641.5

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - e^{\color{blue}{\log \sin kx} \cdot 2}\right)}} \cdot \sin th \]
          7. Applied rewrites1.5%

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          8. Taylor expanded in ky around 0

            \[\leadsto \frac{\sin ky}{\color{blue}{\sin kx}} \cdot \sin th \]
          9. Step-by-step derivation
            1. lift-sin.f6429.8

              \[\leadsto \frac{\sin ky}{\sin kx} \cdot \sin th \]
          10. Applied rewrites29.8%

            \[\leadsto \frac{\sin ky}{\color{blue}{\sin kx}} \cdot \sin th \]
        8. Recombined 5 regimes into one program.
        9. Add Preprocessing

        Alternative 5: 65.0% accurate, 0.3× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\ t_2 := \cos \left(kx + kx\right)\\ t_3 := \cos \left(ky + ky\right)\\ \mathbf{if}\;t\_1 \leq -0.99:\\ \;\;\;\;\frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, 0.5 - 0.5 \cdot t\_3\right)}} \cdot \sin th\\ \mathbf{elif}\;t\_1 \leq -0.4:\\ \;\;\;\;\left(th \cdot \sin ky\right) \cdot \frac{1}{\sqrt{1 - 0.5 \cdot \left(t\_3 + t\_2\right)}}\\ \mathbf{elif}\;t\_1 \leq 0.7:\\ \;\;\;\;\frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot t\_2}} \cdot \sin th\\ \mathbf{elif}\;t\_1 \leq 2:\\ \;\;\;\;\sin th\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin ky}{\sin kx} \cdot \sin th\\ \end{array} \end{array} \]
        (FPCore (kx ky th)
         :precision binary64
         (let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
                (t_2 (cos (+ kx kx)))
                (t_3 (cos (+ ky ky))))
           (if (<= t_1 -0.99)
             (* (/ (sin ky) (sqrt (fma kx kx (- 0.5 (* 0.5 t_3))))) (sin th))
             (if (<= t_1 -0.4)
               (* (* th (sin ky)) (/ 1.0 (sqrt (- 1.0 (* 0.5 (+ t_3 t_2))))))
               (if (<= t_1 0.7)
                 (* (/ (sin ky) (sqrt (- 0.5 (* 0.5 t_2)))) (sin th))
                 (if (<= t_1 2.0) (sin th) (* (/ (sin ky) (sin kx)) (sin th))))))))
        double code(double kx, double ky, double th) {
        	double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
        	double t_2 = cos((kx + kx));
        	double t_3 = cos((ky + ky));
        	double tmp;
        	if (t_1 <= -0.99) {
        		tmp = (sin(ky) / sqrt(fma(kx, kx, (0.5 - (0.5 * t_3))))) * sin(th);
        	} else if (t_1 <= -0.4) {
        		tmp = (th * sin(ky)) * (1.0 / sqrt((1.0 - (0.5 * (t_3 + t_2)))));
        	} else if (t_1 <= 0.7) {
        		tmp = (sin(ky) / sqrt((0.5 - (0.5 * t_2)))) * sin(th);
        	} else if (t_1 <= 2.0) {
        		tmp = sin(th);
        	} else {
        		tmp = (sin(ky) / sin(kx)) * sin(th);
        	}
        	return tmp;
        }
        
        function code(kx, ky, th)
        	t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))
        	t_2 = cos(Float64(kx + kx))
        	t_3 = cos(Float64(ky + ky))
        	tmp = 0.0
        	if (t_1 <= -0.99)
        		tmp = Float64(Float64(sin(ky) / sqrt(fma(kx, kx, Float64(0.5 - Float64(0.5 * t_3))))) * sin(th));
        	elseif (t_1 <= -0.4)
        		tmp = Float64(Float64(th * sin(ky)) * Float64(1.0 / sqrt(Float64(1.0 - Float64(0.5 * Float64(t_3 + t_2))))));
        	elseif (t_1 <= 0.7)
        		tmp = Float64(Float64(sin(ky) / sqrt(Float64(0.5 - Float64(0.5 * t_2)))) * sin(th));
        	elseif (t_1 <= 2.0)
        		tmp = sin(th);
        	else
        		tmp = Float64(Float64(sin(ky) / sin(kx)) * sin(th));
        	end
        	return tmp
        end
        
        code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -0.99], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(kx * kx + N[(0.5 - N[(0.5 * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.4], N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(1.0 - N[(0.5 * N[(t$95$3 + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.7], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(0.5 - N[(0.5 * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[Sin[th], $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]]]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
        t_2 := \cos \left(kx + kx\right)\\
        t_3 := \cos \left(ky + ky\right)\\
        \mathbf{if}\;t\_1 \leq -0.99:\\
        \;\;\;\;\frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, 0.5 - 0.5 \cdot t\_3\right)}} \cdot \sin th\\
        
        \mathbf{elif}\;t\_1 \leq -0.4:\\
        \;\;\;\;\left(th \cdot \sin ky\right) \cdot \frac{1}{\sqrt{1 - 0.5 \cdot \left(t\_3 + t\_2\right)}}\\
        
        \mathbf{elif}\;t\_1 \leq 0.7:\\
        \;\;\;\;\frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot t\_2}} \cdot \sin th\\
        
        \mathbf{elif}\;t\_1 \leq 2:\\
        \;\;\;\;\sin th\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\sin ky}{\sin kx} \cdot \sin th\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 5 regimes
        2. if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.98999999999999999

          1. Initial program 86.2%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6486.2

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6465.3

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6464.9

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites64.9%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            6. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            9. lift-fma.f6486.0

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            10. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            11. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)}} \cdot \sin th \]
            12. lower-*.f6486.0

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)}} \cdot \sin th \]
            13. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            14. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            15. lower-+.f6486.0

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)}} \cdot \sin th \]
          5. Applied rewrites86.0%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)}}} \cdot \sin th \]
          6. Taylor expanded in kx around 0

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
          7. Step-by-step derivation
            1. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{kx \cdot kx + {\color{blue}{\sin ky}}^{2}}} \cdot \sin th \]
            2. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{kx \cdot kx + \sin ky \cdot \color{blue}{\sin ky}}} \cdot \sin th \]
            3. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{kx \cdot kx + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right)}} \cdot \sin th \]
            4. lower-fma.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, \color{blue}{kx}, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}} \cdot \sin th \]
            5. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}} \cdot \sin th \]
            6. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}} \cdot \sin th \]
            7. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}} \cdot \sin th \]
            8. lift--.f6462.7

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, 0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right)}} \cdot \sin th \]
            9. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}} \cdot \sin th \]
            10. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(ky + ky\right)\right)}} \cdot \sin th \]
            11. lift-+.f6462.7

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, 0.5 - 0.5 \cdot \cos \left(ky + ky\right)\right)}} \cdot \sin th \]
          8. Applied rewrites62.7%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(kx, kx, 0.5 - 0.5 \cdot \cos \left(ky + ky\right)\right)}}} \cdot \sin th \]

          if -0.98999999999999999 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.40000000000000002

          1. Initial program 99.3%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-*.f64N/A

              \[\leadsto \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th} \]
            2. lift-/.f64N/A

              \[\leadsto \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            3. associate-*l/N/A

              \[\leadsto \color{blue}{\frac{\sin ky \cdot \sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
            4. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{\sin ky \cdot \sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
            5. *-commutativeN/A

              \[\leadsto \frac{\color{blue}{\sin th \cdot \sin ky}}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \]
            6. lower-*.f6499.3

              \[\leadsto \frac{\color{blue}{\sin th \cdot \sin ky}}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \]
            7. lift-sqrt.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
            8. lift-+.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
            9. lift-pow.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{{\sin kx}^{2}} + {\sin ky}^{2}}} \]
            10. unpow2N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\sin kx \cdot \sin kx} + {\sin ky}^{2}}} \]
            11. lift-pow.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\sin kx \cdot \sin kx + \color{blue}{{\sin ky}^{2}}}} \]
            12. unpow2N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\sin kx \cdot \sin kx + \color{blue}{\sin ky \cdot \sin ky}}} \]
            13. lower-hypot.f6499.3

              \[\leadsto \frac{\sin th \cdot \sin ky}{\color{blue}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}} \]
          3. Applied rewrites99.3%

            \[\leadsto \color{blue}{\frac{\sin th \cdot \sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}} \]
          4. Step-by-step derivation
            1. lift-hypot.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\color{blue}{\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}}} \]
            2. lift-sin.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\sin kx} \cdot \sin kx + \sin ky \cdot \sin ky}} \]
            3. lift-sin.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\sin kx \cdot \color{blue}{\sin kx} + \sin ky \cdot \sin ky}} \]
            4. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)} + \sin ky \cdot \sin ky}} \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right) + \sin ky \cdot \sin ky}} \]
            6. lift-cos.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right) + \sin ky \cdot \sin ky}} \]
            7. lift-*.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right) + \sin ky \cdot \sin ky}} \]
            8. lift--.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)} + \sin ky \cdot \sin ky}} \]
            9. lift-sin.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \color{blue}{\sin ky} \cdot \sin ky}} \]
            10. lift-sin.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \sin ky \cdot \color{blue}{\sin ky}}} \]
            11. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}}} \]
            12. lift-*.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right)}} \]
            13. lift-cos.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right)}} \]
            14. lift-*.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right)}} \]
            15. lift--.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}}} \]
            16. +-commutativeN/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \]
            17. lift--.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \]
            18. associate-+l-N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \]
          5. Applied rewrites98.9%

            \[\leadsto \frac{\sin th \cdot \sin ky}{\color{blue}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \]
          6. Taylor expanded in th around 0

            \[\leadsto \color{blue}{\left(th \cdot \sin ky\right) \cdot \sqrt{\frac{1}{1 - \left(\frac{1}{2} \cdot \cos \left(2 \cdot kx\right) + \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}}} \]
          7. Step-by-step derivation
            1. lower-*.f64N/A

              \[\leadsto \left(th \cdot \sin ky\right) \cdot \color{blue}{\sqrt{\frac{1}{1 - \left(\frac{1}{2} \cdot \cos \left(2 \cdot kx\right) + \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}}} \]
            2. lower-*.f64N/A

              \[\leadsto \left(th \cdot \sin ky\right) \cdot \sqrt{\color{blue}{\frac{1}{1 - \left(\frac{1}{2} \cdot \cos \left(2 \cdot kx\right) + \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}}} \]
            3. lift-sin.f64N/A

              \[\leadsto \left(th \cdot \sin ky\right) \cdot \sqrt{\frac{1}{\color{blue}{1 - \left(\frac{1}{2} \cdot \cos \left(2 \cdot kx\right) + \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}}} \]
            4. sqrt-divN/A

              \[\leadsto \left(th \cdot \sin ky\right) \cdot \frac{\sqrt{1}}{\color{blue}{\sqrt{1 - \left(\frac{1}{2} \cdot \cos \left(2 \cdot kx\right) + \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}}} \]
            5. metadata-evalN/A

              \[\leadsto \left(th \cdot \sin ky\right) \cdot \frac{1}{\sqrt{\color{blue}{1 - \left(\frac{1}{2} \cdot \cos \left(2 \cdot kx\right) + \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}}} \]
            6. lower-/.f64N/A

              \[\leadsto \left(th \cdot \sin ky\right) \cdot \frac{1}{\color{blue}{\sqrt{1 - \left(\frac{1}{2} \cdot \cos \left(2 \cdot kx\right) + \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}}} \]
            7. lower-sqrt.f64N/A

              \[\leadsto \left(th \cdot \sin ky\right) \cdot \frac{1}{\sqrt{1 - \left(\frac{1}{2} \cdot \cos \left(2 \cdot kx\right) + \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}} \]
            8. lower--.f64N/A

              \[\leadsto \left(th \cdot \sin ky\right) \cdot \frac{1}{\sqrt{1 - \left(\frac{1}{2} \cdot \cos \left(2 \cdot kx\right) + \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}} \]
            9. metadata-evalN/A

              \[\leadsto \left(th \cdot \sin ky\right) \cdot \frac{1}{\sqrt{1 - \left(\frac{1}{2} \cdot \cos \left(2 \cdot kx\right) + \frac{1}{2} \cdot \cos \left(\left(\mathsf{neg}\left(-2\right)\right) \cdot ky\right)\right)}} \]
            10. distribute-lft-neg-inN/A

              \[\leadsto \left(th \cdot \sin ky\right) \cdot \frac{1}{\sqrt{1 - \left(\frac{1}{2} \cdot \cos \left(2 \cdot kx\right) + \frac{1}{2} \cdot \cos \left(\mathsf{neg}\left(-2 \cdot ky\right)\right)\right)}} \]
          8. Applied rewrites50.9%

            \[\leadsto \color{blue}{\left(th \cdot \sin ky\right) \cdot \frac{1}{\sqrt{1 - 0.5 \cdot \left(\cos \left(ky + ky\right) + \cos \left(kx + kx\right)\right)}}} \]

          if -0.40000000000000002 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.69999999999999996

          1. Initial program 99.2%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6499.0

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6478.4

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites78.4%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. associate-+l-N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            4. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            5. lower--.f6478.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{\left(0.5 \cdot \cos \left(2 \cdot ky\right) - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            6. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            7. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot \frac{1}{2}} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            8. lower-*.f6478.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot 0.5} - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            9. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(2 \cdot ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            10. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            11. lower-+.f6478.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot 0.5 - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            12. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            13. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            14. lower-*.f6478.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)\right)}} \cdot \sin th \]
            15. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            16. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            17. lower-+.f6478.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)\right)}} \cdot \sin th \]
          5. Applied rewrites78.4%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \cdot \sin th \]
          6. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\left(\frac{1}{2} - \cos \left(kx + kx\right) \cdot \frac{1}{2}\right)}\right)}} \cdot \sin th \]
            2. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(kx + kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            3. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            5. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            6. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            7. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx \cdot \sin kx}\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx} \cdot \sin kx\right)}} \cdot \sin th \]
            9. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \sin kx \cdot \color{blue}{\sin kx}\right)}} \cdot \sin th \]
            10. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{{\sin kx}^{2}}\right)}} \cdot \sin th \]
            11. pow-to-expN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            12. lower-exp.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            13. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - e^{\color{blue}{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            14. lower-log.f6439.5

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - e^{\color{blue}{\log \sin kx} \cdot 2}\right)}} \cdot \sin th \]
          7. Applied rewrites39.5%

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          8. Taylor expanded in ky around 0

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
          9. Step-by-step derivation
            1. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            2. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}} \cdot \sin th \]
            3. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \cdot \sin th \]
            4. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \cdot \sin th \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}}} \cdot \sin th \]
            6. lift--.f6463.8

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{0.5 \cdot \cos \left(2 \cdot kx\right)}}} \cdot \sin th \]
            7. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \cdot \sin th \]
            8. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(kx + kx\right)}} \cdot \sin th \]
            9. lift-+.f6463.8

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}} \cdot \sin th \]
          10. Applied rewrites63.8%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}}} \cdot \sin th \]

          if 0.69999999999999996 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2

          1. Initial program 99.6%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6499.6

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6480.0

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6479.5

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites79.5%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            6. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            9. lift-fma.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            10. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            11. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)}} \cdot \sin th \]
            12. lower-*.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)}} \cdot \sin th \]
            13. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            14. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            15. lower-+.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)}} \cdot \sin th \]
          5. Applied rewrites99.2%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)}}} \cdot \sin th \]
          6. Taylor expanded in kx around 0

            \[\leadsto \color{blue}{\sin th} \]
          7. Step-by-step derivation
            1. lift-sin.f6478.7

              \[\leadsto \sin th \]
          8. Applied rewrites78.7%

            \[\leadsto \color{blue}{\sin th} \]

          if 2 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64)))))

          1. Initial program 2.6%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites2.6%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. associate-+l-N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            4. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            5. lower--.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{\left(0.5 \cdot \cos \left(2 \cdot ky\right) - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            6. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            7. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot \frac{1}{2}} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            8. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot 0.5} - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            9. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(2 \cdot ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            10. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            11. lower-+.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot 0.5 - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            12. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            13. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            14. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)\right)}} \cdot \sin th \]
            15. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            16. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            17. lower-+.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)\right)}} \cdot \sin th \]
          5. Applied rewrites2.6%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \cdot \sin th \]
          6. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\left(\frac{1}{2} - \cos \left(kx + kx\right) \cdot \frac{1}{2}\right)}\right)}} \cdot \sin th \]
            2. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(kx + kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            3. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            5. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            6. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            7. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx \cdot \sin kx}\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx} \cdot \sin kx\right)}} \cdot \sin th \]
            9. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \sin kx \cdot \color{blue}{\sin kx}\right)}} \cdot \sin th \]
            10. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{{\sin kx}^{2}}\right)}} \cdot \sin th \]
            11. pow-to-expN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            12. lower-exp.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            13. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - e^{\color{blue}{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            14. lower-log.f641.5

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - e^{\color{blue}{\log \sin kx} \cdot 2}\right)}} \cdot \sin th \]
          7. Applied rewrites1.5%

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          8. Taylor expanded in ky around 0

            \[\leadsto \frac{\sin ky}{\color{blue}{\sin kx}} \cdot \sin th \]
          9. Step-by-step derivation
            1. lift-sin.f6429.8

              \[\leadsto \frac{\sin ky}{\sin kx} \cdot \sin th \]
          10. Applied rewrites29.8%

            \[\leadsto \frac{\sin ky}{\color{blue}{\sin kx}} \cdot \sin th \]
        3. Recombined 5 regimes into one program.
        4. Add Preprocessing

        Alternative 6: 65.0% accurate, 0.3× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\ \mathbf{if}\;t\_1 \leq -0.99:\\ \;\;\;\;\frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, 0.5 - 0.5 \cdot \cos \left(ky + ky\right)\right)}} \cdot \sin th\\ \mathbf{elif}\;t\_1 \leq -0.4:\\ \;\;\;\;\left(th \cdot \sin ky\right) \cdot \frac{1}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\ \mathbf{elif}\;t\_1 \leq 0.7:\\ \;\;\;\;\frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}} \cdot \sin th\\ \mathbf{elif}\;t\_1 \leq 2:\\ \;\;\;\;\sin th\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin ky}{\sin kx} \cdot \sin th\\ \end{array} \end{array} \]
        (FPCore (kx ky th)
         :precision binary64
         (let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
           (if (<= t_1 -0.99)
             (*
              (/ (sin ky) (sqrt (fma kx kx (- 0.5 (* 0.5 (cos (+ ky ky)))))))
              (sin th))
             (if (<= t_1 -0.4)
               (* (* th (sin ky)) (/ 1.0 (hypot (sin kx) (sin ky))))
               (if (<= t_1 0.7)
                 (* (/ (sin ky) (sqrt (- 0.5 (* 0.5 (cos (+ kx kx)))))) (sin th))
                 (if (<= t_1 2.0) (sin th) (* (/ (sin ky) (sin kx)) (sin th))))))))
        double code(double kx, double ky, double th) {
        	double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
        	double tmp;
        	if (t_1 <= -0.99) {
        		tmp = (sin(ky) / sqrt(fma(kx, kx, (0.5 - (0.5 * cos((ky + ky))))))) * sin(th);
        	} else if (t_1 <= -0.4) {
        		tmp = (th * sin(ky)) * (1.0 / hypot(sin(kx), sin(ky)));
        	} else if (t_1 <= 0.7) {
        		tmp = (sin(ky) / sqrt((0.5 - (0.5 * cos((kx + kx)))))) * sin(th);
        	} else if (t_1 <= 2.0) {
        		tmp = sin(th);
        	} else {
        		tmp = (sin(ky) / sin(kx)) * sin(th);
        	}
        	return tmp;
        }
        
        function code(kx, ky, th)
        	t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))
        	tmp = 0.0
        	if (t_1 <= -0.99)
        		tmp = Float64(Float64(sin(ky) / sqrt(fma(kx, kx, Float64(0.5 - Float64(0.5 * cos(Float64(ky + ky))))))) * sin(th));
        	elseif (t_1 <= -0.4)
        		tmp = Float64(Float64(th * sin(ky)) * Float64(1.0 / hypot(sin(kx), sin(ky))));
        	elseif (t_1 <= 0.7)
        		tmp = Float64(Float64(sin(ky) / sqrt(Float64(0.5 - Float64(0.5 * cos(Float64(kx + kx)))))) * sin(th));
        	elseif (t_1 <= 2.0)
        		tmp = sin(th);
        	else
        		tmp = Float64(Float64(sin(ky) / sin(kx)) * sin(th));
        	end
        	return tmp
        end
        
        code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.99], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(kx * kx + N[(0.5 - N[(0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.4], N[(N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.7], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(0.5 - N[(0.5 * N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[Sin[th], $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
        \mathbf{if}\;t\_1 \leq -0.99:\\
        \;\;\;\;\frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, 0.5 - 0.5 \cdot \cos \left(ky + ky\right)\right)}} \cdot \sin th\\
        
        \mathbf{elif}\;t\_1 \leq -0.4:\\
        \;\;\;\;\left(th \cdot \sin ky\right) \cdot \frac{1}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
        
        \mathbf{elif}\;t\_1 \leq 0.7:\\
        \;\;\;\;\frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}} \cdot \sin th\\
        
        \mathbf{elif}\;t\_1 \leq 2:\\
        \;\;\;\;\sin th\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\sin ky}{\sin kx} \cdot \sin th\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 5 regimes
        2. if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.98999999999999999

          1. Initial program 86.2%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6486.2

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6465.3

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6464.9

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites64.9%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            6. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            9. lift-fma.f6486.0

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            10. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            11. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)}} \cdot \sin th \]
            12. lower-*.f6486.0

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)}} \cdot \sin th \]
            13. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            14. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            15. lower-+.f6486.0

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)}} \cdot \sin th \]
          5. Applied rewrites86.0%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)}}} \cdot \sin th \]
          6. Taylor expanded in kx around 0

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
          7. Step-by-step derivation
            1. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{kx \cdot kx + {\color{blue}{\sin ky}}^{2}}} \cdot \sin th \]
            2. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{kx \cdot kx + \sin ky \cdot \color{blue}{\sin ky}}} \cdot \sin th \]
            3. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{kx \cdot kx + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right)}} \cdot \sin th \]
            4. lower-fma.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, \color{blue}{kx}, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}} \cdot \sin th \]
            5. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}} \cdot \sin th \]
            6. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}} \cdot \sin th \]
            7. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}} \cdot \sin th \]
            8. lift--.f6462.7

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, 0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right)}} \cdot \sin th \]
            9. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}} \cdot \sin th \]
            10. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(ky + ky\right)\right)}} \cdot \sin th \]
            11. lift-+.f6462.7

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, 0.5 - 0.5 \cdot \cos \left(ky + ky\right)\right)}} \cdot \sin th \]
          8. Applied rewrites62.7%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(kx, kx, 0.5 - 0.5 \cdot \cos \left(ky + ky\right)\right)}}} \cdot \sin th \]

          if -0.98999999999999999 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.40000000000000002

          1. Initial program 99.3%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6499.3

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6499.0

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6499.0

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites99.0%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            6. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            9. lift-fma.f6499.1

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            10. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            11. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)}} \cdot \sin th \]
            12. lower-*.f6499.1

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)}} \cdot \sin th \]
            13. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            14. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            15. lower-+.f6499.1

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)}} \cdot \sin th \]
          5. Applied rewrites99.1%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)}}} \cdot \sin th \]
          6. Taylor expanded in th around 0

            \[\leadsto \color{blue}{\left(th \cdot \sin ky\right) \cdot \sqrt{\frac{1}{\left(\frac{1}{2} + {\sin ky}^{2}\right) - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}} \]
          7. Step-by-step derivation
            1. lower-*.f64N/A

              \[\leadsto \left(th \cdot \sin ky\right) \cdot \color{blue}{\sqrt{\frac{1}{\left(\frac{1}{2} + {\sin ky}^{2}\right) - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}} \]
            2. lower-*.f64N/A

              \[\leadsto \left(th \cdot \sin ky\right) \cdot \sqrt{\color{blue}{\frac{1}{\left(\frac{1}{2} + {\sin ky}^{2}\right) - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}} \]
            3. lift-sin.f64N/A

              \[\leadsto \left(th \cdot \sin ky\right) \cdot \sqrt{\frac{1}{\color{blue}{\left(\frac{1}{2} + {\sin ky}^{2}\right) - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}} \]
            4. sqrt-divN/A

              \[\leadsto \left(th \cdot \sin ky\right) \cdot \frac{\sqrt{1}}{\color{blue}{\sqrt{\left(\frac{1}{2} + {\sin ky}^{2}\right) - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}} \]
            5. metadata-evalN/A

              \[\leadsto \left(th \cdot \sin ky\right) \cdot \frac{1}{\sqrt{\color{blue}{\left(\frac{1}{2} + {\sin ky}^{2}\right) - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}} \]
            6. pow1/2N/A

              \[\leadsto \left(th \cdot \sin ky\right) \cdot \frac{1}{{\left(\left(\frac{1}{2} + {\sin ky}^{2}\right) - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}^{\color{blue}{\frac{1}{2}}}} \]
            7. pow2N/A

              \[\leadsto \left(th \cdot \sin ky\right) \cdot \frac{1}{{\left(\left(\frac{1}{2} + \sin ky \cdot \sin ky\right) - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}^{\frac{1}{2}}} \]
            8. sqr-sin-a-revN/A

              \[\leadsto \left(th \cdot \sin ky\right) \cdot \frac{1}{{\left(\left(\frac{1}{2} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)\right) - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}^{\frac{1}{2}}} \]
            9. +-commutativeN/A

              \[\leadsto \left(th \cdot \sin ky\right) \cdot \frac{1}{{\left(\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \frac{1}{2}\right) - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}^{\frac{1}{2}}} \]
            10. associate-+r-N/A

              \[\leadsto \left(th \cdot \sin ky\right) \cdot \frac{1}{{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}^{\frac{1}{2}}} \]
            11. metadata-evalN/A

              \[\leadsto \left(th \cdot \sin ky\right) \cdot \frac{1}{{\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}^{\left(\frac{1}{4} + \color{blue}{\frac{1}{4}}\right)}} \]
          8. Applied rewrites51.1%

            \[\leadsto \color{blue}{\left(th \cdot \sin ky\right) \cdot \frac{1}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}} \]

          if -0.40000000000000002 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.69999999999999996

          1. Initial program 99.2%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6499.0

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6478.4

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites78.4%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. associate-+l-N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            4. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            5. lower--.f6478.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{\left(0.5 \cdot \cos \left(2 \cdot ky\right) - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            6. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            7. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot \frac{1}{2}} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            8. lower-*.f6478.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot 0.5} - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            9. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(2 \cdot ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            10. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            11. lower-+.f6478.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot 0.5 - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            12. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            13. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            14. lower-*.f6478.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)\right)}} \cdot \sin th \]
            15. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            16. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            17. lower-+.f6478.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)\right)}} \cdot \sin th \]
          5. Applied rewrites78.4%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \cdot \sin th \]
          6. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\left(\frac{1}{2} - \cos \left(kx + kx\right) \cdot \frac{1}{2}\right)}\right)}} \cdot \sin th \]
            2. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(kx + kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            3. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            5. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            6. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            7. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx \cdot \sin kx}\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx} \cdot \sin kx\right)}} \cdot \sin th \]
            9. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \sin kx \cdot \color{blue}{\sin kx}\right)}} \cdot \sin th \]
            10. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{{\sin kx}^{2}}\right)}} \cdot \sin th \]
            11. pow-to-expN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            12. lower-exp.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            13. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - e^{\color{blue}{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            14. lower-log.f6439.5

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - e^{\color{blue}{\log \sin kx} \cdot 2}\right)}} \cdot \sin th \]
          7. Applied rewrites39.5%

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          8. Taylor expanded in ky around 0

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
          9. Step-by-step derivation
            1. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            2. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}} \cdot \sin th \]
            3. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \cdot \sin th \]
            4. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \cdot \sin th \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}}} \cdot \sin th \]
            6. lift--.f6463.8

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{0.5 \cdot \cos \left(2 \cdot kx\right)}}} \cdot \sin th \]
            7. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \cdot \sin th \]
            8. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(kx + kx\right)}} \cdot \sin th \]
            9. lift-+.f6463.8

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}} \cdot \sin th \]
          10. Applied rewrites63.8%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}}} \cdot \sin th \]

          if 0.69999999999999996 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2

          1. Initial program 99.6%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6499.6

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6480.0

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6479.5

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites79.5%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            6. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            9. lift-fma.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            10. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            11. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)}} \cdot \sin th \]
            12. lower-*.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)}} \cdot \sin th \]
            13. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            14. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            15. lower-+.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)}} \cdot \sin th \]
          5. Applied rewrites99.2%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)}}} \cdot \sin th \]
          6. Taylor expanded in kx around 0

            \[\leadsto \color{blue}{\sin th} \]
          7. Step-by-step derivation
            1. lift-sin.f6478.7

              \[\leadsto \sin th \]
          8. Applied rewrites78.7%

            \[\leadsto \color{blue}{\sin th} \]

          if 2 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64)))))

          1. Initial program 2.6%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites2.6%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. associate-+l-N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            4. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            5. lower--.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{\left(0.5 \cdot \cos \left(2 \cdot ky\right) - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            6. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            7. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot \frac{1}{2}} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            8. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot 0.5} - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            9. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(2 \cdot ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            10. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            11. lower-+.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot 0.5 - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            12. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            13. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            14. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)\right)}} \cdot \sin th \]
            15. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            16. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            17. lower-+.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)\right)}} \cdot \sin th \]
          5. Applied rewrites2.6%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \cdot \sin th \]
          6. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\left(\frac{1}{2} - \cos \left(kx + kx\right) \cdot \frac{1}{2}\right)}\right)}} \cdot \sin th \]
            2. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(kx + kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            3. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            5. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            6. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            7. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx \cdot \sin kx}\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx} \cdot \sin kx\right)}} \cdot \sin th \]
            9. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \sin kx \cdot \color{blue}{\sin kx}\right)}} \cdot \sin th \]
            10. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{{\sin kx}^{2}}\right)}} \cdot \sin th \]
            11. pow-to-expN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            12. lower-exp.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            13. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - e^{\color{blue}{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            14. lower-log.f641.5

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - e^{\color{blue}{\log \sin kx} \cdot 2}\right)}} \cdot \sin th \]
          7. Applied rewrites1.5%

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          8. Taylor expanded in ky around 0

            \[\leadsto \frac{\sin ky}{\color{blue}{\sin kx}} \cdot \sin th \]
          9. Step-by-step derivation
            1. lift-sin.f6429.8

              \[\leadsto \frac{\sin ky}{\sin kx} \cdot \sin th \]
          10. Applied rewrites29.8%

            \[\leadsto \frac{\sin ky}{\color{blue}{\sin kx}} \cdot \sin th \]
        3. Recombined 5 regimes into one program.
        4. Add Preprocessing

        Alternative 7: 64.0% accurate, 1.2× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;kx \leq 0.0115:\\ \;\;\;\;\frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, kx \cdot kx\right)}} \cdot \sin th\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin th \cdot \sin ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}}\\ \end{array} \end{array} \]
        (FPCore (kx ky th)
         :precision binary64
         (if (<= kx 0.0115)
           (* (/ (sin ky) (sqrt (fma (sin ky) (sin ky) (* kx kx)))) (sin th))
           (/ (* (sin th) (sin ky)) (sqrt (- 0.5 (* 0.5 (cos (+ kx kx))))))))
        double code(double kx, double ky, double th) {
        	double tmp;
        	if (kx <= 0.0115) {
        		tmp = (sin(ky) / sqrt(fma(sin(ky), sin(ky), (kx * kx)))) * sin(th);
        	} else {
        		tmp = (sin(th) * sin(ky)) / sqrt((0.5 - (0.5 * cos((kx + kx)))));
        	}
        	return tmp;
        }
        
        function code(kx, ky, th)
        	tmp = 0.0
        	if (kx <= 0.0115)
        		tmp = Float64(Float64(sin(ky) / sqrt(fma(sin(ky), sin(ky), Float64(kx * kx)))) * sin(th));
        	else
        		tmp = Float64(Float64(sin(th) * sin(ky)) / sqrt(Float64(0.5 - Float64(0.5 * cos(Float64(kx + kx))))));
        	end
        	return tmp
        end
        
        code[kx_, ky_, th_] := If[LessEqual[kx, 0.0115], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Sin[ky], $MachinePrecision] * N[Sin[ky], $MachinePrecision] + N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(0.5 - N[(0.5 * N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;kx \leq 0.0115:\\
        \;\;\;\;\frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, kx \cdot kx\right)}} \cdot \sin th\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\sin th \cdot \sin ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if kx < 0.0115

          1. Initial program 92.3%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6492.3

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6479.8

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6467.7

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites67.7%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            6. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            9. lift-fma.f6480.3

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            10. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            11. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)}} \cdot \sin th \]
            12. lower-*.f6480.3

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)}} \cdot \sin th \]
            13. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            14. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            15. lower-+.f6480.3

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)}} \cdot \sin th \]
          5. Applied rewrites80.3%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)}}} \cdot \sin th \]
          6. Taylor expanded in kx around 0

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \color{blue}{{kx}^{2}}\right)}} \cdot \sin th \]
          7. Step-by-step derivation
            1. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, kx \cdot \color{blue}{kx}\right)}} \cdot \sin th \]
            2. lower-*.f6465.4

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, kx \cdot \color{blue}{kx}\right)}} \cdot \sin th \]
          8. Applied rewrites65.4%

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \color{blue}{kx \cdot kx}\right)}} \cdot \sin th \]

          if 0.0115 < kx

          1. Initial program 99.4%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-*.f64N/A

              \[\leadsto \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th} \]
            2. lift-/.f64N/A

              \[\leadsto \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            3. associate-*l/N/A

              \[\leadsto \color{blue}{\frac{\sin ky \cdot \sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
            4. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{\sin ky \cdot \sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
            5. *-commutativeN/A

              \[\leadsto \frac{\color{blue}{\sin th \cdot \sin ky}}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \]
            6. lower-*.f6499.4

              \[\leadsto \frac{\color{blue}{\sin th \cdot \sin ky}}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \]
            7. lift-sqrt.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
            8. lift-+.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
            9. lift-pow.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{{\sin kx}^{2}} + {\sin ky}^{2}}} \]
            10. unpow2N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\sin kx \cdot \sin kx} + {\sin ky}^{2}}} \]
            11. lift-pow.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\sin kx \cdot \sin kx + \color{blue}{{\sin ky}^{2}}}} \]
            12. unpow2N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\sin kx \cdot \sin kx + \color{blue}{\sin ky \cdot \sin ky}}} \]
            13. lower-hypot.f6499.5

              \[\leadsto \frac{\sin th \cdot \sin ky}{\color{blue}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}} \]
          3. Applied rewrites99.5%

            \[\leadsto \color{blue}{\frac{\sin th \cdot \sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}} \]
          4. Step-by-step derivation
            1. lift-hypot.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\color{blue}{\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}}} \]
            2. lift-sin.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\sin kx} \cdot \sin kx + \sin ky \cdot \sin ky}} \]
            3. lift-sin.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\sin kx \cdot \color{blue}{\sin kx} + \sin ky \cdot \sin ky}} \]
            4. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)} + \sin ky \cdot \sin ky}} \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right) + \sin ky \cdot \sin ky}} \]
            6. lift-cos.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right) + \sin ky \cdot \sin ky}} \]
            7. lift-*.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right) + \sin ky \cdot \sin ky}} \]
            8. lift--.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)} + \sin ky \cdot \sin ky}} \]
            9. lift-sin.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \color{blue}{\sin ky} \cdot \sin ky}} \]
            10. lift-sin.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \sin ky \cdot \color{blue}{\sin ky}}} \]
            11. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}}} \]
            12. lift-*.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right)}} \]
            13. lift-cos.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right)}} \]
            14. lift-*.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right)}} \]
            15. lift--.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}}} \]
            16. +-commutativeN/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \]
            17. lift--.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \]
            18. associate-+l-N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \]
          5. Applied rewrites99.1%

            \[\leadsto \frac{\sin th \cdot \sin ky}{\color{blue}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \]
          6. Taylor expanded in ky around 0

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}} \]
          7. Step-by-step derivation
            1. lower-*.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}}} \]
            2. lift-cos.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \]
            3. count-2-revN/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(kx + kx\right)}} \]
            4. lift-+.f6460.0

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}} \]
          8. Applied rewrites60.0%

            \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{0.5 - \color{blue}{0.5 \cdot \cos \left(kx + kx\right)}}} \]
        3. Recombined 2 regimes into one program.
        4. Add Preprocessing

        Alternative 8: 62.0% accurate, 0.3× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\ \mathbf{if}\;t\_1 \leq -0.7:\\ \;\;\;\;\frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(ky + ky\right)}} \cdot \sin th\\ \mathbf{elif}\;t\_1 \leq 0.7:\\ \;\;\;\;\frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}} \cdot \sin th\\ \mathbf{elif}\;t\_1 \leq 2:\\ \;\;\;\;\sin th\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin ky}{\sin kx} \cdot \sin th\\ \end{array} \end{array} \]
        (FPCore (kx ky th)
         :precision binary64
         (let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
           (if (<= t_1 -0.7)
             (* (/ (sin ky) (sqrt (- 0.5 (* 0.5 (cos (+ ky ky)))))) (sin th))
             (if (<= t_1 0.7)
               (* (/ (sin ky) (sqrt (- 0.5 (* 0.5 (cos (+ kx kx)))))) (sin th))
               (if (<= t_1 2.0) (sin th) (* (/ (sin ky) (sin kx)) (sin th)))))))
        double code(double kx, double ky, double th) {
        	double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
        	double tmp;
        	if (t_1 <= -0.7) {
        		tmp = (sin(ky) / sqrt((0.5 - (0.5 * cos((ky + ky)))))) * sin(th);
        	} else if (t_1 <= 0.7) {
        		tmp = (sin(ky) / sqrt((0.5 - (0.5 * cos((kx + kx)))))) * sin(th);
        	} else if (t_1 <= 2.0) {
        		tmp = sin(th);
        	} else {
        		tmp = (sin(ky) / sin(kx)) * sin(th);
        	}
        	return tmp;
        }
        
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(kx, ky, th)
        use fmin_fmax_functions
            real(8), intent (in) :: kx
            real(8), intent (in) :: ky
            real(8), intent (in) :: th
            real(8) :: t_1
            real(8) :: tmp
            t_1 = sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))
            if (t_1 <= (-0.7d0)) then
                tmp = (sin(ky) / sqrt((0.5d0 - (0.5d0 * cos((ky + ky)))))) * sin(th)
            else if (t_1 <= 0.7d0) then
                tmp = (sin(ky) / sqrt((0.5d0 - (0.5d0 * cos((kx + kx)))))) * sin(th)
            else if (t_1 <= 2.0d0) then
                tmp = sin(th)
            else
                tmp = (sin(ky) / sin(kx)) * sin(th)
            end if
            code = tmp
        end function
        
        public static double code(double kx, double ky, double th) {
        	double t_1 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
        	double tmp;
        	if (t_1 <= -0.7) {
        		tmp = (Math.sin(ky) / Math.sqrt((0.5 - (0.5 * Math.cos((ky + ky)))))) * Math.sin(th);
        	} else if (t_1 <= 0.7) {
        		tmp = (Math.sin(ky) / Math.sqrt((0.5 - (0.5 * Math.cos((kx + kx)))))) * Math.sin(th);
        	} else if (t_1 <= 2.0) {
        		tmp = Math.sin(th);
        	} else {
        		tmp = (Math.sin(ky) / Math.sin(kx)) * Math.sin(th);
        	}
        	return tmp;
        }
        
        def code(kx, ky, th):
        	t_1 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))
        	tmp = 0
        	if t_1 <= -0.7:
        		tmp = (math.sin(ky) / math.sqrt((0.5 - (0.5 * math.cos((ky + ky)))))) * math.sin(th)
        	elif t_1 <= 0.7:
        		tmp = (math.sin(ky) / math.sqrt((0.5 - (0.5 * math.cos((kx + kx)))))) * math.sin(th)
        	elif t_1 <= 2.0:
        		tmp = math.sin(th)
        	else:
        		tmp = (math.sin(ky) / math.sin(kx)) * math.sin(th)
        	return tmp
        
        function code(kx, ky, th)
        	t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))
        	tmp = 0.0
        	if (t_1 <= -0.7)
        		tmp = Float64(Float64(sin(ky) / sqrt(Float64(0.5 - Float64(0.5 * cos(Float64(ky + ky)))))) * sin(th));
        	elseif (t_1 <= 0.7)
        		tmp = Float64(Float64(sin(ky) / sqrt(Float64(0.5 - Float64(0.5 * cos(Float64(kx + kx)))))) * sin(th));
        	elseif (t_1 <= 2.0)
        		tmp = sin(th);
        	else
        		tmp = Float64(Float64(sin(ky) / sin(kx)) * sin(th));
        	end
        	return tmp
        end
        
        function tmp_2 = code(kx, ky, th)
        	t_1 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)));
        	tmp = 0.0;
        	if (t_1 <= -0.7)
        		tmp = (sin(ky) / sqrt((0.5 - (0.5 * cos((ky + ky)))))) * sin(th);
        	elseif (t_1 <= 0.7)
        		tmp = (sin(ky) / sqrt((0.5 - (0.5 * cos((kx + kx)))))) * sin(th);
        	elseif (t_1 <= 2.0)
        		tmp = sin(th);
        	else
        		tmp = (sin(ky) / sin(kx)) * sin(th);
        	end
        	tmp_2 = tmp;
        end
        
        code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.7], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(0.5 - N[(0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.7], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(0.5 - N[(0.5 * N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[Sin[th], $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
        \mathbf{if}\;t\_1 \leq -0.7:\\
        \;\;\;\;\frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(ky + ky\right)}} \cdot \sin th\\
        
        \mathbf{elif}\;t\_1 \leq 0.7:\\
        \;\;\;\;\frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}} \cdot \sin th\\
        
        \mathbf{elif}\;t\_1 \leq 2:\\
        \;\;\;\;\sin th\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\sin ky}{\sin kx} \cdot \sin th\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 4 regimes
        2. if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.69999999999999996

          1. Initial program 89.3%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6489.3

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6473.2

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6472.9

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites72.9%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. associate-+l-N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            4. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            5. lower--.f6472.9

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{\left(0.5 \cdot \cos \left(2 \cdot ky\right) - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            6. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            7. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot \frac{1}{2}} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            8. lower-*.f6472.9

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot 0.5} - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            9. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(2 \cdot ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            10. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            11. lower-+.f6472.9

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot 0.5 - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            12. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            13. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            14. lower-*.f6472.9

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)\right)}} \cdot \sin th \]
            15. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            16. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            17. lower-+.f6472.9

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)\right)}} \cdot \sin th \]
          5. Applied rewrites72.9%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \cdot \sin th \]
          6. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\left(\frac{1}{2} - \cos \left(kx + kx\right) \cdot \frac{1}{2}\right)}\right)}} \cdot \sin th \]
            2. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(kx + kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            3. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            5. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            6. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            7. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx \cdot \sin kx}\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx} \cdot \sin kx\right)}} \cdot \sin th \]
            9. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \sin kx \cdot \color{blue}{\sin kx}\right)}} \cdot \sin th \]
            10. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{{\sin kx}^{2}}\right)}} \cdot \sin th \]
            11. pow-to-expN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            12. lower-exp.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            13. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - e^{\color{blue}{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            14. lower-log.f6436.0

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - e^{\color{blue}{\log \sin kx} \cdot 2}\right)}} \cdot \sin th \]
          7. Applied rewrites36.0%

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          8. Taylor expanded in kx around 0

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}}} \cdot \sin th \]
          9. Step-by-step derivation
            1. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}}} \cdot \sin th \]
            2. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}} \cdot \sin th \]
            3. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(ky + ky\right)}} \cdot \sin th \]
            4. lift-+.f6453.2

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(ky + ky\right)}} \cdot \sin th \]
          10. Applied rewrites53.2%

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{0.5 \cdot \cos \left(ky + ky\right)}}} \cdot \sin th \]

          if -0.69999999999999996 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.69999999999999996

          1. Initial program 99.2%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6499.0

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6480.0

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites80.0%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. associate-+l-N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            4. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            5. lower--.f6480.0

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{\left(0.5 \cdot \cos \left(2 \cdot ky\right) - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            6. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            7. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot \frac{1}{2}} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            8. lower-*.f6480.0

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot 0.5} - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            9. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(2 \cdot ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            10. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            11. lower-+.f6480.0

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot 0.5 - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            12. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            13. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            14. lower-*.f6480.0

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)\right)}} \cdot \sin th \]
            15. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            16. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            17. lower-+.f6480.0

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)\right)}} \cdot \sin th \]
          5. Applied rewrites80.0%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \cdot \sin th \]
          6. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\left(\frac{1}{2} - \cos \left(kx + kx\right) \cdot \frac{1}{2}\right)}\right)}} \cdot \sin th \]
            2. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(kx + kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            3. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            5. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            6. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            7. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx \cdot \sin kx}\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx} \cdot \sin kx\right)}} \cdot \sin th \]
            9. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \sin kx \cdot \color{blue}{\sin kx}\right)}} \cdot \sin th \]
            10. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{{\sin kx}^{2}}\right)}} \cdot \sin th \]
            11. pow-to-expN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            12. lower-exp.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            13. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - e^{\color{blue}{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            14. lower-log.f6440.5

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - e^{\color{blue}{\log \sin kx} \cdot 2}\right)}} \cdot \sin th \]
          7. Applied rewrites40.5%

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          8. Taylor expanded in ky around 0

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
          9. Step-by-step derivation
            1. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            2. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}} \cdot \sin th \]
            3. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \cdot \sin th \]
            4. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \cdot \sin th \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}}} \cdot \sin th \]
            6. lift--.f6460.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{0.5 \cdot \cos \left(2 \cdot kx\right)}}} \cdot \sin th \]
            7. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \cdot \sin th \]
            8. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(kx + kx\right)}} \cdot \sin th \]
            9. lift-+.f6460.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}} \cdot \sin th \]
          10. Applied rewrites60.4%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}}} \cdot \sin th \]

          if 0.69999999999999996 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2

          1. Initial program 99.6%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6499.6

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6480.0

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6479.5

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites79.5%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            6. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            9. lift-fma.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            10. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            11. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)}} \cdot \sin th \]
            12. lower-*.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)}} \cdot \sin th \]
            13. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            14. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            15. lower-+.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)}} \cdot \sin th \]
          5. Applied rewrites99.2%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)}}} \cdot \sin th \]
          6. Taylor expanded in kx around 0

            \[\leadsto \color{blue}{\sin th} \]
          7. Step-by-step derivation
            1. lift-sin.f6478.7

              \[\leadsto \sin th \]
          8. Applied rewrites78.7%

            \[\leadsto \color{blue}{\sin th} \]

          if 2 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64)))))

          1. Initial program 2.6%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites2.6%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. associate-+l-N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            4. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            5. lower--.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{\left(0.5 \cdot \cos \left(2 \cdot ky\right) - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            6. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            7. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot \frac{1}{2}} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            8. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot 0.5} - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            9. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(2 \cdot ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            10. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            11. lower-+.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot 0.5 - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            12. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            13. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            14. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)\right)}} \cdot \sin th \]
            15. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            16. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            17. lower-+.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)\right)}} \cdot \sin th \]
          5. Applied rewrites2.6%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \cdot \sin th \]
          6. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\left(\frac{1}{2} - \cos \left(kx + kx\right) \cdot \frac{1}{2}\right)}\right)}} \cdot \sin th \]
            2. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(kx + kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            3. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            5. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            6. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            7. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx \cdot \sin kx}\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx} \cdot \sin kx\right)}} \cdot \sin th \]
            9. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \sin kx \cdot \color{blue}{\sin kx}\right)}} \cdot \sin th \]
            10. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{{\sin kx}^{2}}\right)}} \cdot \sin th \]
            11. pow-to-expN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            12. lower-exp.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            13. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - e^{\color{blue}{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            14. lower-log.f641.5

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - e^{\color{blue}{\log \sin kx} \cdot 2}\right)}} \cdot \sin th \]
          7. Applied rewrites1.5%

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          8. Taylor expanded in ky around 0

            \[\leadsto \frac{\sin ky}{\color{blue}{\sin kx}} \cdot \sin th \]
          9. Step-by-step derivation
            1. lift-sin.f6429.8

              \[\leadsto \frac{\sin ky}{\sin kx} \cdot \sin th \]
          10. Applied rewrites29.8%

            \[\leadsto \frac{\sin ky}{\color{blue}{\sin kx}} \cdot \sin th \]
        3. Recombined 4 regimes into one program.
        4. Add Preprocessing

        Alternative 9: 49.4% accurate, 1.4× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;ky \leq 1.05 \cdot 10^{-169}:\\ \;\;\;\;\frac{ky}{\sin kx} \cdot \sin th\\ \mathbf{elif}\;ky \leq 0.009:\\ \;\;\;\;\frac{\sin ky}{\sqrt{\mathsf{fma}\left(ky, ky, 0.5 - 0.5 \cdot \cos \left(kx + kx\right)\right)}} \cdot \sin th\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(ky + ky\right)}} \cdot \sin th\\ \end{array} \end{array} \]
        (FPCore (kx ky th)
         :precision binary64
         (if (<= ky 1.05e-169)
           (* (/ ky (sin kx)) (sin th))
           (if (<= ky 0.009)
             (*
              (/ (sin ky) (sqrt (fma ky ky (- 0.5 (* 0.5 (cos (+ kx kx)))))))
              (sin th))
             (* (/ (sin ky) (sqrt (- 0.5 (* 0.5 (cos (+ ky ky)))))) (sin th)))))
        double code(double kx, double ky, double th) {
        	double tmp;
        	if (ky <= 1.05e-169) {
        		tmp = (ky / sin(kx)) * sin(th);
        	} else if (ky <= 0.009) {
        		tmp = (sin(ky) / sqrt(fma(ky, ky, (0.5 - (0.5 * cos((kx + kx))))))) * sin(th);
        	} else {
        		tmp = (sin(ky) / sqrt((0.5 - (0.5 * cos((ky + ky)))))) * sin(th);
        	}
        	return tmp;
        }
        
        function code(kx, ky, th)
        	tmp = 0.0
        	if (ky <= 1.05e-169)
        		tmp = Float64(Float64(ky / sin(kx)) * sin(th));
        	elseif (ky <= 0.009)
        		tmp = Float64(Float64(sin(ky) / sqrt(fma(ky, ky, Float64(0.5 - Float64(0.5 * cos(Float64(kx + kx))))))) * sin(th));
        	else
        		tmp = Float64(Float64(sin(ky) / sqrt(Float64(0.5 - Float64(0.5 * cos(Float64(ky + ky)))))) * sin(th));
        	end
        	return tmp
        end
        
        code[kx_, ky_, th_] := If[LessEqual[ky, 1.05e-169], N[(N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 0.009], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(ky * ky + N[(0.5 - N[(0.5 * N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(0.5 - N[(0.5 * N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;ky \leq 1.05 \cdot 10^{-169}:\\
        \;\;\;\;\frac{ky}{\sin kx} \cdot \sin th\\
        
        \mathbf{elif}\;ky \leq 0.009:\\
        \;\;\;\;\frac{\sin ky}{\sqrt{\mathsf{fma}\left(ky, ky, 0.5 - 0.5 \cdot \cos \left(kx + kx\right)\right)}} \cdot \sin th\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(ky + ky\right)}} \cdot \sin th\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if ky < 1.05e-169

          1. Initial program 90.7%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6490.7

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6483.3

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6471.2

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites71.2%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. associate-+l-N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            4. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            5. lower--.f6471.2

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{\left(0.5 \cdot \cos \left(2 \cdot ky\right) - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            6. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            7. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot \frac{1}{2}} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            8. lower-*.f6471.2

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot 0.5} - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            9. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(2 \cdot ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            10. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            11. lower-+.f6471.2

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot 0.5 - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            12. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            13. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            14. lower-*.f6471.2

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)\right)}} \cdot \sin th \]
            15. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            16. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            17. lower-+.f6471.2

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)\right)}} \cdot \sin th \]
          5. Applied rewrites71.2%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \cdot \sin th \]
          6. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\left(\frac{1}{2} - \cos \left(kx + kx\right) \cdot \frac{1}{2}\right)}\right)}} \cdot \sin th \]
            2. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(kx + kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            3. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            5. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            6. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            7. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx \cdot \sin kx}\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx} \cdot \sin kx\right)}} \cdot \sin th \]
            9. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \sin kx \cdot \color{blue}{\sin kx}\right)}} \cdot \sin th \]
            10. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{{\sin kx}^{2}}\right)}} \cdot \sin th \]
            11. pow-to-expN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            12. lower-exp.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            13. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - e^{\color{blue}{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            14. lower-log.f6434.8

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - e^{\color{blue}{\log \sin kx} \cdot 2}\right)}} \cdot \sin th \]
          7. Applied rewrites34.8%

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          8. Taylor expanded in ky around 0

            \[\leadsto \color{blue}{\frac{ky}{\sin kx}} \cdot \sin th \]
          9. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \frac{ky}{\color{blue}{\sin kx}} \cdot \sin th \]
            2. lift-sin.f6431.0

              \[\leadsto \frac{ky}{\sin kx} \cdot \sin th \]
          10. Applied rewrites31.0%

            \[\leadsto \color{blue}{\frac{ky}{\sin kx}} \cdot \sin th \]

          if 1.05e-169 < ky < 0.00899999999999999932

          1. Initial program 98.6%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6498.6

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6466.3

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6453.4

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites53.4%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. associate-+l-N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            4. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            5. lower--.f6453.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{\left(0.5 \cdot \cos \left(2 \cdot ky\right) - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            6. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            7. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot \frac{1}{2}} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            8. lower-*.f6453.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot 0.5} - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            9. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(2 \cdot ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            10. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            11. lower-+.f6453.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot 0.5 - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            12. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            13. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            14. lower-*.f6453.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)\right)}} \cdot \sin th \]
            15. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            16. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            17. lower-+.f6453.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)\right)}} \cdot \sin th \]
          5. Applied rewrites53.4%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \cdot \sin th \]
          6. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\left(\frac{1}{2} - \cos \left(kx + kx\right) \cdot \frac{1}{2}\right)}\right)}} \cdot \sin th \]
            2. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(kx + kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            3. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            5. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            6. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            7. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx \cdot \sin kx}\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx} \cdot \sin kx\right)}} \cdot \sin th \]
            9. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \sin kx \cdot \color{blue}{\sin kx}\right)}} \cdot \sin th \]
            10. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{{\sin kx}^{2}}\right)}} \cdot \sin th \]
            11. pow-to-expN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            12. lower-exp.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            13. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - e^{\color{blue}{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            14. lower-log.f6429.7

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - e^{\color{blue}{\log \sin kx} \cdot 2}\right)}} \cdot \sin th \]
          7. Applied rewrites29.7%

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          8. Taylor expanded in ky around 0

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
          9. Step-by-step derivation
            1. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{ky \cdot ky + {\color{blue}{\sin kx}}^{2}}} \cdot \sin th \]
            2. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{ky \cdot ky + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            3. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{ky \cdot ky + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            4. lower-fma.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(ky, \color{blue}{ky}, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            5. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(ky, ky, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            6. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(ky, ky, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            7. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(ky, ky, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            8. lift--.f6485.5

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(ky, ky, 0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            9. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(ky, ky, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            10. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(ky, ky, \frac{1}{2} - \frac{1}{2} \cdot \cos \left(kx + kx\right)\right)}} \cdot \sin th \]
            11. lift-+.f6485.5

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(ky, ky, 0.5 - 0.5 \cdot \cos \left(kx + kx\right)\right)}} \cdot \sin th \]
          10. Applied rewrites85.5%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(ky, ky, 0.5 - 0.5 \cdot \cos \left(kx + kx\right)\right)}}} \cdot \sin th \]

          if 0.00899999999999999932 < ky

          1. Initial program 99.6%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6499.6

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6499.0

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6498.9

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites98.9%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. associate-+l-N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            4. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            5. lower--.f6498.9

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{\left(0.5 \cdot \cos \left(2 \cdot ky\right) - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            6. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            7. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot \frac{1}{2}} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            8. lower-*.f6498.9

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot 0.5} - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            9. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(2 \cdot ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            10. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            11. lower-+.f6498.9

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot 0.5 - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            12. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            13. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            14. lower-*.f6498.9

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)\right)}} \cdot \sin th \]
            15. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            16. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            17. lower-+.f6498.9

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)\right)}} \cdot \sin th \]
          5. Applied rewrites98.9%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \cdot \sin th \]
          6. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\left(\frac{1}{2} - \cos \left(kx + kx\right) \cdot \frac{1}{2}\right)}\right)}} \cdot \sin th \]
            2. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(kx + kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            3. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            5. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            6. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            7. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx \cdot \sin kx}\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx} \cdot \sin kx\right)}} \cdot \sin th \]
            9. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \sin kx \cdot \color{blue}{\sin kx}\right)}} \cdot \sin th \]
            10. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{{\sin kx}^{2}}\right)}} \cdot \sin th \]
            11. pow-to-expN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            12. lower-exp.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            13. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - e^{\color{blue}{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            14. lower-log.f6448.1

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - e^{\color{blue}{\log \sin kx} \cdot 2}\right)}} \cdot \sin th \]
          7. Applied rewrites48.1%

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          8. Taylor expanded in kx around 0

            \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}}} \cdot \sin th \]
          9. Step-by-step derivation
            1. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}}} \cdot \sin th \]
            2. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}} \cdot \sin th \]
            3. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(ky + ky\right)}} \cdot \sin th \]
            4. lift-+.f6459.5

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(ky + ky\right)}} \cdot \sin th \]
          10. Applied rewrites59.5%

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{0.5 \cdot \cos \left(ky + ky\right)}}} \cdot \sin th \]
        3. Recombined 3 regimes into one program.
        4. Add Preprocessing

        Alternative 10: 47.1% accurate, 0.4× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\ \mathbf{if}\;t\_1 \leq 0.7:\\ \;\;\;\;\frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}} \cdot \sin th\\ \mathbf{elif}\;t\_1 \leq 2:\\ \;\;\;\;\sin th\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin ky}{\sin kx} \cdot \sin th\\ \end{array} \end{array} \]
        (FPCore (kx ky th)
         :precision binary64
         (let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
           (if (<= t_1 0.7)
             (* (/ (sin ky) (sqrt (- 0.5 (* 0.5 (cos (+ kx kx)))))) (sin th))
             (if (<= t_1 2.0) (sin th) (* (/ (sin ky) (sin kx)) (sin th))))))
        double code(double kx, double ky, double th) {
        	double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
        	double tmp;
        	if (t_1 <= 0.7) {
        		tmp = (sin(ky) / sqrt((0.5 - (0.5 * cos((kx + kx)))))) * sin(th);
        	} else if (t_1 <= 2.0) {
        		tmp = sin(th);
        	} else {
        		tmp = (sin(ky) / sin(kx)) * sin(th);
        	}
        	return tmp;
        }
        
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(kx, ky, th)
        use fmin_fmax_functions
            real(8), intent (in) :: kx
            real(8), intent (in) :: ky
            real(8), intent (in) :: th
            real(8) :: t_1
            real(8) :: tmp
            t_1 = sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))
            if (t_1 <= 0.7d0) then
                tmp = (sin(ky) / sqrt((0.5d0 - (0.5d0 * cos((kx + kx)))))) * sin(th)
            else if (t_1 <= 2.0d0) then
                tmp = sin(th)
            else
                tmp = (sin(ky) / sin(kx)) * sin(th)
            end if
            code = tmp
        end function
        
        public static double code(double kx, double ky, double th) {
        	double t_1 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
        	double tmp;
        	if (t_1 <= 0.7) {
        		tmp = (Math.sin(ky) / Math.sqrt((0.5 - (0.5 * Math.cos((kx + kx)))))) * Math.sin(th);
        	} else if (t_1 <= 2.0) {
        		tmp = Math.sin(th);
        	} else {
        		tmp = (Math.sin(ky) / Math.sin(kx)) * Math.sin(th);
        	}
        	return tmp;
        }
        
        def code(kx, ky, th):
        	t_1 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))
        	tmp = 0
        	if t_1 <= 0.7:
        		tmp = (math.sin(ky) / math.sqrt((0.5 - (0.5 * math.cos((kx + kx)))))) * math.sin(th)
        	elif t_1 <= 2.0:
        		tmp = math.sin(th)
        	else:
        		tmp = (math.sin(ky) / math.sin(kx)) * math.sin(th)
        	return tmp
        
        function code(kx, ky, th)
        	t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))
        	tmp = 0.0
        	if (t_1 <= 0.7)
        		tmp = Float64(Float64(sin(ky) / sqrt(Float64(0.5 - Float64(0.5 * cos(Float64(kx + kx)))))) * sin(th));
        	elseif (t_1 <= 2.0)
        		tmp = sin(th);
        	else
        		tmp = Float64(Float64(sin(ky) / sin(kx)) * sin(th));
        	end
        	return tmp
        end
        
        function tmp_2 = code(kx, ky, th)
        	t_1 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)));
        	tmp = 0.0;
        	if (t_1 <= 0.7)
        		tmp = (sin(ky) / sqrt((0.5 - (0.5 * cos((kx + kx)))))) * sin(th);
        	elseif (t_1 <= 2.0)
        		tmp = sin(th);
        	else
        		tmp = (sin(ky) / sin(kx)) * sin(th);
        	end
        	tmp_2 = tmp;
        end
        
        code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.7], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(0.5 - N[(0.5 * N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[Sin[th], $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
        \mathbf{if}\;t\_1 \leq 0.7:\\
        \;\;\;\;\frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}} \cdot \sin th\\
        
        \mathbf{elif}\;t\_1 \leq 2:\\
        \;\;\;\;\sin th\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\sin ky}{\sin kx} \cdot \sin th\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.69999999999999996

          1. Initial program 95.5%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6495.5

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6489.4

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6477.4

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites77.4%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. associate-+l-N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            4. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            5. lower--.f6477.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{\left(0.5 \cdot \cos \left(2 \cdot ky\right) - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            6. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            7. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot \frac{1}{2}} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            8. lower-*.f6477.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot 0.5} - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            9. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(2 \cdot ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            10. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            11. lower-+.f6477.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot 0.5 - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            12. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            13. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            14. lower-*.f6477.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)\right)}} \cdot \sin th \]
            15. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            16. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            17. lower-+.f6477.4

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)\right)}} \cdot \sin th \]
          5. Applied rewrites77.4%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \cdot \sin th \]
          6. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\left(\frac{1}{2} - \cos \left(kx + kx\right) \cdot \frac{1}{2}\right)}\right)}} \cdot \sin th \]
            2. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(kx + kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            3. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            5. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            6. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            7. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx \cdot \sin kx}\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx} \cdot \sin kx\right)}} \cdot \sin th \]
            9. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \sin kx \cdot \color{blue}{\sin kx}\right)}} \cdot \sin th \]
            10. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{{\sin kx}^{2}}\right)}} \cdot \sin th \]
            11. pow-to-expN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            12. lower-exp.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            13. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - e^{\color{blue}{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            14. lower-log.f6438.8

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - e^{\color{blue}{\log \sin kx} \cdot 2}\right)}} \cdot \sin th \]
          7. Applied rewrites38.8%

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          8. Taylor expanded in ky around 0

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
          9. Step-by-step derivation
            1. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            2. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}} \cdot \sin th \]
            3. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \cdot \sin th \]
            4. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \cdot \sin th \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}}} \cdot \sin th \]
            6. lift--.f6440.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{0.5 \cdot \cos \left(2 \cdot kx\right)}}} \cdot \sin th \]
            7. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \cdot \sin th \]
            8. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(kx + kx\right)}} \cdot \sin th \]
            9. lift-+.f6440.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}} \cdot \sin th \]
          10. Applied rewrites40.6%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}}} \cdot \sin th \]

          if 0.69999999999999996 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2

          1. Initial program 99.6%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6499.6

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6480.0

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6479.5

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites79.5%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            6. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            9. lift-fma.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            10. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            11. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)}} \cdot \sin th \]
            12. lower-*.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)}} \cdot \sin th \]
            13. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            14. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            15. lower-+.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)}} \cdot \sin th \]
          5. Applied rewrites99.2%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)}}} \cdot \sin th \]
          6. Taylor expanded in kx around 0

            \[\leadsto \color{blue}{\sin th} \]
          7. Step-by-step derivation
            1. lift-sin.f6478.7

              \[\leadsto \sin th \]
          8. Applied rewrites78.7%

            \[\leadsto \color{blue}{\sin th} \]

          if 2 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64)))))

          1. Initial program 2.6%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites2.6%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. associate-+l-N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            4. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            5. lower--.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{\left(0.5 \cdot \cos \left(2 \cdot ky\right) - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            6. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            7. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot \frac{1}{2}} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            8. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot 0.5} - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            9. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(2 \cdot ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            10. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            11. lower-+.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot 0.5 - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            12. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            13. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            14. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)\right)}} \cdot \sin th \]
            15. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            16. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            17. lower-+.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)\right)}} \cdot \sin th \]
          5. Applied rewrites2.6%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \cdot \sin th \]
          6. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\left(\frac{1}{2} - \cos \left(kx + kx\right) \cdot \frac{1}{2}\right)}\right)}} \cdot \sin th \]
            2. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(kx + kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            3. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            5. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            6. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            7. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx \cdot \sin kx}\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx} \cdot \sin kx\right)}} \cdot \sin th \]
            9. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \sin kx \cdot \color{blue}{\sin kx}\right)}} \cdot \sin th \]
            10. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{{\sin kx}^{2}}\right)}} \cdot \sin th \]
            11. pow-to-expN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            12. lower-exp.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            13. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - e^{\color{blue}{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            14. lower-log.f641.5

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - e^{\color{blue}{\log \sin kx} \cdot 2}\right)}} \cdot \sin th \]
          7. Applied rewrites1.5%

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          8. Taylor expanded in ky around 0

            \[\leadsto \frac{\sin ky}{\color{blue}{\sin kx}} \cdot \sin th \]
          9. Step-by-step derivation
            1. lift-sin.f6429.8

              \[\leadsto \frac{\sin ky}{\sin kx} \cdot \sin th \]
          10. Applied rewrites29.8%

            \[\leadsto \frac{\sin ky}{\color{blue}{\sin kx}} \cdot \sin th \]
        3. Recombined 3 regimes into one program.
        4. Add Preprocessing

        Alternative 11: 46.6% accurate, 1.0× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\sin kx \leq -0.135:\\ \;\;\;\;\left(ky \cdot \frac{1}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}}\right) \cdot \sin th\\ \mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-27}:\\ \;\;\;\;\sin th\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin ky}{\sin kx} \cdot \sin th\\ \end{array} \end{array} \]
        (FPCore (kx ky th)
         :precision binary64
         (if (<= (sin kx) -0.135)
           (* (* ky (/ 1.0 (sqrt (- 0.5 (* 0.5 (cos (+ kx kx))))))) (sin th))
           (if (<= (sin kx) 5e-27) (sin th) (* (/ (sin ky) (sin kx)) (sin th)))))
        double code(double kx, double ky, double th) {
        	double tmp;
        	if (sin(kx) <= -0.135) {
        		tmp = (ky * (1.0 / sqrt((0.5 - (0.5 * cos((kx + kx))))))) * sin(th);
        	} else if (sin(kx) <= 5e-27) {
        		tmp = sin(th);
        	} else {
        		tmp = (sin(ky) / sin(kx)) * sin(th);
        	}
        	return tmp;
        }
        
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(kx, ky, th)
        use fmin_fmax_functions
            real(8), intent (in) :: kx
            real(8), intent (in) :: ky
            real(8), intent (in) :: th
            real(8) :: tmp
            if (sin(kx) <= (-0.135d0)) then
                tmp = (ky * (1.0d0 / sqrt((0.5d0 - (0.5d0 * cos((kx + kx))))))) * sin(th)
            else if (sin(kx) <= 5d-27) then
                tmp = sin(th)
            else
                tmp = (sin(ky) / sin(kx)) * sin(th)
            end if
            code = tmp
        end function
        
        public static double code(double kx, double ky, double th) {
        	double tmp;
        	if (Math.sin(kx) <= -0.135) {
        		tmp = (ky * (1.0 / Math.sqrt((0.5 - (0.5 * Math.cos((kx + kx))))))) * Math.sin(th);
        	} else if (Math.sin(kx) <= 5e-27) {
        		tmp = Math.sin(th);
        	} else {
        		tmp = (Math.sin(ky) / Math.sin(kx)) * Math.sin(th);
        	}
        	return tmp;
        }
        
        def code(kx, ky, th):
        	tmp = 0
        	if math.sin(kx) <= -0.135:
        		tmp = (ky * (1.0 / math.sqrt((0.5 - (0.5 * math.cos((kx + kx))))))) * math.sin(th)
        	elif math.sin(kx) <= 5e-27:
        		tmp = math.sin(th)
        	else:
        		tmp = (math.sin(ky) / math.sin(kx)) * math.sin(th)
        	return tmp
        
        function code(kx, ky, th)
        	tmp = 0.0
        	if (sin(kx) <= -0.135)
        		tmp = Float64(Float64(ky * Float64(1.0 / sqrt(Float64(0.5 - Float64(0.5 * cos(Float64(kx + kx))))))) * sin(th));
        	elseif (sin(kx) <= 5e-27)
        		tmp = sin(th);
        	else
        		tmp = Float64(Float64(sin(ky) / sin(kx)) * sin(th));
        	end
        	return tmp
        end
        
        function tmp_2 = code(kx, ky, th)
        	tmp = 0.0;
        	if (sin(kx) <= -0.135)
        		tmp = (ky * (1.0 / sqrt((0.5 - (0.5 * cos((kx + kx))))))) * sin(th);
        	elseif (sin(kx) <= 5e-27)
        		tmp = sin(th);
        	else
        		tmp = (sin(ky) / sin(kx)) * sin(th);
        	end
        	tmp_2 = tmp;
        end
        
        code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.135], N[(N[(ky * N[(1.0 / N[Sqrt[N[(0.5 - N[(0.5 * N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-27], N[Sin[th], $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;\sin kx \leq -0.135:\\
        \;\;\;\;\left(ky \cdot \frac{1}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}}\right) \cdot \sin th\\
        
        \mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-27}:\\
        \;\;\;\;\sin th\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\sin ky}{\sin kx} \cdot \sin th\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if (sin.f64 kx) < -0.13500000000000001

          1. Initial program 99.4%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-sqrt.f64N/A

              \[\leadsto \frac{\sin ky}{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. pow1/2N/A

              \[\leadsto \frac{\sin ky}{\color{blue}{{\left({\sin kx}^{2} + {\sin ky}^{2}\right)}^{\frac{1}{2}}}} \cdot \sin th \]
            3. sqr-powN/A

              \[\leadsto \frac{\sin ky}{\color{blue}{{\left({\sin kx}^{2} + {\sin ky}^{2}\right)}^{\left(\frac{\frac{1}{2}}{2}\right)} \cdot {\left({\sin kx}^{2} + {\sin ky}^{2}\right)}^{\left(\frac{\frac{1}{2}}{2}\right)}}} \cdot \sin th \]
            4. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\color{blue}{{\left({\sin kx}^{2} + {\sin ky}^{2}\right)}^{\left(\frac{\frac{1}{2}}{2}\right)} \cdot {\left({\sin kx}^{2} + {\sin ky}^{2}\right)}^{\left(\frac{\frac{1}{2}}{2}\right)}}} \cdot \sin th \]
          3. Applied rewrites99.1%

            \[\leadsto \frac{\sin ky}{\color{blue}{{\left(\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}^{0.25} \cdot {\left(\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}^{0.25}}} \cdot \sin th \]
          4. Taylor expanded in ky around 0

            \[\leadsto \color{blue}{\left(ky \cdot \sqrt{\frac{1}{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}\right)} \cdot \sin th \]
          5. Step-by-step derivation
            1. lower-*.f64N/A

              \[\leadsto \left(ky \cdot \color{blue}{\sqrt{\frac{1}{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}}\right) \cdot \sin th \]
            2. sqrt-divN/A

              \[\leadsto \left(ky \cdot \frac{\sqrt{1}}{\color{blue}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}}\right) \cdot \sin th \]
            3. metadata-evalN/A

              \[\leadsto \left(ky \cdot \frac{1}{\sqrt{\color{blue}{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}}\right) \cdot \sin th \]
            4. lower-/.f64N/A

              \[\leadsto \left(ky \cdot \frac{1}{\color{blue}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}}\right) \cdot \sin th \]
            5. lower-sqrt.f64N/A

              \[\leadsto \left(ky \cdot \frac{1}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}\right) \cdot \sin th \]
            6. lift-cos.f64N/A

              \[\leadsto \left(ky \cdot \frac{1}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}\right) \cdot \sin th \]
            7. lift-*.f64N/A

              \[\leadsto \left(ky \cdot \frac{1}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}\right) \cdot \sin th \]
            8. lift-*.f64N/A

              \[\leadsto \left(ky \cdot \frac{1}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}\right) \cdot \sin th \]
            9. lift--.f6450.0

              \[\leadsto \left(ky \cdot \frac{1}{\sqrt{0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)}}\right) \cdot \sin th \]
            10. lift-*.f64N/A

              \[\leadsto \left(ky \cdot \frac{1}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}\right) \cdot \sin th \]
            11. count-2-revN/A

              \[\leadsto \left(ky \cdot \frac{1}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(kx + kx\right)}}\right) \cdot \sin th \]
            12. lift-+.f6450.0

              \[\leadsto \left(ky \cdot \frac{1}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}}\right) \cdot \sin th \]
          6. Applied rewrites50.0%

            \[\leadsto \color{blue}{\left(ky \cdot \frac{1}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}}\right)} \cdot \sin th \]

          if -0.13500000000000001 < (sin.f64 kx) < 5.0000000000000002e-27

          1. Initial program 88.9%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6488.9

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6470.7

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6454.4

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites54.4%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            6. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            9. lift-fma.f6472.9

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            10. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            11. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)}} \cdot \sin th \]
            12. lower-*.f6472.9

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)}} \cdot \sin th \]
            13. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            14. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            15. lower-+.f6472.9

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)}} \cdot \sin th \]
          5. Applied rewrites72.9%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)}}} \cdot \sin th \]
          6. Taylor expanded in kx around 0

            \[\leadsto \color{blue}{\sin th} \]
          7. Step-by-step derivation
            1. lift-sin.f6438.8

              \[\leadsto \sin th \]
          8. Applied rewrites38.8%

            \[\leadsto \color{blue}{\sin th} \]

          if 5.0000000000000002e-27 < (sin.f64 kx)

          1. Initial program 99.4%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6499.4

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6496.1

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites96.1%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. associate-+l-N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            4. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            5. lower--.f6496.1

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{\left(0.5 \cdot \cos \left(2 \cdot ky\right) - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            6. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            7. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot \frac{1}{2}} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            8. lower-*.f6496.1

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot 0.5} - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            9. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(2 \cdot ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            10. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            11. lower-+.f6496.1

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot 0.5 - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            12. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            13. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            14. lower-*.f6496.1

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)\right)}} \cdot \sin th \]
            15. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            16. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            17. lower-+.f6496.1

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)\right)}} \cdot \sin th \]
          5. Applied rewrites96.1%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \cdot \sin th \]
          6. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\left(\frac{1}{2} - \cos \left(kx + kx\right) \cdot \frac{1}{2}\right)}\right)}} \cdot \sin th \]
            2. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(kx + kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            3. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            5. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            6. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            7. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx \cdot \sin kx}\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx} \cdot \sin kx\right)}} \cdot \sin th \]
            9. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \sin kx \cdot \color{blue}{\sin kx}\right)}} \cdot \sin th \]
            10. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{{\sin kx}^{2}}\right)}} \cdot \sin th \]
            11. pow-to-expN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            12. lower-exp.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            13. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - e^{\color{blue}{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            14. lower-log.f6496.1

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - e^{\color{blue}{\log \sin kx} \cdot 2}\right)}} \cdot \sin th \]
          7. Applied rewrites96.1%

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          8. Taylor expanded in ky around 0

            \[\leadsto \frac{\sin ky}{\color{blue}{\sin kx}} \cdot \sin th \]
          9. Step-by-step derivation
            1. lift-sin.f6460.3

              \[\leadsto \frac{\sin ky}{\sin kx} \cdot \sin th \]
          10. Applied rewrites60.3%

            \[\leadsto \frac{\sin ky}{\color{blue}{\sin kx}} \cdot \sin th \]
        3. Recombined 3 regimes into one program.
        4. Add Preprocessing

        Alternative 12: 46.5% accurate, 0.5× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\ \mathbf{if}\;t\_1 \leq 5 \cdot 10^{-5}:\\ \;\;\;\;\left(ky \cdot \frac{1}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}}\right) \cdot \sin th\\ \mathbf{elif}\;t\_1 \leq 2:\\ \;\;\;\;\sin th\\ \mathbf{else}:\\ \;\;\;\;\frac{ky}{\sin kx} \cdot \sin th\\ \end{array} \end{array} \]
        (FPCore (kx ky th)
         :precision binary64
         (let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
           (if (<= t_1 5e-5)
             (* (* ky (/ 1.0 (sqrt (- 0.5 (* 0.5 (cos (+ kx kx))))))) (sin th))
             (if (<= t_1 2.0) (sin th) (* (/ ky (sin kx)) (sin th))))))
        double code(double kx, double ky, double th) {
        	double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
        	double tmp;
        	if (t_1 <= 5e-5) {
        		tmp = (ky * (1.0 / sqrt((0.5 - (0.5 * cos((kx + kx))))))) * sin(th);
        	} else if (t_1 <= 2.0) {
        		tmp = sin(th);
        	} else {
        		tmp = (ky / sin(kx)) * sin(th);
        	}
        	return tmp;
        }
        
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(kx, ky, th)
        use fmin_fmax_functions
            real(8), intent (in) :: kx
            real(8), intent (in) :: ky
            real(8), intent (in) :: th
            real(8) :: t_1
            real(8) :: tmp
            t_1 = sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))
            if (t_1 <= 5d-5) then
                tmp = (ky * (1.0d0 / sqrt((0.5d0 - (0.5d0 * cos((kx + kx))))))) * sin(th)
            else if (t_1 <= 2.0d0) then
                tmp = sin(th)
            else
                tmp = (ky / sin(kx)) * sin(th)
            end if
            code = tmp
        end function
        
        public static double code(double kx, double ky, double th) {
        	double t_1 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
        	double tmp;
        	if (t_1 <= 5e-5) {
        		tmp = (ky * (1.0 / Math.sqrt((0.5 - (0.5 * Math.cos((kx + kx))))))) * Math.sin(th);
        	} else if (t_1 <= 2.0) {
        		tmp = Math.sin(th);
        	} else {
        		tmp = (ky / Math.sin(kx)) * Math.sin(th);
        	}
        	return tmp;
        }
        
        def code(kx, ky, th):
        	t_1 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))
        	tmp = 0
        	if t_1 <= 5e-5:
        		tmp = (ky * (1.0 / math.sqrt((0.5 - (0.5 * math.cos((kx + kx))))))) * math.sin(th)
        	elif t_1 <= 2.0:
        		tmp = math.sin(th)
        	else:
        		tmp = (ky / math.sin(kx)) * math.sin(th)
        	return tmp
        
        function code(kx, ky, th)
        	t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))
        	tmp = 0.0
        	if (t_1 <= 5e-5)
        		tmp = Float64(Float64(ky * Float64(1.0 / sqrt(Float64(0.5 - Float64(0.5 * cos(Float64(kx + kx))))))) * sin(th));
        	elseif (t_1 <= 2.0)
        		tmp = sin(th);
        	else
        		tmp = Float64(Float64(ky / sin(kx)) * sin(th));
        	end
        	return tmp
        end
        
        function tmp_2 = code(kx, ky, th)
        	t_1 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)));
        	tmp = 0.0;
        	if (t_1 <= 5e-5)
        		tmp = (ky * (1.0 / sqrt((0.5 - (0.5 * cos((kx + kx))))))) * sin(th);
        	elseif (t_1 <= 2.0)
        		tmp = sin(th);
        	else
        		tmp = (ky / sin(kx)) * sin(th);
        	end
        	tmp_2 = tmp;
        end
        
        code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-5], N[(N[(ky * N[(1.0 / N[Sqrt[N[(0.5 - N[(0.5 * N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[Sin[th], $MachinePrecision], N[(N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
        \mathbf{if}\;t\_1 \leq 5 \cdot 10^{-5}:\\
        \;\;\;\;\left(ky \cdot \frac{1}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}}\right) \cdot \sin th\\
        
        \mathbf{elif}\;t\_1 \leq 2:\\
        \;\;\;\;\sin th\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{ky}{\sin kx} \cdot \sin th\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 5.00000000000000024e-5

          1. Initial program 95.2%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-sqrt.f64N/A

              \[\leadsto \frac{\sin ky}{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. pow1/2N/A

              \[\leadsto \frac{\sin ky}{\color{blue}{{\left({\sin kx}^{2} + {\sin ky}^{2}\right)}^{\frac{1}{2}}}} \cdot \sin th \]
            3. sqr-powN/A

              \[\leadsto \frac{\sin ky}{\color{blue}{{\left({\sin kx}^{2} + {\sin ky}^{2}\right)}^{\left(\frac{\frac{1}{2}}{2}\right)} \cdot {\left({\sin kx}^{2} + {\sin ky}^{2}\right)}^{\left(\frac{\frac{1}{2}}{2}\right)}}} \cdot \sin th \]
            4. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\color{blue}{{\left({\sin kx}^{2} + {\sin ky}^{2}\right)}^{\left(\frac{\frac{1}{2}}{2}\right)} \cdot {\left({\sin kx}^{2} + {\sin ky}^{2}\right)}^{\left(\frac{\frac{1}{2}}{2}\right)}}} \cdot \sin th \]
          3. Applied rewrites75.3%

            \[\leadsto \frac{\sin ky}{\color{blue}{{\left(\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}^{0.25} \cdot {\left(\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}^{0.25}}} \cdot \sin th \]
          4. Taylor expanded in ky around 0

            \[\leadsto \color{blue}{\left(ky \cdot \sqrt{\frac{1}{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}\right)} \cdot \sin th \]
          5. Step-by-step derivation
            1. lower-*.f64N/A

              \[\leadsto \left(ky \cdot \color{blue}{\sqrt{\frac{1}{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}}\right) \cdot \sin th \]
            2. sqrt-divN/A

              \[\leadsto \left(ky \cdot \frac{\sqrt{1}}{\color{blue}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}}\right) \cdot \sin th \]
            3. metadata-evalN/A

              \[\leadsto \left(ky \cdot \frac{1}{\sqrt{\color{blue}{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}}\right) \cdot \sin th \]
            4. lower-/.f64N/A

              \[\leadsto \left(ky \cdot \frac{1}{\color{blue}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}}\right) \cdot \sin th \]
            5. lower-sqrt.f64N/A

              \[\leadsto \left(ky \cdot \frac{1}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}\right) \cdot \sin th \]
            6. lift-cos.f64N/A

              \[\leadsto \left(ky \cdot \frac{1}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}\right) \cdot \sin th \]
            7. lift-*.f64N/A

              \[\leadsto \left(ky \cdot \frac{1}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}\right) \cdot \sin th \]
            8. lift-*.f64N/A

              \[\leadsto \left(ky \cdot \frac{1}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}\right) \cdot \sin th \]
            9. lift--.f6438.4

              \[\leadsto \left(ky \cdot \frac{1}{\sqrt{0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)}}\right) \cdot \sin th \]
            10. lift-*.f64N/A

              \[\leadsto \left(ky \cdot \frac{1}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}\right) \cdot \sin th \]
            11. count-2-revN/A

              \[\leadsto \left(ky \cdot \frac{1}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(kx + kx\right)}}\right) \cdot \sin th \]
            12. lift-+.f6438.4

              \[\leadsto \left(ky \cdot \frac{1}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}}\right) \cdot \sin th \]
          6. Applied rewrites38.4%

            \[\leadsto \color{blue}{\left(ky \cdot \frac{1}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}}\right)} \cdot \sin th \]

          if 5.00000000000000024e-5 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2

          1. Initial program 99.5%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6499.5

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6483.7

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6483.3

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites83.3%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            6. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            9. lift-fma.f6499.1

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            10. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            11. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)}} \cdot \sin th \]
            12. lower-*.f6499.1

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)}} \cdot \sin th \]
            13. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            14. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            15. lower-+.f6499.1

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)}} \cdot \sin th \]
          5. Applied rewrites99.1%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)}}} \cdot \sin th \]
          6. Taylor expanded in kx around 0

            \[\leadsto \color{blue}{\sin th} \]
          7. Step-by-step derivation
            1. lift-sin.f6466.6

              \[\leadsto \sin th \]
          8. Applied rewrites66.6%

            \[\leadsto \color{blue}{\sin th} \]

          if 2 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64)))))

          1. Initial program 2.6%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites2.6%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. associate-+l-N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            4. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            5. lower--.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{\left(0.5 \cdot \cos \left(2 \cdot ky\right) - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            6. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            7. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot \frac{1}{2}} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            8. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot 0.5} - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            9. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(2 \cdot ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            10. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            11. lower-+.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot 0.5 - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            12. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            13. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            14. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)\right)}} \cdot \sin th \]
            15. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            16. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            17. lower-+.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)\right)}} \cdot \sin th \]
          5. Applied rewrites2.6%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \cdot \sin th \]
          6. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\left(\frac{1}{2} - \cos \left(kx + kx\right) \cdot \frac{1}{2}\right)}\right)}} \cdot \sin th \]
            2. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(kx + kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            3. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            5. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            6. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            7. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx \cdot \sin kx}\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx} \cdot \sin kx\right)}} \cdot \sin th \]
            9. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \sin kx \cdot \color{blue}{\sin kx}\right)}} \cdot \sin th \]
            10. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{{\sin kx}^{2}}\right)}} \cdot \sin th \]
            11. pow-to-expN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            12. lower-exp.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            13. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - e^{\color{blue}{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            14. lower-log.f641.5

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - e^{\color{blue}{\log \sin kx} \cdot 2}\right)}} \cdot \sin th \]
          7. Applied rewrites1.5%

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          8. Taylor expanded in ky around 0

            \[\leadsto \color{blue}{\frac{ky}{\sin kx}} \cdot \sin th \]
          9. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \frac{ky}{\color{blue}{\sin kx}} \cdot \sin th \]
            2. lift-sin.f6429.8

              \[\leadsto \frac{ky}{\sin kx} \cdot \sin th \]
          10. Applied rewrites29.8%

            \[\leadsto \color{blue}{\frac{ky}{\sin kx}} \cdot \sin th \]
        3. Recombined 3 regimes into one program.
        4. Add Preprocessing

        Alternative 13: 46.0% accurate, 0.5× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\ \mathbf{if}\;t\_1 \leq 5 \cdot 10^{-5}:\\ \;\;\;\;\left(ky \cdot \sin th\right) \cdot \frac{1}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}}\\ \mathbf{elif}\;t\_1 \leq 2:\\ \;\;\;\;\sin th\\ \mathbf{else}:\\ \;\;\;\;\frac{ky}{\sin kx} \cdot \sin th\\ \end{array} \end{array} \]
        (FPCore (kx ky th)
         :precision binary64
         (let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
           (if (<= t_1 5e-5)
             (* (* ky (sin th)) (/ 1.0 (sqrt (- 0.5 (* 0.5 (cos (+ kx kx)))))))
             (if (<= t_1 2.0) (sin th) (* (/ ky (sin kx)) (sin th))))))
        double code(double kx, double ky, double th) {
        	double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
        	double tmp;
        	if (t_1 <= 5e-5) {
        		tmp = (ky * sin(th)) * (1.0 / sqrt((0.5 - (0.5 * cos((kx + kx))))));
        	} else if (t_1 <= 2.0) {
        		tmp = sin(th);
        	} else {
        		tmp = (ky / sin(kx)) * sin(th);
        	}
        	return tmp;
        }
        
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(kx, ky, th)
        use fmin_fmax_functions
            real(8), intent (in) :: kx
            real(8), intent (in) :: ky
            real(8), intent (in) :: th
            real(8) :: t_1
            real(8) :: tmp
            t_1 = sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))
            if (t_1 <= 5d-5) then
                tmp = (ky * sin(th)) * (1.0d0 / sqrt((0.5d0 - (0.5d0 * cos((kx + kx))))))
            else if (t_1 <= 2.0d0) then
                tmp = sin(th)
            else
                tmp = (ky / sin(kx)) * sin(th)
            end if
            code = tmp
        end function
        
        public static double code(double kx, double ky, double th) {
        	double t_1 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
        	double tmp;
        	if (t_1 <= 5e-5) {
        		tmp = (ky * Math.sin(th)) * (1.0 / Math.sqrt((0.5 - (0.5 * Math.cos((kx + kx))))));
        	} else if (t_1 <= 2.0) {
        		tmp = Math.sin(th);
        	} else {
        		tmp = (ky / Math.sin(kx)) * Math.sin(th);
        	}
        	return tmp;
        }
        
        def code(kx, ky, th):
        	t_1 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))
        	tmp = 0
        	if t_1 <= 5e-5:
        		tmp = (ky * math.sin(th)) * (1.0 / math.sqrt((0.5 - (0.5 * math.cos((kx + kx))))))
        	elif t_1 <= 2.0:
        		tmp = math.sin(th)
        	else:
        		tmp = (ky / math.sin(kx)) * math.sin(th)
        	return tmp
        
        function code(kx, ky, th)
        	t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))
        	tmp = 0.0
        	if (t_1 <= 5e-5)
        		tmp = Float64(Float64(ky * sin(th)) * Float64(1.0 / sqrt(Float64(0.5 - Float64(0.5 * cos(Float64(kx + kx)))))));
        	elseif (t_1 <= 2.0)
        		tmp = sin(th);
        	else
        		tmp = Float64(Float64(ky / sin(kx)) * sin(th));
        	end
        	return tmp
        end
        
        function tmp_2 = code(kx, ky, th)
        	t_1 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)));
        	tmp = 0.0;
        	if (t_1 <= 5e-5)
        		tmp = (ky * sin(th)) * (1.0 / sqrt((0.5 - (0.5 * cos((kx + kx))))));
        	elseif (t_1 <= 2.0)
        		tmp = sin(th);
        	else
        		tmp = (ky / sin(kx)) * sin(th);
        	end
        	tmp_2 = tmp;
        end
        
        code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-5], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(0.5 - N[(0.5 * N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[Sin[th], $MachinePrecision], N[(N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
        \mathbf{if}\;t\_1 \leq 5 \cdot 10^{-5}:\\
        \;\;\;\;\left(ky \cdot \sin th\right) \cdot \frac{1}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}}\\
        
        \mathbf{elif}\;t\_1 \leq 2:\\
        \;\;\;\;\sin th\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{ky}{\sin kx} \cdot \sin th\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 5.00000000000000024e-5

          1. Initial program 95.2%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-*.f64N/A

              \[\leadsto \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th} \]
            2. lift-/.f64N/A

              \[\leadsto \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            3. associate-*l/N/A

              \[\leadsto \color{blue}{\frac{\sin ky \cdot \sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
            4. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{\sin ky \cdot \sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
            5. *-commutativeN/A

              \[\leadsto \frac{\color{blue}{\sin th \cdot \sin ky}}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \]
            6. lower-*.f6493.2

              \[\leadsto \frac{\color{blue}{\sin th \cdot \sin ky}}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \]
            7. lift-sqrt.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
            8. lift-+.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
            9. lift-pow.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{{\sin kx}^{2}} + {\sin ky}^{2}}} \]
            10. unpow2N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\sin kx \cdot \sin kx} + {\sin ky}^{2}}} \]
            11. lift-pow.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\sin kx \cdot \sin kx + \color{blue}{{\sin ky}^{2}}}} \]
            12. unpow2N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\sin kx \cdot \sin kx + \color{blue}{\sin ky \cdot \sin ky}}} \]
            13. lower-hypot.f6496.3

              \[\leadsto \frac{\sin th \cdot \sin ky}{\color{blue}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}} \]
          3. Applied rewrites96.3%

            \[\leadsto \color{blue}{\frac{\sin th \cdot \sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}} \]
          4. Step-by-step derivation
            1. lift-hypot.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\color{blue}{\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}}} \]
            2. lift-sin.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\sin kx} \cdot \sin kx + \sin ky \cdot \sin ky}} \]
            3. lift-sin.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\sin kx \cdot \color{blue}{\sin kx} + \sin ky \cdot \sin ky}} \]
            4. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)} + \sin ky \cdot \sin ky}} \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right) + \sin ky \cdot \sin ky}} \]
            6. lift-cos.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right) + \sin ky \cdot \sin ky}} \]
            7. lift-*.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right) + \sin ky \cdot \sin ky}} \]
            8. lift--.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)} + \sin ky \cdot \sin ky}} \]
            9. lift-sin.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \color{blue}{\sin ky} \cdot \sin ky}} \]
            10. lift-sin.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \sin ky \cdot \color{blue}{\sin ky}}} \]
            11. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}}} \]
            12. lift-*.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right)}} \]
            13. lift-cos.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right)}} \]
            14. lift-*.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right)}} \]
            15. lift--.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)}}} \]
            16. +-commutativeN/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \]
            17. lift--.f64N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \]
            18. associate-+l-N/A

              \[\leadsto \frac{\sin th \cdot \sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \]
          5. Applied rewrites75.4%

            \[\leadsto \frac{\sin th \cdot \sin ky}{\color{blue}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \]
          6. Taylor expanded in ky around 0

            \[\leadsto \color{blue}{\left(ky \cdot \sin th\right) \cdot \sqrt{\frac{1}{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}} \]
          7. Step-by-step derivation
            1. lower-*.f64N/A

              \[\leadsto \left(ky \cdot \sin th\right) \cdot \color{blue}{\sqrt{\frac{1}{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}} \]
            2. lower-*.f64N/A

              \[\leadsto \left(ky \cdot \sin th\right) \cdot \sqrt{\color{blue}{\frac{1}{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}} \]
            3. lift-sin.f64N/A

              \[\leadsto \left(ky \cdot \sin th\right) \cdot \sqrt{\frac{1}{\color{blue}{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}} \]
            4. sqrt-divN/A

              \[\leadsto \left(ky \cdot \sin th\right) \cdot \frac{\sqrt{1}}{\color{blue}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}} \]
            5. metadata-evalN/A

              \[\leadsto \left(ky \cdot \sin th\right) \cdot \frac{1}{\sqrt{\color{blue}{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}} \]
            6. lower-/.f64N/A

              \[\leadsto \left(ky \cdot \sin th\right) \cdot \frac{1}{\color{blue}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}}} \]
            7. lower-sqrt.f64N/A

              \[\leadsto \left(ky \cdot \sin th\right) \cdot \frac{1}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \]
            8. lift-cos.f64N/A

              \[\leadsto \left(ky \cdot \sin th\right) \cdot \frac{1}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \]
            9. lift-*.f64N/A

              \[\leadsto \left(ky \cdot \sin th\right) \cdot \frac{1}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \]
            10. lift-*.f64N/A

              \[\leadsto \left(ky \cdot \sin th\right) \cdot \frac{1}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \]
            11. lift--.f6438.3

              \[\leadsto \left(ky \cdot \sin th\right) \cdot \frac{1}{\sqrt{0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)}} \]
            12. lift-*.f64N/A

              \[\leadsto \left(ky \cdot \sin th\right) \cdot \frac{1}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}} \]
            13. count-2-revN/A

              \[\leadsto \left(ky \cdot \sin th\right) \cdot \frac{1}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(kx + kx\right)}} \]
            14. lift-+.f6438.3

              \[\leadsto \left(ky \cdot \sin th\right) \cdot \frac{1}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}} \]
          8. Applied rewrites38.3%

            \[\leadsto \color{blue}{\left(ky \cdot \sin th\right) \cdot \frac{1}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx + kx\right)}}} \]

          if 5.00000000000000024e-5 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2

          1. Initial program 99.5%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6499.5

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6483.7

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6483.3

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites83.3%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            6. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            9. lift-fma.f6499.1

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            10. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            11. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)}} \cdot \sin th \]
            12. lower-*.f6499.1

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)}} \cdot \sin th \]
            13. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            14. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            15. lower-+.f6499.1

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)}} \cdot \sin th \]
          5. Applied rewrites99.1%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)}}} \cdot \sin th \]
          6. Taylor expanded in kx around 0

            \[\leadsto \color{blue}{\sin th} \]
          7. Step-by-step derivation
            1. lift-sin.f6466.6

              \[\leadsto \sin th \]
          8. Applied rewrites66.6%

            \[\leadsto \color{blue}{\sin th} \]

          if 2 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64)))))

          1. Initial program 2.6%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites2.6%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. associate-+l-N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            4. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            5. lower--.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{\left(0.5 \cdot \cos \left(2 \cdot ky\right) - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            6. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            7. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot \frac{1}{2}} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            8. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot 0.5} - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            9. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(2 \cdot ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            10. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            11. lower-+.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot 0.5 - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            12. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            13. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            14. lower-*.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)\right)}} \cdot \sin th \]
            15. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            16. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            17. lower-+.f642.6

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)\right)}} \cdot \sin th \]
          5. Applied rewrites2.6%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \cdot \sin th \]
          6. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\left(\frac{1}{2} - \cos \left(kx + kx\right) \cdot \frac{1}{2}\right)}\right)}} \cdot \sin th \]
            2. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(kx + kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            3. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            5. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            6. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            7. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx \cdot \sin kx}\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx} \cdot \sin kx\right)}} \cdot \sin th \]
            9. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \sin kx \cdot \color{blue}{\sin kx}\right)}} \cdot \sin th \]
            10. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{{\sin kx}^{2}}\right)}} \cdot \sin th \]
            11. pow-to-expN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            12. lower-exp.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            13. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - e^{\color{blue}{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            14. lower-log.f641.5

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - e^{\color{blue}{\log \sin kx} \cdot 2}\right)}} \cdot \sin th \]
          7. Applied rewrites1.5%

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          8. Taylor expanded in ky around 0

            \[\leadsto \color{blue}{\frac{ky}{\sin kx}} \cdot \sin th \]
          9. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \frac{ky}{\color{blue}{\sin kx}} \cdot \sin th \]
            2. lift-sin.f6429.8

              \[\leadsto \frac{ky}{\sin kx} \cdot \sin th \]
          10. Applied rewrites29.8%

            \[\leadsto \color{blue}{\frac{ky}{\sin kx}} \cdot \sin th \]
        3. Recombined 3 regimes into one program.
        4. Add Preprocessing

        Alternative 14: 43.8% accurate, 0.5× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{ky}{\sin kx} \cdot \sin th\\ t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\ \mathbf{if}\;t\_2 \leq 0.04:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 2:\\ \;\;\;\;\sin th\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
        (FPCore (kx ky th)
         :precision binary64
         (let* ((t_1 (* (/ ky (sin kx)) (sin th)))
                (t_2 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
           (if (<= t_2 0.04) t_1 (if (<= t_2 2.0) (sin th) t_1))))
        double code(double kx, double ky, double th) {
        	double t_1 = (ky / sin(kx)) * sin(th);
        	double t_2 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
        	double tmp;
        	if (t_2 <= 0.04) {
        		tmp = t_1;
        	} else if (t_2 <= 2.0) {
        		tmp = sin(th);
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(kx, ky, th)
        use fmin_fmax_functions
            real(8), intent (in) :: kx
            real(8), intent (in) :: ky
            real(8), intent (in) :: th
            real(8) :: t_1
            real(8) :: t_2
            real(8) :: tmp
            t_1 = (ky / sin(kx)) * sin(th)
            t_2 = sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))
            if (t_2 <= 0.04d0) then
                tmp = t_1
            else if (t_2 <= 2.0d0) then
                tmp = sin(th)
            else
                tmp = t_1
            end if
            code = tmp
        end function
        
        public static double code(double kx, double ky, double th) {
        	double t_1 = (ky / Math.sin(kx)) * Math.sin(th);
        	double t_2 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
        	double tmp;
        	if (t_2 <= 0.04) {
        		tmp = t_1;
        	} else if (t_2 <= 2.0) {
        		tmp = Math.sin(th);
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        def code(kx, ky, th):
        	t_1 = (ky / math.sin(kx)) * math.sin(th)
        	t_2 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))
        	tmp = 0
        	if t_2 <= 0.04:
        		tmp = t_1
        	elif t_2 <= 2.0:
        		tmp = math.sin(th)
        	else:
        		tmp = t_1
        	return tmp
        
        function code(kx, ky, th)
        	t_1 = Float64(Float64(ky / sin(kx)) * sin(th))
        	t_2 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))
        	tmp = 0.0
        	if (t_2 <= 0.04)
        		tmp = t_1;
        	elseif (t_2 <= 2.0)
        		tmp = sin(th);
        	else
        		tmp = t_1;
        	end
        	return tmp
        end
        
        function tmp_2 = code(kx, ky, th)
        	t_1 = (ky / sin(kx)) * sin(th);
        	t_2 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)));
        	tmp = 0.0;
        	if (t_2 <= 0.04)
        		tmp = t_1;
        	elseif (t_2 <= 2.0)
        		tmp = sin(th);
        	else
        		tmp = t_1;
        	end
        	tmp_2 = tmp;
        end
        
        code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 0.04], t$95$1, If[LessEqual[t$95$2, 2.0], N[Sin[th], $MachinePrecision], t$95$1]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := \frac{ky}{\sin kx} \cdot \sin th\\
        t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
        \mathbf{if}\;t\_2 \leq 0.04:\\
        \;\;\;\;t\_1\\
        
        \mathbf{elif}\;t\_2 \leq 2:\\
        \;\;\;\;\sin th\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_1\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.0400000000000000008 or 2 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64)))))

          1. Initial program 91.9%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6491.9

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6485.5

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6472.9

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites72.9%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. associate-+l-N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            4. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            5. lower--.f6472.9

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{\left(0.5 \cdot \cos \left(2 \cdot ky\right) - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            6. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            7. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot \frac{1}{2}} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            8. lower-*.f6472.9

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot 0.5} - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            9. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(2 \cdot ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            10. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            11. lower-+.f6472.9

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot 0.5 - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            12. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            13. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            14. lower-*.f6472.9

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)\right)}} \cdot \sin th \]
            15. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            16. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            17. lower-+.f6472.9

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)\right)}} \cdot \sin th \]
          5. Applied rewrites72.9%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \cdot \sin th \]
          6. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\left(\frac{1}{2} - \cos \left(kx + kx\right) \cdot \frac{1}{2}\right)}\right)}} \cdot \sin th \]
            2. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(kx + kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            3. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            5. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            6. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            7. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx \cdot \sin kx}\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx} \cdot \sin kx\right)}} \cdot \sin th \]
            9. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \sin kx \cdot \color{blue}{\sin kx}\right)}} \cdot \sin th \]
            10. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{{\sin kx}^{2}}\right)}} \cdot \sin th \]
            11. pow-to-expN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            12. lower-exp.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            13. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - e^{\color{blue}{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            14. lower-log.f6436.7

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - e^{\color{blue}{\log \sin kx} \cdot 2}\right)}} \cdot \sin th \]
          7. Applied rewrites36.7%

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          8. Taylor expanded in ky around 0

            \[\leadsto \color{blue}{\frac{ky}{\sin kx}} \cdot \sin th \]
          9. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \frac{ky}{\color{blue}{\sin kx}} \cdot \sin th \]
            2. lift-sin.f6434.1

              \[\leadsto \frac{ky}{\sin kx} \cdot \sin th \]
          10. Applied rewrites34.1%

            \[\leadsto \color{blue}{\frac{ky}{\sin kx}} \cdot \sin th \]

          if 0.0400000000000000008 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2

          1. Initial program 99.5%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6499.5

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6483.7

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6483.3

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites83.3%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            6. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            9. lift-fma.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            10. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            11. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)}} \cdot \sin th \]
            12. lower-*.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)}} \cdot \sin th \]
            13. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            14. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            15. lower-+.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)}} \cdot \sin th \]
          5. Applied rewrites99.2%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)}}} \cdot \sin th \]
          6. Taylor expanded in kx around 0

            \[\leadsto \color{blue}{\sin th} \]
          7. Step-by-step derivation
            1. lift-sin.f6467.1

              \[\leadsto \sin th \]
          8. Applied rewrites67.1%

            \[\leadsto \color{blue}{\sin th} \]
        3. Recombined 2 regimes into one program.
        4. Add Preprocessing

        Alternative 15: 43.1% accurate, 0.5× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{ky \cdot \sin th}{\sin kx}\\ t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\ \mathbf{if}\;t\_2 \leq 0.04:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 2:\\ \;\;\;\;\sin th\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
        (FPCore (kx ky th)
         :precision binary64
         (let* ((t_1 (/ (* ky (sin th)) (sin kx)))
                (t_2 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
           (if (<= t_2 0.04) t_1 (if (<= t_2 2.0) (sin th) t_1))))
        double code(double kx, double ky, double th) {
        	double t_1 = (ky * sin(th)) / sin(kx);
        	double t_2 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
        	double tmp;
        	if (t_2 <= 0.04) {
        		tmp = t_1;
        	} else if (t_2 <= 2.0) {
        		tmp = sin(th);
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(kx, ky, th)
        use fmin_fmax_functions
            real(8), intent (in) :: kx
            real(8), intent (in) :: ky
            real(8), intent (in) :: th
            real(8) :: t_1
            real(8) :: t_2
            real(8) :: tmp
            t_1 = (ky * sin(th)) / sin(kx)
            t_2 = sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))
            if (t_2 <= 0.04d0) then
                tmp = t_1
            else if (t_2 <= 2.0d0) then
                tmp = sin(th)
            else
                tmp = t_1
            end if
            code = tmp
        end function
        
        public static double code(double kx, double ky, double th) {
        	double t_1 = (ky * Math.sin(th)) / Math.sin(kx);
        	double t_2 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
        	double tmp;
        	if (t_2 <= 0.04) {
        		tmp = t_1;
        	} else if (t_2 <= 2.0) {
        		tmp = Math.sin(th);
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        def code(kx, ky, th):
        	t_1 = (ky * math.sin(th)) / math.sin(kx)
        	t_2 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))
        	tmp = 0
        	if t_2 <= 0.04:
        		tmp = t_1
        	elif t_2 <= 2.0:
        		tmp = math.sin(th)
        	else:
        		tmp = t_1
        	return tmp
        
        function code(kx, ky, th)
        	t_1 = Float64(Float64(ky * sin(th)) / sin(kx))
        	t_2 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))
        	tmp = 0.0
        	if (t_2 <= 0.04)
        		tmp = t_1;
        	elseif (t_2 <= 2.0)
        		tmp = sin(th);
        	else
        		tmp = t_1;
        	end
        	return tmp
        end
        
        function tmp_2 = code(kx, ky, th)
        	t_1 = (ky * sin(th)) / sin(kx);
        	t_2 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)));
        	tmp = 0.0;
        	if (t_2 <= 0.04)
        		tmp = t_1;
        	elseif (t_2 <= 2.0)
        		tmp = sin(th);
        	else
        		tmp = t_1;
        	end
        	tmp_2 = tmp;
        end
        
        code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 0.04], t$95$1, If[LessEqual[t$95$2, 2.0], N[Sin[th], $MachinePrecision], t$95$1]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := \frac{ky \cdot \sin th}{\sin kx}\\
        t_2 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
        \mathbf{if}\;t\_2 \leq 0.04:\\
        \;\;\;\;t\_1\\
        
        \mathbf{elif}\;t\_2 \leq 2:\\
        \;\;\;\;\sin th\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_1\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.0400000000000000008 or 2 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64)))))

          1. Initial program 91.9%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6491.9

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6485.5

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6472.9

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites72.9%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. associate-+l-N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            4. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\frac{1}{2} - \left(\frac{1}{2} \cdot \cos \left(2 \cdot ky\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            5. lower--.f6472.9

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \color{blue}{\left(0.5 \cdot \cos \left(2 \cdot ky\right) - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}}} \cdot \sin th \]
            6. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            7. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot \frac{1}{2}} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            8. lower-*.f6472.9

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\color{blue}{\cos \left(2 \cdot ky\right) \cdot 0.5} - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            9. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(2 \cdot ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            10. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            11. lower-+.f6472.9

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \color{blue}{\left(ky + ky\right)} \cdot 0.5 - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)\right)}} \cdot \sin th \]
            12. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            13. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            14. lower-*.f6472.9

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)\right)}} \cdot \sin th \]
            15. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            16. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)\right)}} \cdot \sin th \]
            17. lower-+.f6472.9

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)\right)}} \cdot \sin th \]
          5. Applied rewrites72.9%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)\right)}}} \cdot \sin th \]
          6. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\left(\frac{1}{2} - \cos \left(kx + kx\right) \cdot \frac{1}{2}\right)}\right)}} \cdot \sin th \]
            2. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\cos \left(kx + kx\right) \cdot \frac{1}{2}}\right)\right)}} \cdot \sin th \]
            3. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            5. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(kx + kx\right)}\right)\right)}} \cdot \sin th \]
            6. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)\right)}} \cdot \sin th \]
            7. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx \cdot \sin kx}\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{\sin kx} \cdot \sin kx\right)}} \cdot \sin th \]
            9. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \sin kx \cdot \color{blue}{\sin kx}\right)}} \cdot \sin th \]
            10. pow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{{\sin kx}^{2}}\right)}} \cdot \sin th \]
            11. pow-to-expN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            12. lower-exp.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            13. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\frac{1}{2} - \left(\cos \left(ky + ky\right) \cdot \frac{1}{2} - e^{\color{blue}{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
            14. lower-log.f6436.7

              \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - e^{\color{blue}{\log \sin kx} \cdot 2}\right)}} \cdot \sin th \]
          7. Applied rewrites36.7%

            \[\leadsto \frac{\sin ky}{\sqrt{0.5 - \left(\cos \left(ky + ky\right) \cdot 0.5 - \color{blue}{e^{\log \sin kx \cdot 2}}\right)}} \cdot \sin th \]
          8. Taylor expanded in ky around 0

            \[\leadsto \color{blue}{\frac{ky \cdot \sin th}{\sin kx}} \]
          9. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \frac{ky \cdot \sin th}{\color{blue}{\sin kx}} \]
            2. lower-*.f64N/A

              \[\leadsto \frac{ky \cdot \sin th}{\sin \color{blue}{kx}} \]
            3. lift-sin.f64N/A

              \[\leadsto \frac{ky \cdot \sin th}{\sin kx} \]
            4. lift-sin.f6433.1

              \[\leadsto \frac{ky \cdot \sin th}{\sin kx} \]
          10. Applied rewrites33.1%

            \[\leadsto \color{blue}{\frac{ky \cdot \sin th}{\sin kx}} \]

          if 0.0400000000000000008 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 2

          1. Initial program 99.5%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
            2. +-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            3. lower-+.f6499.5

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
            4. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
            5. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            6. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
            8. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            9. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
            10. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            11. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            12. lower-*.f6483.7

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
            13. lift-pow.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
            14. unpow2N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
            15. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
            16. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
            17. sqr-sin-aN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            18. lower--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            19. lower-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            20. lower-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            21. lower-*.f6483.3

              \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          3. Applied rewrites83.3%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          4. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            2. lift--.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            3. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            4. lift-cos.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            6. sqr-sin-a-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            7. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            8. lift-sin.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
            9. lift-fma.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
            10. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
            11. *-commutativeN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)}} \cdot \sin th \]
            12. lower-*.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)}} \cdot \sin th \]
            13. lift-*.f64N/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            14. count-2-revN/A

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
            15. lower-+.f6499.2

              \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)}} \cdot \sin th \]
          5. Applied rewrites99.2%

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)}}} \cdot \sin th \]
          6. Taylor expanded in kx around 0

            \[\leadsto \color{blue}{\sin th} \]
          7. Step-by-step derivation
            1. lift-sin.f6467.1

              \[\leadsto \sin th \]
          8. Applied rewrites67.1%

            \[\leadsto \color{blue}{\sin th} \]
        3. Recombined 2 regimes into one program.
        4. Add Preprocessing

        Alternative 16: 23.7% accurate, 5.2× speedup?

        \[\begin{array}{l} \\ \sin th \end{array} \]
        (FPCore (kx ky th) :precision binary64 (sin th))
        double code(double kx, double ky, double th) {
        	return sin(th);
        }
        
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(kx, ky, th)
        use fmin_fmax_functions
            real(8), intent (in) :: kx
            real(8), intent (in) :: ky
            real(8), intent (in) :: th
            code = sin(th)
        end function
        
        public static double code(double kx, double ky, double th) {
        	return Math.sin(th);
        }
        
        def code(kx, ky, th):
        	return math.sin(th)
        
        function code(kx, ky, th)
        	return sin(th)
        end
        
        function tmp = code(kx, ky, th)
        	tmp = sin(th);
        end
        
        code[kx_, ky_, th_] := N[Sin[th], $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        \sin th
        \end{array}
        
        Derivation
        1. Initial program 94.1%

          \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
        2. Step-by-step derivation
          1. lift-+.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin kx}^{2} + {\sin ky}^{2}}}} \cdot \sin th \]
          2. +-commutativeN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
          3. lower-+.f6494.1

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]
          4. lift-pow.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2}} + {\sin kx}^{2}}} \cdot \sin th \]
          5. unpow2N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
          6. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + {\sin kx}^{2}}} \cdot \sin th \]
          7. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + {\sin kx}^{2}}} \cdot \sin th \]
          8. sqr-sin-aN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
          9. lower--.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + {\sin kx}^{2}}} \cdot \sin th \]
          10. lower-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
          11. lower-cos.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
          12. lower-*.f6485.0

            \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + {\sin kx}^{2}}} \cdot \sin th \]
          13. lift-pow.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{{\sin kx}^{2}}}} \cdot \sin th \]
          14. unpow2N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]
          15. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\sin kx} \cdot \sin kx}} \cdot \sin th \]
          16. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \sin kx \cdot \color{blue}{\sin kx}}} \cdot \sin th \]
          17. sqr-sin-aN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          18. lower--.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          19. lower-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          20. lower-cos.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          21. lower-*.f6476.0

            \[\leadsto \frac{\sin ky}{\sqrt{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
        3. Applied rewrites76.0%

          \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right) + \left(0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
        4. Step-by-step derivation
          1. lift-+.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          2. lift--.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot ky\right)\right)} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
          3. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
          4. lift-cos.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
          5. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \color{blue}{\left(2 \cdot ky\right)}\right) + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
          6. sqr-sin-a-revN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
          7. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\sin ky} \cdot \sin ky + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
          8. lift-sin.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\sin ky \cdot \color{blue}{\sin ky} + \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot kx\right)\right)}} \cdot \sin th \]
          9. lift-fma.f6485.3

            \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - 0.5 \cdot \cos \left(2 \cdot kx\right)\right)}}} \cdot \sin th \]
          10. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot kx\right)}\right)}} \cdot \sin th \]
          11. *-commutativeN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \color{blue}{\cos \left(2 \cdot kx\right) \cdot \frac{1}{2}}\right)}} \cdot \sin th \]
          12. lower-*.f6485.3

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \color{blue}{\cos \left(2 \cdot kx\right) \cdot 0.5}\right)}} \cdot \sin th \]
          13. lift-*.f64N/A

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(2 \cdot kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
          14. count-2-revN/A

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, \frac{1}{2} - \cos \color{blue}{\left(kx + kx\right)} \cdot \frac{1}{2}\right)}} \cdot \sin th \]
          15. lower-+.f6485.3

            \[\leadsto \frac{\sin ky}{\sqrt{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \color{blue}{\left(kx + kx\right)} \cdot 0.5\right)}} \cdot \sin th \]
        5. Applied rewrites85.3%

          \[\leadsto \frac{\sin ky}{\sqrt{\color{blue}{\mathsf{fma}\left(\sin ky, \sin ky, 0.5 - \cos \left(kx + kx\right) \cdot 0.5\right)}}} \cdot \sin th \]
        6. Taylor expanded in kx around 0

          \[\leadsto \color{blue}{\sin th} \]
        7. Step-by-step derivation
          1. lift-sin.f6423.7

            \[\leadsto \sin th \]
        8. Applied rewrites23.7%

          \[\leadsto \color{blue}{\sin th} \]
        9. Add Preprocessing

        Reproduce

        ?
        herbie shell --seed 2025112 
        (FPCore (kx ky th)
          :name "Toniolo and Linder, Equation (3b), real"
          :precision binary64
          (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))