Average Error: 13.1 → 12.4
Time: 31.7s
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 0.9999953171152953:\\ \;\;\;\;\frac{1}{\frac{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}}{\sin ky}} \cdot \sin th\\ \mathbf{else}:\\ \;\;\;\;\sin th \cdot \left(1 - \frac{1}{6} \cdot {kx}^{2}\right)\\ \end{array}\]

Error

Bits error versus kx

Bits error versus ky

Bits error versus th

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

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

    1. Initial program 14.1

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

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

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

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

    1. Initial program 9.1

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

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

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

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

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

Reproduce

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

Details

Time bar (total: 27.8s)Debug log

sample449.0ms

Algorithm
intervals

simplify14.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
14.0ms
(* (/ (sin ky) (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))) (sin th))

prune18.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 14.6b

localize89.0ms

Local error

Found 4 expressions with local error:

3.6b
(sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))
0.3b
(pow (sin kx) 2)
0.2b
(pow (sin ky) 2)
0.2b
(/ (sin ky) (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2))))

rewrite24.0ms

Algorithm
rewrite-expression-head
Rules
44×*-un-lft-identity
25×sqrt-prod
25×add-sqr-sqrt
24×add-cube-cbrt
24×times-frac
16×unpow-prod-down
10×distribute-lft-out
add-exp-log
associate-/r*
add-cbrt-cube
pow1
add-log-exp
sqrt-div
associate-/l*
unpow2
flip-+
associate-/r/
pow-exp
flip3-+
pow-pow
pow-to-exp
div-inv
div-exp
pow1/2
frac-2neg
clear-num
rem-sqrt-square
cbrt-undiv
Counts
4 → 93
Calls
4 calls:
Slowest
10.0ms
(/ (sin ky) (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2))))
10.0ms
(sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))
1.0ms
(pow (sin kx) 2)
1.0ms
(pow (sin ky) 2)

series261.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
122.0ms
(/ (sin ky) (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2))))
108.0ms
(sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))
16.0ms
(pow (sin kx) 2)
15.0ms
(pow (sin ky) 2)

simplify1.4s

Counts
92 → 105
Calls
92 calls:
Slowest
196.0ms
(- (+ (* 1/12 (* (pow kx 2) ky)) ky) (* 1/6 (pow ky 3)))
190.0ms
(sqrt (+ (* (pow (sin kx) 2) (pow (sin kx) 2)) (- (* (pow (sin ky) 2) (pow (sin ky) 2)) (* (pow (sin kx) 2) (pow (sin ky) 2)))))
171.0ms
(/ (* (* (sin ky) (sin ky)) (sin ky)) (* (* (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2))) (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))) (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))))
160.0ms
(sqrt (- (* (pow (sin kx) 2) (pow (sin kx) 2)) (* (pow (sin ky) 2) (pow (sin ky) 2))))
53.0ms
(- (+ (* 2/45 (pow ky 6)) (pow ky 2)) (* 1/3 (pow ky 4)))

prune1.8s

Pruning

17 alts after pruning (17 fresh and 0 done)

Merged error: 12.7b

localize19.0ms

Local error

Found 4 expressions with local error:

3.6b
(sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))
0.3b
(pow (sin kx) 2)
0.2b
(pow (sin ky) 2)
0.2b
(/ 1 (/ (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2))) (sin ky)))

rewrite26.0ms

Algorithm
rewrite-expression-head
Rules
38×*-un-lft-identity
28×associate-/r*
24×times-frac
23×add-sqr-sqrt
22×add-cube-cbrt
20×sqrt-prod
14×unpow-prod-down
add-exp-log
distribute-lft-out
pow1
add-log-exp
add-cbrt-cube
unpow2
div-inv
pow-exp
sqrt-div
pow-pow
rec-exp
pow-to-exp
inv-pow
pow-flip
flip-+
associate-/r/
div-exp
pow1/2
flip3-+
frac-2neg
clear-num
rem-sqrt-square
Counts
4 → 87
Calls
4 calls:
Slowest
14.0ms
(sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))
6.0ms
(/ 1 (/ (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2))) (sin ky)))
2.0ms
(pow (sin ky) 2)
2.0ms
(pow (sin kx) 2)

series294.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
164.0ms
(/ 1 (/ (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2))) (sin ky)))
100.0ms
(sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))
16.0ms
(pow (sin kx) 2)
15.0ms
(pow (sin ky) 2)

simplify838.0ms

Counts
60 → 99
Calls
60 calls:
Slowest
195.0ms
(- (+ (* 1/12 (* (pow kx 2) ky)) ky) (* 1/6 (pow ky 3)))
150.0ms
(sqrt (- (* (pow (sin kx) 2) (pow (sin kx) 2)) (* (pow (sin ky) 2) (pow (sin ky) 2))))
61.0ms
(- (+ (* 2/45 (pow ky 6)) (pow ky 2)) (* 1/3 (pow ky 4)))
58.0ms
(- (+ (pow kx 2) (* 2/45 (pow kx 6))) (* 1/3 (pow kx 4)))
51.0ms
(sqrt (+ (pow (pow (sin kx) 2) 3) (pow (pow (sin ky) 2) 3)))

