Average Error: 12.6 → 11.9
Time: 38.1s
Precision: 64
Internal Precision: 128
\[\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \cdot \sin th\]
\[\begin{array}{l} \mathbf{if}\;\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \le 1.0:\\ \;\;\;\;\left(\frac{1}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \cdot \sin th\right) \cdot \sin ky\\ \mathbf{else}:\\ \;\;\;\;\sin ky \cdot \left(\sin th \cdot \frac{1}{ky - ky \cdot \left(ky \cdot \left(ky \cdot \frac{1}{6}\right) - kx \cdot \left(kx \cdot \frac{1}{12}\right)\right)}\right)\\ \end{array}\]

Error

Bits error versus kx

Bits error versus ky

Bits error versus th

Derivation

  1. Split input into 2 regimes
  2. if (/ (sin ky) (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))) < 1.0

    1. Initial program 11.1

      \[\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \cdot \sin th\]
    2. Using strategy rm
    3. Applied div-inv11.2

      \[\leadsto \color{blue}{\left(\sin ky \cdot \frac{1}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}}\right)} \cdot \sin th\]
    4. Applied associate-*l*11.2

      \[\leadsto \color{blue}{\sin ky \cdot \left(\frac{1}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \cdot \sin th\right)}\]

    if 1.0 < (/ (sin ky) (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2))))

    1. Initial program 61.8

      \[\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \cdot \sin th\]
    2. Using strategy rm
    3. Applied div-inv61.8

      \[\leadsto \color{blue}{\left(\sin ky \cdot \frac{1}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}}\right)} \cdot \sin th\]
    4. Applied associate-*l*61.8

      \[\leadsto \color{blue}{\sin ky \cdot \left(\frac{1}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \cdot \sin th\right)}\]
    5. Taylor expanded around 0 32.6

      \[\leadsto \sin ky \cdot \left(\frac{1}{\color{blue}{\left(\frac{1}{12} \cdot \left({kx}^{2} \cdot ky\right) + ky\right) - \frac{1}{6} \cdot {ky}^{3}}} \cdot \sin th\right)\]
    6. Simplified32.6

      \[\leadsto \sin ky \cdot \left(\frac{1}{\color{blue}{ky - \left(\left(ky \cdot \frac{1}{6}\right) \cdot ky - \left(\frac{1}{12} \cdot kx\right) \cdot kx\right) \cdot ky}} \cdot \sin th\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification11.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \le 1.0:\\ \;\;\;\;\left(\frac{1}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \cdot \sin th\right) \cdot \sin ky\\ \mathbf{else}:\\ \;\;\;\;\sin ky \cdot \left(\sin th \cdot \frac{1}{ky - ky \cdot \left(ky \cdot \left(ky \cdot \frac{1}{6}\right) - kx \cdot \left(kx \cdot \frac{1}{12}\right)\right)}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019068 
(FPCore (kx ky th)
  :name "Toniolo and Linder, Equation (3b), real"
  (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))) (sin th)))