Average Error: 3.9 → 0.2
Time: 29.7s
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.9

    \[\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
Error0.2
Cost32384
\[\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \]
Alternative 2
Error17.8
Cost26512
\[\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 -7.891889229214807 \cdot 10^{+169}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;th \leq -4.860025847619933 \cdot 10^{+141}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;th \leq -6.1138113811938636 \cdot 10^{+54}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;th \leq 0.6869963313080841:\\ \;\;\;\;th \cdot \frac{\sin ky}{t_1}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error17.8
Cost26512
\[\begin{array}{l} t_1 := \frac{\sin th \cdot ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\ \mathbf{if}\;th \leq -7.891889229214807 \cdot 10^{+169}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq -4.860025847619933 \cdot 10^{+141}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;th \leq -6.1138113811938636 \cdot 10^{+54}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq 0.6869963313080841:\\ \;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error25.0
Cost26248
\[\begin{array}{l} \mathbf{if}\;th \leq -0.06210540854879505:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;th \leq 0.6869963313080841:\\ \;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\ \mathbf{else}:\\ \;\;\;\;\left|\sin th\right|\\ \end{array} \]
Alternative 5
Error25.0
Cost26248
\[\begin{array}{l} \mathbf{if}\;th \leq -0.06210540854879505:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;th \leq 0.6869963313080841:\\ \;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\ \mathbf{else}:\\ \;\;\;\;\left|\sin th\right|\\ \end{array} \]
Alternative 6
Error37.6
Cost26184
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -1 \cdot 10^{-202}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-149}:\\ \;\;\;\;\sin ky \cdot \frac{\sin th}{kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 7
Error33.5
Cost26184
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -1 \cdot 10^{-75}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-149}:\\ \;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 8
Error38.2
Cost19784
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -1 \cdot 10^{-149}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-149}:\\ \;\;\;\;\frac{th}{\frac{\sin kx}{ky}}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 9
Error43.3
Cost6984
\[\begin{array}{l} \mathbf{if}\;ky \leq -91.94606965507796:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;ky \leq 2.8043664697042527 \cdot 10^{-149}:\\ \;\;\;\;ky \cdot \frac{th}{\sin kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 10
Error43.2
Cost6984
\[\begin{array}{l} \mathbf{if}\;ky \leq -91.94606965507796:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;ky \leq 2.8043664697042527 \cdot 10^{-149}:\\ \;\;\;\;\frac{th}{\frac{\sin kx}{ky}}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 11
Error46.0
Cost6920
\[\begin{array}{l} \mathbf{if}\;ky \leq -0.7665117409985942:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;ky \leq 9.786176717014149 \cdot 10^{-175}:\\ \;\;\;\;-0.16666666666666666 \cdot {th}^{3}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 12
Error49.1
Cost6464
\[\sin th \]
Alternative 13
Error55.5
Cost64
\[th \]

Error

Reproduce

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