prune1.7s

Pruning

17 alts after pruning (17 fresh and 0 done)

Merged error: 12.7b

localize3.0ms

Local error

Found 4 expressions with local error:

3.6b
(sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))
0.3b
(pow (sin kx) 2)
0.2b
(pow (sin ky) 2)
0.2b
(/ 1 (/ (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2))) (sin ky)))

rewrite33.0ms

Algorithm
rewrite-expression-head
Rules
38×*-un-lft-identity
28×associate-/r*
24×times-frac
23×add-sqr-sqrt
22×add-cube-cbrt
20×sqrt-prod
14×unpow-prod-down
add-exp-log
distribute-lft-out
pow1
add-log-exp
add-cbrt-cube
unpow2
div-inv
pow-exp
sqrt-div
pow-pow
rec-exp
pow-to-exp
inv-pow
pow-flip
flip-+
associate-/r/
div-exp
pow1/2
flip3-+
frac-2neg
clear-num
rem-sqrt-square
Counts
4 → 87
Calls
4 calls:
Slowest
15.0ms
(sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))
10.0ms
(/ 1 (/ (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2))) (sin ky)))
4.0ms
(pow (sin ky) 2)
2.0ms
(pow (sin kx) 2)

series251.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
131.0ms
(/ 1 (/ (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2))) (sin ky)))
79.0ms
(sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))
24.0ms
(pow (sin kx) 2)
17.0ms
(pow (sin ky) 2)

simplify802.0ms

Counts
60 → 99
Calls
60 calls:
Slowest
197.0ms
(- (+ (* 1/12 (* (pow kx 2) ky)) ky) (* 1/6 (pow ky 3)))
121.0ms
(sqrt (- (* (pow (sin kx) 2) (pow (sin kx) 2)) (* (pow (sin ky) 2) (pow (sin ky) 2))))
59.0ms
(- (+ (pow kx 2) (* 2/45 (pow kx 6))) (* 1/3 (pow kx 4)))
59.0ms
(- (+ (* 2/45 (pow ky 6)) (pow ky 2)) (* 1/3 (pow ky 4)))
43.0ms
(sqrt (+ (pow (pow (sin kx) 2) 3) (pow (pow (sin ky) 2) 3)))

prune1.9s

Pruning

17 alts after pruning (16 fresh and 1 done)

Merged error: 12.7b

localize37.0ms

Local error

Found 4 expressions with local error:

3.6b
(sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))
3.6b
(sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))
3.6b
(sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))
0.3b
(cbrt (/ (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2))) (sin ky)))

rewrite55.0ms

Algorithm
rewrite-expression-head
Rules
46×*-un-lft-identity
30×sqrt-prod
28×cbrt-prod
25×add-sqr-sqrt
24×times-frac
22×add-cube-cbrt
12×distribute-lft-out
12×unpow-prod-down
sqrt-div
add-log-exp
add-exp-log
add-cbrt-cube
pow1
flip-+
pow1/2
flip3-+
rem-sqrt-square
div-inv
pow1/3
cbrt-div
Counts
4 → 85
Calls
4 calls:
Slowest
15.0ms
(sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))
15.0ms
(sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))
14.0ms
(sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))
9.0ms
(cbrt (/ (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2))) (sin ky)))

series516.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
234.0ms
(cbrt (/ (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2))) (sin ky)))
104.0ms
(sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))
90.0ms
(sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))
88.0ms
(sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))

simplify1.4s

Counts
65 → 97
Calls
65 calls:
Slowest
193.0ms
(- (+ (* 1/12 (* (pow kx 2) ky)) ky) (* 1/6 (pow ky 3)))
175.0ms
(- (+ (* 1/12 (* (pow kx 2) ky)) ky) (* 1/6 (pow ky 3)))
159.0ms
(- (+ (* 1/12 (* (pow kx 2) ky)) ky) (* 1/6 (pow ky 3)))
138.0ms
(sqrt (- (* (pow (sin kx) 2) (pow (sin kx) 2)) (* (pow (sin ky) 2) (pow (sin ky) 2))))
122.0ms
(sqrt (- (* (pow (sin kx) 2) (pow (sin kx) 2)) (* (pow (sin ky) 2) (pow (sin ky) 2))))

prune1.8s

Pruning

20 alts after pruning (19 fresh and 1 done)

Merged error: 12.7b

regimes1.6s

Accuracy

64.7% (0.4b remaining)

Error of 12.4b against oracle of 11.9b and baseline of 13.1b

bsearch6.0ms

end0.0ms

sample12.4s

Algorithm
intervals