Average Error: 4.1 → 0.2
Time: 44.5s
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 kx, \sin ky\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 kx) (sin ky)) (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(kx), sin(ky)) / 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(kx), Math.sin(ky)) / 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(kx), math.sin(ky)) / 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(kx), sin(ky)) / 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(kx), sin(ky)) / 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[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $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 kx, \sin ky\right)}{\sin ky}}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 4.1

    \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
  2. Applied egg-rr0.2

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

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

Alternatives

Alternative 1
Error13.9
Cost65356
\[\begin{array}{l} t_1 := \sin th \cdot \frac{\sin ky}{\sqrt{0.5 + \cos \left(kx \cdot 2\right) \cdot -0.5}}\\ t_2 := {\sin kx}^{2}\\ \mathbf{if}\;t_2 \leq 5 \cdot 10^{-10}:\\ \;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(kx, \sin ky\right)}{\sin ky}}\\ \mathbf{elif}\;t_2 \leq 0.22:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_2 \leq 0.54:\\ \;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right) \cdot \left(\frac{1}{th} + th \cdot 0.16666666666666666\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error24.9
Cost58644
\[\begin{array}{l} t_1 := \left(\sin th \cdot ky\right) \cdot \sqrt{\frac{1}{0.5 + \cos \left(kx \cdot 2\right) \cdot -0.5}}\\ \mathbf{if}\;\sin th \leq -0.96:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\sin th \leq -0.66:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;\sin th \leq -0.296:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\sin th \leq -0.05:\\ \;\;\;\;\sqrt{{\sin th}^{2}}\\ \mathbf{elif}\;\sin th \leq 4 \cdot 10^{-5}:\\ \;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{th}}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 3
Error14.6
Cost52112
\[\begin{array}{l} t_1 := \left(\sin th \cdot ky\right) \cdot \sqrt{\frac{1}{0.5 + \cos \left(kx \cdot 2\right) \cdot -0.5}}\\ \mathbf{if}\;\sin kx \leq -0.912:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\sin kx \leq -0.484:\\ \;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{th}}\\ \mathbf{elif}\;\sin kx \leq -0.05:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-5}:\\ \;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(kx, \sin ky\right)}{\sin ky}}\\ \mathbf{else}:\\ \;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\ \end{array} \]
Alternative 4
Error37.1
Cost45648
\[\begin{array}{l} \mathbf{if}\;\sin kx \leq -2 \cdot 10^{-44}:\\ \;\;\;\;ky \cdot \frac{th}{\sqrt{{\sin kx}^{2}}}\\ \mathbf{elif}\;\sin kx \leq -5 \cdot 10^{-273}:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;\sin kx \leq 10^{-250}:\\ \;\;\;\;\sqrt{{\sin th}^{2}}\\ \mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-128}:\\ \;\;\;\;\sin th\\ \mathbf{else}:\\ \;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\ \end{array} \]
Alternative 5
Error33.7
Cost45648
\[\begin{array}{l} \mathbf{if}\;\sin kx \leq -0.05:\\ \;\;\;\;\left(\sin th \cdot ky\right) \cdot \sqrt{\frac{1}{0.5 + \cos \left(kx \cdot 2\right) \cdot -0.5}}\\ \mathbf{elif}\;\sin kx \leq -5 \cdot 10^{-273}:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;\sin kx \leq 10^{-250}:\\ \;\;\;\;\sqrt{{\sin th}^{2}}\\ \mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-128}:\\ \;\;\;\;\sin th\\ \mathbf{else}:\\ \;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\ \end{array} \]
Alternative 6
Error13.2
Cost39048
\[\begin{array}{l} \mathbf{if}\;\sin kx \leq -0.04:\\ \;\;\;\;\sin th \cdot \frac{\sin ky}{\sqrt{0.5 + \cos \left(kx \cdot 2\right) \cdot -0.5}}\\ \mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-5}:\\ \;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(kx, \sin ky\right)}{\sin ky}}\\ \mathbf{else}:\\ \;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\ \end{array} \]
Alternative 7
Error34.4
Cost26184
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -5 \cdot 10^{-25}:\\ \;\;\;\;\sqrt{{\sin th}^{2}}\\ \mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-126}:\\ \;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 8
Error41.9
Cost19652
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq 2 \cdot 10^{-126}:\\ \;\;\;\;\frac{\sin ky}{\frac{kx}{\sin th}}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 9
Error38.4
Cost13384
\[\begin{array}{l} \mathbf{if}\;ky \leq -2.6852159100877643 \cdot 10^{+33}:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;ky \leq 1.761721877997747 \cdot 10^{-126}:\\ \;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 10
Error43.5
Cost6984
\[\begin{array}{l} \mathbf{if}\;ky \leq -1078333431473.9033:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;ky \leq 3.731262313640193 \cdot 10^{-239}:\\ \;\;\;\;th \cdot \frac{ky}{\sin kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 11
Error44.9
Cost6728
\[\begin{array}{l} \mathbf{if}\;ky \leq -3.987174777426221 \cdot 10^{+42}:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;ky \leq 6.586137216934689 \cdot 10^{-238}:\\ \;\;\;\;ky \cdot \frac{th}{kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 12
Error49.9
Cost584
\[\begin{array}{l} \mathbf{if}\;ky \leq -1078333431473.9033:\\ \;\;\;\;th\\ \mathbf{elif}\;ky \leq 1.761721877997747 \cdot 10^{-126}:\\ \;\;\;\;ky \cdot \frac{th}{kx}\\ \mathbf{else}:\\ \;\;\;\;th\\ \end{array} \]
Alternative 13
Error55.2
Cost64
\[th \]

Error

Reproduce

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