Average Error: 3.8 → 0.2
Time: 38.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 3.8

    \[\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
Error33.8
Cost59096
\[\begin{array}{l} t_1 := \left(\sin th \cdot ky\right) \cdot \sqrt{\frac{2}{1 - \cos \left(kx \cdot 2\right)}}\\ \mathbf{if}\;\sin ky \leq -1 \cdot 10^{-33}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq -2 \cdot 10^{-216}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-262}:\\ \;\;\;\;\sin th \cdot \frac{\sin ky}{-kx}\\ \mathbf{elif}\;\sin ky \leq 10^{-184}:\\ \;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\ \mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-113}:\\ \;\;\;\;\sqrt[3]{{\sin th}^{3}}\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-27}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 2
Error33.7
Cost59096
\[\begin{array}{l} t_1 := \left(\sin th \cdot ky\right) \cdot \sqrt{\frac{2}{1 - \cos \left(kx \cdot 2\right)}}\\ \mathbf{if}\;\sin ky \leq -1 \cdot 10^{-33}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq -2 \cdot 10^{-216}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-231}:\\ \;\;\;\;\sin th \cdot \frac{\sin ky}{-kx}\\ \mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-205}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-170}:\\ \;\;\;\;\sqrt{\frac{1}{kx \cdot kx} + 0.3333333333333333} \cdot \left(\sin th \cdot \sin ky\right)\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-27}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 3
Error35.2
Cost58712
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -1 \cdot 10^{-77}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-189}:\\ \;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\ \mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-262}:\\ \;\;\;\;\sin th \cdot \frac{\sin ky}{-kx}\\ \mathbf{elif}\;\sin ky \leq 10^{-184}:\\ \;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\ \mathbf{elif}\;\sin ky \leq 10^{-106}:\\ \;\;\;\;\sqrt[3]{{\sin th}^{3}}\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-81}:\\ \;\;\;\;\frac{\sin th \cdot ky}{\sin kx}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin th \cdot \sin ky}{\sin ky}\\ \end{array} \]
Alternative 4
Error35.4
Cost52312
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -1 \cdot 10^{-77}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-189}:\\ \;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\ \mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-262}:\\ \;\;\;\;\sin th \cdot \frac{\sin ky}{-kx}\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-142}:\\ \;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\ \mathbf{elif}\;\sin ky \leq 10^{-106}:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-44}:\\ \;\;\;\;\frac{\sin th \cdot ky}{\sin kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 5
Error35.6
Cost52312
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -1 \cdot 10^{-77}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-189}:\\ \;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\ \mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-262}:\\ \;\;\;\;\sin th \cdot \frac{\sin ky}{-kx}\\ \mathbf{elif}\;\sin ky \leq 10^{-184}:\\ \;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\ \mathbf{elif}\;\sin ky \leq 10^{-106}:\\ \;\;\;\;\sqrt[3]{{\sin th}^{3}}\\ \mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-44}:\\ \;\;\;\;\frac{\sin th \cdot ky}{\sin kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 6
Error34.3
Cost39248
\[\begin{array}{l} t_1 := \frac{ky}{\frac{\sin kx}{\sin th}}\\ \mathbf{if}\;\sin ky \leq -1 \cdot 10^{-77}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-142}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\sin ky \leq 10^{-106}:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-44}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 7
Error34.3
Cost39248
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -1 \cdot 10^{-77}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-142}:\\ \;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\ \mathbf{elif}\;\sin ky \leq 10^{-106}:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-44}:\\ \;\;\;\;\frac{\sin th \cdot ky}{\sin kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 8
Error34.3
Cost39248
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -1 \cdot 10^{-77}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-142}:\\ \;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\ \mathbf{elif}\;\sin ky \leq 10^{-106}:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-44}:\\ \;\;\;\;\frac{\sin th \cdot ky}{\sin kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 9
Error34.3
Cost39248
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -1 \cdot 10^{-77}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-142}:\\ \;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\ \mathbf{elif}\;\sin ky \leq 10^{-106}:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-44}:\\ \;\;\;\;\frac{\sin th \cdot ky}{\sin kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 10
Error0.3
Cost32384
\[\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin th}} \]
Alternative 11
Error24.8
Cost26776
\[\begin{array}{l} t_1 := \left(\sin th \cdot ky\right) \cdot \sqrt{\frac{2}{1 - \cos \left(kx \cdot 2\right)}}\\ \mathbf{if}\;th \leq -2.9142807725010324 \cdot 10^{+183}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;th \leq -1.5233437980199724 \cdot 10^{+108}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq -5.88964338125302 \cdot 10^{+39}:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;th \leq -1.2754234967578714 \cdot 10^{+25}:\\ \;\;\;\;\frac{\sin th \cdot \sin ky}{\sin kx}\\ \mathbf{elif}\;th \leq -515992601159.6631:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;th \leq 8.927690943893876 \cdot 10^{+21}:\\ \;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 12
Error16.4
Cost26248
\[\begin{array}{l} t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\ t_2 := \frac{\sin th \cdot ky}{t_1}\\ \mathbf{if}\;th \leq -3.5527479179531057 \cdot 10^{-10}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;th \leq 0.0011350981318073547:\\ \;\;\;\;th \cdot \frac{\sin ky}{t_1}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 13
Error37.2
Cost26184
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -1 \cdot 10^{-77}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-169}:\\ \;\;\;\;\frac{\sin th}{\frac{kx}{\sin ky}}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 14
Error37.2
Cost19784
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -1 \cdot 10^{-77}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-169}:\\ \;\;\;\;\sin th \cdot \frac{ky}{kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 15
Error43.0
Cost13252
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq 5 \cdot 10^{-169}:\\ \;\;\;\;\frac{\sin th \cdot ky}{kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 16
Error42.7
Cost6984
\[\begin{array}{l} \mathbf{if}\;ky \leq -269491158731.4664:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;ky \leq 4.458747481384666 \cdot 10^{-169}:\\ \;\;\;\;\sin th \cdot \frac{ky}{kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 17
Error46.0
Cost6920
\[\begin{array}{l} \mathbf{if}\;ky \leq -1.5936717305920108 \cdot 10^{-6}:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;ky \leq 4.458747481384666 \cdot 10^{-169}:\\ \;\;\;\;-0.16666666666666666 \cdot {th}^{3}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 18
Error48.8
Cost6464
\[\sin th \]
Alternative 19
Error55.3
Cost64
\[th \]

Error

Reproduce

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