Average Error: 1.6 → 0.9
Time: 31.5s
Precision: 64
Internal Precision: 128
\[\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}\right)}}\right)}\]
\[\begin{array}{l} \mathbf{if}\;{\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \le 3.8440257130994246 \cdot 10^{+307}:\\ \;\;\;\;\sqrt{\frac{1}{2} \cdot \left(1 + \frac{\frac{1}{\sqrt[3]{\sqrt{\left({\left(\sin ky\right)}^{2} + {\left(\sin kx\right)}^{2}\right) \cdot {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} + 1}} \cdot \sqrt[3]{\sqrt{\left({\left(\sin ky\right)}^{2} + {\left(\sin kx\right)}^{2}\right) \cdot {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} + 1}}}}{\sqrt[3]{\sqrt{\left({\left(\sin ky\right)}^{2} + {\left(\sin kx\right)}^{2}\right) \cdot {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} + 1}}}\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{1}{2} \cdot \left(\frac{1}{\sqrt{1 + \left(\frac{ky}{Om} \cdot \frac{ky}{Om} + \frac{kx}{Om} \cdot \frac{kx}{Om}\right) \cdot \left(\left(\ell \cdot \ell\right) \cdot 4\right)}} + 1\right)}\\ \end{array}\]

Error

Bits error versus l

Bits error versus Om

Bits error versus kx

Bits error versus ky

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (pow (/ (* 2 l) Om) 2) < 3.8440257130994246e+307

    1. Initial program 1.0

      \[\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}\right)}}\right)}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt1.0

      \[\leadsto \sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\color{blue}{\left(\sqrt[3]{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}\right)}} \cdot \sqrt[3]{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}\right)}}\right) \cdot \sqrt[3]{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}\right)}}}}\right)}\]
    4. Applied associate-/r*1.0

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

    if 3.8440257130994246e+307 < (pow (/ (* 2 l) Om) 2)

    1. Initial program 3.4

      \[\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}\right)}}\right)}\]
    2. Taylor expanded around 0 23.1

      \[\leadsto \sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + \color{blue}{\left(4 \cdot \frac{{kx}^{2} \cdot {\ell}^{2}}{{Om}^{2}} + 4 \cdot \frac{{ky}^{2} \cdot {\ell}^{2}}{{Om}^{2}}\right)}}}\right)}\]
    3. Simplified0.8

      \[\leadsto \sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + \color{blue}{\left(\left(\ell \cdot \ell\right) \cdot 4\right) \cdot \left(\frac{ky}{Om} \cdot \frac{ky}{Om} + \frac{kx}{Om} \cdot \frac{kx}{Om}\right)}}}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \le 3.8440257130994246 \cdot 10^{+307}:\\ \;\;\;\;\sqrt{\frac{1}{2} \cdot \left(1 + \frac{\frac{1}{\sqrt[3]{\sqrt{\left({\left(\sin ky\right)}^{2} + {\left(\sin kx\right)}^{2}\right) \cdot {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} + 1}} \cdot \sqrt[3]{\sqrt{\left({\left(\sin ky\right)}^{2} + {\left(\sin kx\right)}^{2}\right) \cdot {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} + 1}}}}{\sqrt[3]{\sqrt{\left({\left(\sin ky\right)}^{2} + {\left(\sin kx\right)}^{2}\right) \cdot {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} + 1}}}\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{1}{2} \cdot \left(\frac{1}{\sqrt{1 + \left(\frac{ky}{Om} \cdot \frac{ky}{Om} + \frac{kx}{Om} \cdot \frac{kx}{Om}\right) \cdot \left(\left(\ell \cdot \ell\right) \cdot 4\right)}} + 1\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2019010 
(FPCore (l Om kx ky)
  :name "Toniolo and Linder, Equation (3a)"
  (sqrt (* (/ 1 2) (+ 1 (/ 1 (sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2))))))))))

Details

Time bar (total: 30.9s)Debug log

sample100.0ms

Algorithm
intervals

simplify289.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
288.0ms
(sqrt (* (/ 1 2) (+ 1 (/ 1 (sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2)))))))))

