?

Average Error: 93.9% → 99.7%
Time: 1.0min
Precision: binary64
Cost: 32384.00

?

\[\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 93.9

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

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

    [Start]93.9

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

    +-commutative [=>]93.9

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

    unpow2 [=>]93.9

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

    unpow2 [=>]93.9

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

    hypot-def [=>]99.7

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

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\right)} - 1} \]
  4. Simplified99.7

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

    [Start]43.9

    \[ e^{\mathsf{log1p}\left(\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\right)} - 1 \]

    expm1-def [=>]99.5

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

    expm1-log1p [=>]99.6

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

    *-commutative [=>]99.6

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

    associate-/r/ [<=]99.7

    \[ \color{blue}{\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}} \]
  5. Final simplification99.7

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

Alternatives

Alternative 1
Error54.2%
Cost65245.00
\[\begin{array}{l} t_1 := \frac{ky}{\sin kx}\\ t_2 := \left|\sin th\right|\\ \mathbf{if}\;\sin ky \leq -0.02:\\ \;\;\;\;t_2\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-119}:\\ \;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{ky}}\\ \mathbf{elif}\;\sin ky \leq -2 \cdot 10^{-268}:\\ \;\;\;\;t_2 \cdot t_1\\ \mathbf{elif}\;\sin ky \leq -2 \cdot 10^{-307}:\\ \;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-128} \lor \neg \left(\sin ky \leq 4 \cdot 10^{-89}\right) \land \sin ky \leq 10^{-11}:\\ \;\;\;\;\sin th \cdot \left|t_1\right|\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 2
Error53.1%
Cost65244.00
\[\begin{array}{l} t_1 := \frac{ky}{\sin kx}\\ t_2 := \sin th \cdot \left|t_1\right|\\ t_3 := \left|\sin th\right|\\ \mathbf{if}\;\sin ky \leq -0.02:\\ \;\;\;\;t_3\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-119}:\\ \;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{ky}}\\ \mathbf{elif}\;\sin ky \leq -2 \cdot 10^{-268}:\\ \;\;\;\;t_3 \cdot t_1\\ \mathbf{elif}\;\sin ky \leq -2 \cdot 10^{-307}:\\ \;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-174}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-89}:\\ \;\;\;\;\frac{\sin th}{1 + \frac{0.5 \cdot \left(kx \cdot kx\right)}{{\sin ky}^{2}}}\\ \mathbf{elif}\;\sin ky \leq 10^{-11}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 3
Error52.6%
Cost65244.00
\[\begin{array}{l} t_1 := \frac{ky}{\sin kx}\\ t_2 := \sin th \cdot \left|t_1\right|\\ t_3 := \left|\sin th\right|\\ \mathbf{if}\;\sin ky \leq -0.02:\\ \;\;\;\;t_3\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-119}:\\ \;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{ky}}\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-269}:\\ \;\;\;\;t_3 \cdot t_1\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-296}:\\ \;\;\;\;\left|\sin ky \cdot \frac{\sin th}{\sin kx}\right|\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-174}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-89}:\\ \;\;\;\;\frac{\sin th}{1 + \frac{0.5 \cdot \left(kx \cdot kx\right)}{{\sin ky}^{2}}}\\ \mathbf{elif}\;\sin ky \leq 10^{-11}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 4
Error52.6%
Cost65244.00
\[\begin{array}{l} t_1 := \sin th \cdot \left|\frac{ky}{\sin kx}\right|\\ t_2 := \left|\sin th\right|\\ \mathbf{if}\;\sin ky \leq -0.02:\\ \;\;\;\;t_2\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-119}:\\ \;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{ky}}\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-269}:\\ \;\;\;\;\frac{\sin ky}{\frac{\sin kx}{t_2}}\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-296}:\\ \;\;\;\;\left|\sin ky \cdot \frac{\sin th}{\sin kx}\right|\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-174}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-89}:\\ \;\;\;\;\frac{\sin th}{1 + \frac{0.5 \cdot \left(kx \cdot kx\right)}{{\sin ky}^{2}}}\\ \mathbf{elif}\;\sin ky \leq 10^{-11}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 5
Error52.8%
Cost58712.00
\[\begin{array}{l} t_1 := \sin th \cdot \left|\frac{ky}{\sin kx}\right|\\ \mathbf{if}\;\sin ky \leq -0.02:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-116}:\\ \;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{ky}}\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-296}:\\ \;\;\;\;\frac{\sin th}{\frac{\sin kx}{\left|\sin ky\right|}}\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-174}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-89}:\\ \;\;\;\;\frac{\sin th}{1 + \frac{0.5 \cdot \left(kx \cdot kx\right)}{{\sin ky}^{2}}}\\ \mathbf{elif}\;\sin ky \leq 10^{-11}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 6
Error52.3%
Cost52181.00
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -1 \cdot 10^{-52}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq -2 \cdot 10^{-307}:\\ \;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-128} \lor \neg \left(\sin ky \leq 4 \cdot 10^{-89}\right) \land \sin ky \leq 10^{-11}:\\ \;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 7
Error51.8%
Cost52181.00
\[\begin{array}{l} t_1 := \left|\sin th\right|\\ t_2 := \frac{ky}{\sin kx}\\ \mathbf{if}\;\sin ky \leq -1 \cdot 10^{-93}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-296}:\\ \;\;\;\;t_1 \cdot t_2\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-128} \lor \neg \left(\sin ky \leq 4 \cdot 10^{-89}\right) \land \sin ky \leq 10^{-11}:\\ \;\;\;\;\sin th \cdot \left|t_2\right|\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 8
Error38.0%
Cost39248.00
\[\begin{array}{l} t_1 := \left|\sin th\right|\\ \mathbf{if}\;\sin kx \leq -5 \cdot 10^{-55}:\\ \;\;\;\;\left|\frac{th \cdot ky}{\sin kx}\right|\\ \mathbf{elif}\;\sin kx \leq -4 \cdot 10^{-157}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-236}:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-61}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\ \end{array} \]
Alternative 9
Error38.0%
Cost39248.00
\[\begin{array}{l} t_1 := \left|\sin th\right|\\ \mathbf{if}\;\sin kx \leq -5 \cdot 10^{-55}:\\ \;\;\;\;\left|\frac{th \cdot ky}{\sin kx}\right|\\ \mathbf{elif}\;\sin kx \leq -4 \cdot 10^{-157}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-236}:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-61}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\ \end{array} \]
Alternative 10
Error74.3%
Cost39049.00
\[\begin{array}{l} t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\ \mathbf{if}\;\sin th \leq -0.1 \lor \neg \left(\sin th \leq 10^{-7}\right):\\ \;\;\;\;\frac{\sin th \cdot ky}{t_1}\\ \mathbf{else}:\\ \;\;\;\;\frac{th}{\frac{t_1}{\sin ky}}\\ \end{array} \]
Alternative 11
Error66.0%
Cost39048.00
\[\begin{array}{l} \mathbf{if}\;\sin th \leq -0.05:\\ \;\;\;\;\frac{\sin th}{\frac{\sin kx}{\left|\sin ky\right|}}\\ \mathbf{elif}\;\sin th \leq 10^{-7}:\\ \;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin ky}{\left|\frac{\sin kx}{\sin th}\right|}\\ \end{array} \]
Alternative 12
Error66.0%
Cost39048.00
\[\begin{array}{l} \mathbf{if}\;\sin th \leq -0.05:\\ \;\;\;\;\frac{\sin th}{\frac{\sin kx}{\left|\sin ky\right|}}\\ \mathbf{elif}\;\sin th \leq 10^{-7}:\\ \;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin ky}{\left|\frac{\sin kx}{\sin th}\right|}\\ \end{array} \]
Alternative 13
Error99.7%
Cost32384.00
\[\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \]
Alternative 14
Error99.6%
Cost32384.00
\[\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \]
Alternative 15
Error42.4%
Cost19784.00
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -5 \cdot 10^{-138}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-175}:\\ \;\;\;\;\frac{\sin th}{\frac{kx}{ky}}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 16
Error31.5%
Cost6984.00
\[\begin{array}{l} \mathbf{if}\;ky \leq -9.5 \cdot 10^{+25}:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;ky \leq 5.8 \cdot 10^{-227}:\\ \;\;\;\;th \cdot \frac{ky}{\sin kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 17
Error34.3%
Cost6984.00
\[\begin{array}{l} \mathbf{if}\;ky \leq -1.5 \cdot 10^{-6}:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;ky \leq 2.7 \cdot 10^{-175}:\\ \;\;\;\;ky \cdot \frac{\sin th}{kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 18
Error34.3%
Cost6984.00
\[\begin{array}{l} \mathbf{if}\;ky \leq -1.5 \cdot 10^{-6}:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;ky \leq 2.55 \cdot 10^{-175}:\\ \;\;\;\;\frac{\sin th}{\frac{kx}{ky}}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 19
Error21.8%
Cost6728.00
\[\begin{array}{l} \mathbf{if}\;ky \leq -7.5 \cdot 10^{-60}:\\ \;\;\;\;\mathsf{expm1}\left(th\right)\\ \mathbf{elif}\;ky \leq 1.56 \cdot 10^{-167}:\\ \;\;\;\;\frac{th}{\frac{kx}{ky}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{expm1}\left(th\right)\\ \end{array} \]
Alternative 20
Error30.9%
Cost6728.00
\[\begin{array}{l} \mathbf{if}\;ky \leq -1.5 \cdot 10^{-6}:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;ky \leq 4 \cdot 10^{-226}:\\ \;\;\;\;\frac{th}{\frac{kx}{ky}}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 21
Error21.5%
Cost584.00
\[\begin{array}{l} \mathbf{if}\;ky \leq -1 \cdot 10^{-52}:\\ \;\;\;\;th\\ \mathbf{elif}\;ky \leq 4.8 \cdot 10^{-161}:\\ \;\;\;\;th \cdot \frac{ky}{kx}\\ \mathbf{else}:\\ \;\;\;\;th\\ \end{array} \]
Alternative 22
Error21.5%
Cost584.00
\[\begin{array}{l} \mathbf{if}\;ky \leq -1 \cdot 10^{-52}:\\ \;\;\;\;th\\ \mathbf{elif}\;ky \leq 1.15 \cdot 10^{-162}:\\ \;\;\;\;\frac{th}{\frac{kx}{ky}}\\ \mathbf{else}:\\ \;\;\;\;th\\ \end{array} \]
Alternative 23
Error13.4%
Cost64.00
\[th \]

Error

Reproduce?

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