?

Average Error: 6.17% → 0.34%
Time: 34.3s
Precision: binary64
Cost: 32384

?

\[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
\[\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}} \]
(FPCore (kx ky th)
 :precision binary64
 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
(FPCore (kx ky th)
 :precision binary64
 (/ (sin th) (/ (hypot (sin ky) (sin kx)) (sin ky))))
double code(double kx, double ky, double th) {
	return (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(th) / (hypot(sin(ky), sin(kx)) / sin(ky));
}
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);
}
public static double code(double kx, double ky, double th) {
	return Math.sin(th) / (Math.hypot(Math.sin(ky), Math.sin(kx)) / Math.sin(ky));
}
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)
def code(kx, ky, th):
	return math.sin(th) / (math.hypot(math.sin(ky), math.sin(kx)) / math.sin(ky))
function code(kx, ky, th)
	return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th))
end
function code(kx, ky, th)
	return Float64(sin(th) / Float64(hypot(sin(ky), sin(kx)) / sin(ky)))
end
function tmp = code(kx, ky, th)
	tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th);
end
function tmp = code(kx, ky, th)
	tmp = sin(th) / (hypot(sin(ky), sin(kx)) / sin(ky));
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]
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 6.17

    \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
  2. Simplified0.34

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

    [Start]6.17

    \[ \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]

    +-commutative [=>]6.17

    \[ \frac{\sin ky}{\sqrt{\color{blue}{{\sin ky}^{2} + {\sin kx}^{2}}}} \cdot \sin th \]

    unpow2 [=>]6.17

    \[ \frac{\sin ky}{\sqrt{\color{blue}{\sin ky \cdot \sin ky} + {\sin kx}^{2}}} \cdot \sin th \]

    unpow2 [=>]6.17

    \[ \frac{\sin ky}{\sqrt{\sin ky \cdot \sin ky + \color{blue}{\sin kx \cdot \sin kx}}} \cdot \sin th \]

    hypot-def [=>]0.34

    \[ \frac{\sin ky}{\color{blue}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}} \cdot \sin th \]
  3. Applied egg-rr0.34

    \[\leadsto \color{blue}{\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}} \]
  4. Final simplification0.34

    \[\leadsto \frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}} \]

Alternatives