prune13.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 2.0b

localize59.0ms

Local error

Found 4 expressions with local error:

10.7b
(sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2)))))
2.6b
(* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2)))
0.3b
(/ 1 (sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2))))))
0.3b
(pow (sin kx) 2)

rewrite39.0ms

Algorithm
rewrite-expression-head
Rules
15×*-un-lft-identity
12×add-sqr-sqrt
11×add-cube-cbrt
11×add-exp-log
unpow-prod-down
associate-*l*
sqrt-prod
add-cbrt-cube
associate-/r*
pow1
associate-*r*
add-log-exp
sqrt-div
flip-+
prod-exp
flip3-+
unpow2
distribute-lft-out
pow-flip
div-inv
associate-/r/
associate-*r/
pow-exp
pow1/2
pow-to-exp
inv-pow
cbrt-unprod
*-commutative
distribute-lft-in
frac-2neg
pow-pow
clear-num
rec-exp
rem-sqrt-square
distribute-rgt-in
Counts
4 → 79
Calls
4 calls:
Slowest
26.0ms
(* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2)))
4.0ms
(sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2)))))
2.0ms
(/ 1 (sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2))))))
2.0ms
(pow (sin kx) 2)

series1.2s

Counts
4 → 12
Calls
4 calls:
Slowest
642.0ms
(sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2)))))
337.0ms
(/ 1 (sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2))))))
186.0ms
(* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2)))
27.0ms
(pow (sin kx) 2)

simplify5.9s

Counts
53 → 91
Calls
53 calls:
Slowest
512.0ms
(* (pow (/ (* 2 l) Om) 2) (pow (sin ky) 2))
431.0ms
(* (pow (sin ky) 2) (pow (/ (* 2 l) Om) 2))
360.0ms
(sqrt (- 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2)))))
316.0ms
(+ (* 4 (/ (* (pow kx 2) (pow l 2)) (pow Om 2))) (* 4 (/ (* (pow ky 2) (pow l 2)) (pow Om 2))))
286.0ms
(sqrt (sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2))))))

prune1.7s

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.7b

localize32.0ms

Local error

Found 4 expressions with local error:

10.7b
(sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2)))))
10.7b
(sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2)))))
10.7b
(sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2)))))
8.3b
(cbrt (sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2))))))

rewrite7.0ms

Algorithm
rewrite-expression-head
Rules
12×sqrt-prod
12×add-sqr-sqrt
add-cube-cbrt
*-un-lft-identity
sqrt-div
cbrt-prod
add-log-exp
flip-+
add-exp-log
add-cbrt-cube
flip3-+
pow1
pow1/2
rem-sqrt-square
cbrt-div
pow1/3
Counts
4 → 58
Calls
4 calls:
Slowest
2.0ms
(cbrt (sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2))))))
1.0ms
(sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2)))))
1.0ms
(sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2)))))
1.0ms
(sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2)))))

series1.0s

Counts
4 → 12
Calls
4 calls:
Slowest
330.0ms
(cbrt (sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2))))))
249.0ms
(sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2)))))
231.0ms
(sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2)))))
206.0ms
(sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2)))))

simplify4.2s

Counts
38 → 70
Calls
38 calls:
Slowest
244.0ms
(sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2)))))
242.0ms
(exp (* 1/6 (- (+ (* 2 (log (/ 1 Om))) (log (+ (* 4 (pow (sin ky) 2)) (* 4 (pow (sin kx) 2))))) (* 2 (log (/ 1 l))))))
232.0ms
(sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2)))))
231.0ms
(cbrt (sqrt (sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2)))))))
228.0ms
(sqrt (sqrt (+ 1 (* (pow (/ (* 2 l) Om) 2) (+ (pow (sin kx) 2) (pow (sin ky) 2))))))

prune1.8s

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0.7b

localize46.0ms

Local error

Found 4 expressions with local error:

12.2b
(sqrt (+ 1 (* (* (* l l) 4) (+ (* (/ ky Om) (/ ky Om)) (* (/ kx Om) (/ kx Om))))))
11.7b
(* (* (* l l) 4) (+ (* (/ ky Om) (/ ky Om)) (* (/ kx Om) (/ kx Om))))
0.5b
(/ 1 (sqrt (+ 1 (* (* (* l l) 4) (+ (* (/ ky Om) (/ ky Om)) (* (/ kx Om) (/ kx Om)))))))
0.2b
(* (/ ky Om) (/ ky Om))

rewrite22.0ms

Algorithm
rewrite-expression-head
Rules
18×associate-*r/
12×pow1
11×add-sqr-sqrt
10×add-cube-cbrt
10×*-un-lft-identity
add-exp-log
frac-add
add-cbrt-cube
associate-*l/
associate-*r*
frac-times
sqrt-prod
associate-/r*
associate-*l*
add-log-exp
sqrt-div
div-inv
flip-+
flip3-+
pow-flip
cbrt-unprod
*-commutative
associate-/r/
prod-exp
pow-prod-down
pow1/2
inv-pow
pow-prod-up
pow-plus
distribute-lft-in
frac-2neg
clear-num
rec-exp
rem-sqrt-square
distribute-rgt-in
pow2
Counts
4 → 89
Calls
4 calls:
Slowest
13.0ms
(* (* (* l l) 4) (+ (* (/ ky Om) (/ ky Om)) (* (/ kx Om) (/ kx Om))))
5.0ms
(* (/ ky Om) (/ ky Om))
1.0ms
(/ 1 (sqrt (+ 1 (* (* (* l l) 4) (+ (* (/ ky Om) (/ ky Om)) (* (/ kx Om) (/ kx Om)))))))
1.0ms
(sqrt (+ 1 (* (* (* l l) 4) (+ (* (/ ky Om) (/ ky Om)) (* (/ kx Om) (/ kx Om))))))

series438.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
160.0ms
(sqrt (+ 1 (* (* (* l l) 4) (+ (* (/ ky Om) (/ ky Om)) (* (/ kx Om) (/ kx Om))))))
131.0ms
(/ 1 (sqrt (+ 1 (* (* (* l l) 4) (+ (* (/ ky Om) (/ ky Om)) (* (/ kx Om) (/ kx Om)))))))
124.0ms
(* (* (* l l) 4) (+ (* (/ ky Om) (/ ky Om)) (* (/ kx Om) (/ kx Om))))
23.0ms
(* (/ ky Om) (/ ky Om))

simplify7.8s

Counts
63 → 101
Calls
63 calls:
Slowest
953.0ms
(* (* (* (/ ky Om) (/ ky Om)) (/ ky Om)) (* (* (/ ky Om) (/ ky Om)) (/ ky Om)))
597.0ms
(+ (* 4 (/ (* (pow kx 2) (pow l 2)) (pow Om 2))) (* 4 (/ (* (pow ky 2) (pow l 2)) (pow Om 2))))
479.0ms
(* (* (/ kx Om) (/ kx Om)) (* (* l l) 4))
413.0ms
(sqrt (+ (* 1 1) (- (* (* (* (* l l) 4) (+ (* (/ ky Om) (/ ky Om)) (* (/ kx Om) (/ kx Om)))) (* (* (* l l) 4) (+ (* (/ ky Om) (/ ky Om)) (* (/ kx Om) (/ kx Om))))) (* 1 (* (* (* l l) 4) (+ (* (/ ky Om) (/ ky Om)) (* (/ kx Om) (/ kx Om))))))))
406.0ms
(sqrt (sqrt (+ 1 (* (* (* l l) 4) (+ (* (/ ky Om) (/ ky Om)) (* (/ kx Om) (/ kx Om)))))))

prune1.6s

Pruning

2 alts after pruning (0 fresh and 2 done)

Merged error: 0.7b

regimes804.0ms

Accuracy

91.5% (0.1b remaining)

Error of 0.9b against oracle of 0.8b and baseline of 1.6b

bsearch17.0ms

end0.0ms

sample3.7s

Algorithm
intervals