Alternative 1
Error47.08%
Cost65244
\[\begin{array}{l} t_1 := \left|\sin th \cdot ky\right|\\ t_2 := \frac{\sin ky}{\left|\frac{\sin kx}{\sin th}\right|}\\ \mathbf{if}\;\sin ky \leq -2 \cdot 10^{-50}:\\ \;\;\;\;\frac{\left|\sin th \cdot \sin ky\right|}{\sin ky}\\ \mathbf{elif}\;\sin ky \leq -4 \cdot 10^{-64}:\\ \;\;\;\;\frac{t_1}{\sin kx}\\ \mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-97}:\\ \;\;\;\;\frac{t_1}{\sin ky}\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-153}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-181}:\\ \;\;\;\;\left|\sin th \cdot \frac{\sin ky}{\sin kx}\right|\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-278}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-41}:\\ \;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 2
Error47.22%
Cost52180
\[\begin{array}{l} t_1 := \frac{ky}{\sin kx}\\ t_2 := \sin th \cdot \mathsf{expm1}\left(t_1\right)\\ \mathbf{if}\;\sin ky \leq -2 \cdot 10^{-12}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-71}:\\ \;\;\;\;\frac{\left|\sin th \cdot ky\right|}{\sin kx}\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-153}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-254}:\\ \;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-41}:\\ \;\;\;\;\sin th \cdot \left|t_1\right|\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 3
Error47.21%
Cost52180
\[\begin{array}{l} t_1 := \frac{ky}{\sin kx}\\ t_2 := \sin th \cdot \mathsf{expm1}\left(t_1\right)\\ \mathbf{if}\;\sin ky \leq -2 \cdot 10^{-12}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-71}:\\ \;\;\;\;\frac{\left|\sin th \cdot ky\right|}{\sin kx}\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-153}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-254}:\\ \;\;\;\;\left|\sin th \cdot \frac{\sin ky}{\sin kx}\right|\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-41}:\\ \;\;\;\;\sin th \cdot \left|t_1\right|\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 4
Error46.44%
Cost52180
\[\begin{array}{l} t_1 := \frac{ky}{\sin kx}\\ \mathbf{if}\;\sin ky \leq -2 \cdot 10^{-50}:\\ \;\;\;\;\frac{\left|\sin th \cdot \sin ky\right|}{\sin ky}\\ \mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-60}:\\ \;\;\;\;\frac{\left|\sin th \cdot ky\right|}{\sin kx}\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-153}:\\ \;\;\;\;\sin th \cdot \mathsf{expm1}\left(t_1\right)\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-254}:\\ \;\;\;\;\left|\sin th \cdot \frac{\sin ky}{\sin kx}\right|\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-41}:\\ \;\;\;\;\sin th \cdot \left|t_1\right|\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 5
Error50.61%
Cost45648
\[\begin{array}{l} t_1 := \left|ky \cdot \frac{\sin th}{\sin kx}\right|\\ \mathbf{if}\;\sin ky \leq -1 \cdot 10^{-153}:\\ \;\;\;\;\sin th \cdot \mathsf{expm1}\left(\frac{ky}{\sin kx}\right)\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-254}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\sin ky \leq 10^{-238}:\\ \;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-41}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 6
Error59.31%
Cost39116
\[\begin{array}{l} t_1 := \left|ky \cdot \frac{\sin th}{\sin kx}\right|\\ \mathbf{if}\;\sin ky \leq -1 \cdot 10^{-254}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\sin ky \leq 10^{-238}:\\ \;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-41}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 7
Error45.93%
Cost39116
\[\begin{array}{l} t_1 := \frac{ky}{\sin kx}\\ \mathbf{if}\;\sin ky \leq -1 \cdot 10^{-153}:\\ \;\;\;\;\sin th \cdot \mathsf{expm1}\left(t_1\right)\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-254}:\\ \;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-41}:\\ \;\;\;\;\sin th \cdot \left|t_1\right|\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 8
Error27.7%
Cost39048
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -0.02:\\ \;\;\;\;\frac{\left|\sin th \cdot \sin ky\right|}{\sin ky}\\ \mathbf{elif}\;\sin ky \leq 10^{-13}:\\ \;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 9
Error22.52%
Cost39048
\[\begin{array}{l} t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\ \mathbf{if}\;\sin ky \leq -0.002:\\ \;\;\;\;\frac{\frac{1}{\frac{\frac{1}{th} + th \cdot 0.16666666666666666}{\sin ky}}}{t_1}\\ \mathbf{elif}\;\sin ky \leq 10^{-13}:\\ \;\;\;\;\frac{\sin th}{\frac{t_1}{ky}}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 10
Error0.34%
Cost32384
\[\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \]
Alternative 11
Error28.59%
Cost26644
\[\begin{array}{l} t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\ t_2 := ky \cdot \frac{\sin th}{t_1}\\ \mathbf{if}\;th \leq -7 \cdot 10^{+205}:\\ \;\;\;\;\frac{\left|\sin th \cdot \sin ky\right|}{\sin ky}\\ \mathbf{elif}\;th \leq -0.0055:\\ \;\;\;\;t_2\\ \mathbf{elif}\;th \leq 0.0029:\\ \;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\ \mathbf{elif}\;th \leq 4.2 \cdot 10^{+58}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;th \leq 6.8 \cdot 10^{+97}:\\ \;\;\;\;\frac{\sin th}{1 + 0.5 \cdot \frac{kx \cdot kx}{{\sin ky}^{2}}}\\ \mathbf{else}:\\ \;\;\;\;\sin th \cdot \frac{ky}{t_1}\\ \end{array} \]
Alternative 12
Error59.06%
Cost19652
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq 2 \cdot 10^{-125}:\\ \;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 13
Error59.01%
Cost19652
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq 2 \cdot 10^{-125}:\\ \;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 14
Error59.01%
Cost19652
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq 2 \cdot 10^{-125}:\\ \;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 15
Error65.97%
Cost6984
\[\begin{array}{l} \mathbf{if}\;ky \leq -3.2:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;ky \leq 1.3 \cdot 10^{-122}:\\ \;\;\;\;\sin th \cdot \frac{ky}{kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 16
Error65.96%
Cost6984
\[\begin{array}{l} \mathbf{if}\;ky \leq -3.2:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;ky \leq 1.04 \cdot 10^{-125}:\\ \;\;\;\;ky \cdot \frac{\sin th}{kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 17
Error69.38%
Cost6728
\[\begin{array}{l} \mathbf{if}\;ky \leq -3.2:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;ky \leq 3.8 \cdot 10^{-252}:\\ \;\;\;\;th \cdot \frac{ky}{kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 18
Error78.31%
Cost584
\[\begin{array}{l} \mathbf{if}\;ky \leq -0.16:\\ \;\;\;\;th\\ \mathbf{elif}\;ky \leq 3.1 \cdot 10^{-123}:\\ \;\;\;\;th \cdot \frac{ky}{kx}\\ \mathbf{else}:\\ \;\;\;\;th\\ \end{array} \]
Alternative 19
Error86.3%
Cost64
\[th \]

Error

Reproduce?

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