Average Error: 25.5 → 17.4
Time: 55.2s
Precision: 64
Internal Precision: 128
\[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\]
\[\begin{array}{l} \mathbf{if}\;\ell \le -1.503784793063004 \cdot 10^{-34}:\\ \;\;\;\;\left(1 - \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left(\left({\left(\frac{-1}{d}\right)}^{\frac{-1}{2}} \cdot \sqrt{\frac{-1}{h}}\right) \cdot {\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}\right)\\ \mathbf{elif}\;\ell \le 7.035144094276047 \cdot 10^{-40}:\\ \;\;\;\;\left({\left(\frac{d}{\ell}\right)}^{\frac{1}{2}} \cdot {\left(\frac{d}{h}\right)}^{\frac{1}{2}}\right) \cdot \left(1 - \frac{1}{\ell} \cdot \left(h \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{(\left(\frac{-1}{2} \cdot \left(\left(\frac{M}{2} \cdot \frac{D}{d}\right) \cdot \left(\frac{M}{2} \cdot \frac{D}{d}\right)\right)\right) \cdot \left(\frac{h}{\ell}\right) + 1)_* \cdot \left(\sqrt{d} \cdot \sqrt{d}\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array}\]

Error

Bits error versus d

Bits error versus h

Bits error versus l

Bits error versus M

Bits error versus D

Derivation

  1. Split input into 3 regimes
  2. if l < -1.503784793063004e-34

    1. Initial program 25.1

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\]
    2. Taylor expanded around -inf 21.0

      \[\leadsto \left(\color{blue}{e^{\frac{1}{2} \cdot \left(\log \left(\frac{-1}{h}\right) - \log \left(\frac{-1}{d}\right)\right)}} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\]
    3. Simplified17.5

      \[\leadsto \left(\color{blue}{\left(\sqrt{\frac{-1}{h}} \cdot {\left(\frac{-1}{d}\right)}^{\frac{-1}{2}}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\]

    if -1.503784793063004e-34 < l < 7.035144094276047e-40

    1. Initial program 26.7

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\]
    2. Using strategy rm
    3. Applied div-inv26.7

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\left(h \cdot \frac{1}{\ell}\right)}\right)\]
    4. Applied associate-*r*21.6

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h\right) \cdot \frac{1}{\ell}}\right)\]

    if 7.035144094276047e-40 < l

    1. Initial program 25.0

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\]
    2. Simplified25.4

      \[\leadsto \color{blue}{(\left(\left(\left(\frac{M}{2} \cdot \frac{D}{d}\right) \cdot \left(\frac{M}{2} \cdot \frac{D}{d}\right)\right) \cdot \frac{-1}{2}\right) \cdot \left(\frac{h}{\ell}\right) + 1)_* \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)}\]
    3. Using strategy rm
    4. Applied sqrt-div17.6

      \[\leadsto (\left(\left(\left(\frac{M}{2} \cdot \frac{D}{d}\right) \cdot \left(\frac{M}{2} \cdot \frac{D}{d}\right)\right) \cdot \frac{-1}{2}\right) \cdot \left(\frac{h}{\ell}\right) + 1)_* \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{h}}}\right)\]
    5. Applied sqrt-div14.2

      \[\leadsto (\left(\left(\left(\frac{M}{2} \cdot \frac{D}{d}\right) \cdot \left(\frac{M}{2} \cdot \frac{D}{d}\right)\right) \cdot \frac{-1}{2}\right) \cdot \left(\frac{h}{\ell}\right) + 1)_* \cdot \left(\color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}}} \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\]
    6. Applied frac-times14.2

      \[\leadsto (\left(\left(\left(\frac{M}{2} \cdot \frac{D}{d}\right) \cdot \left(\frac{M}{2} \cdot \frac{D}{d}\right)\right) \cdot \frac{-1}{2}\right) \cdot \left(\frac{h}{\ell}\right) + 1)_* \cdot \color{blue}{\frac{\sqrt{d} \cdot \sqrt{d}}{\sqrt{\ell} \cdot \sqrt{h}}}\]
    7. Applied associate-*r/13.9

      \[\leadsto \color{blue}{\frac{(\left(\left(\left(\frac{M}{2} \cdot \frac{D}{d}\right) \cdot \left(\frac{M}{2} \cdot \frac{D}{d}\right)\right) \cdot \frac{-1}{2}\right) \cdot \left(\frac{h}{\ell}\right) + 1)_* \cdot \left(\sqrt{d} \cdot \sqrt{d}\right)}{\sqrt{\ell} \cdot \sqrt{h}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification17.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \le -1.503784793063004 \cdot 10^{-34}:\\ \;\;\;\;\left(1 - \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left(\left({\left(\frac{-1}{d}\right)}^{\frac{-1}{2}} \cdot \sqrt{\frac{-1}{h}}\right) \cdot {\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}\right)\\ \mathbf{elif}\;\ell \le 7.035144094276047 \cdot 10^{-40}:\\ \;\;\;\;\left({\left(\frac{d}{\ell}\right)}^{\frac{1}{2}} \cdot {\left(\frac{d}{h}\right)}^{\frac{1}{2}}\right) \cdot \left(1 - \frac{1}{\ell} \cdot \left(h \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{(\left(\frac{-1}{2} \cdot \left(\left(\frac{M}{2} \cdot \frac{D}{d}\right) \cdot \left(\frac{M}{2} \cdot \frac{D}{d}\right)\right)\right) \cdot \left(\frac{h}{\ell}\right) + 1)_* \cdot \left(\sqrt{d} \cdot \sqrt{d}\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019008 +o rules:numerics
(FPCore (d h l M D)
  :name "Henrywood and Agarwal, Equation (12)"
  (* (* (pow (/ d h) (/ 1 2)) (pow (/ d l) (/ 1 2))) (- 1 (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (/ h l)))))

Details

Time bar (total: 51.4s)Debug log

sample1.1s

Algorithm
intervals

simplify185.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

185.0ms
(* (* (pow (/ d h) (/ 1 2)) (pow (/ d l) (/ 1 2))) (- 1 (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (/ h l))))

prune40.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 26.4b

localize46.0ms

Local error

Found 4 expressions with local error:

15.0b
(sqrt (/ d h))
11.2b
(fma (* (* (* (/ M 2) (/ D d)) (* (/ M 2) (/ D d))) -1/2) (/ h l) 1)
9.8b
(sqrt (/ d l))
6.8b
(* (fma (* (* (* (/ M 2) (/ D d)) (* (/ M 2) (/ D d))) -1/2) (/ h l) 1) (* (sqrt (/ d l)) (sqrt (/ d h))))

rewrite16.0ms

Algorithm
rewrite-expression-head
Counts
4 → 65
Calls

4 calls. Slowest were:

13.0ms
(* (fma (* (* (* (/ M 2) (/ D d)) (* (/ M 2) (/ D d))) -1/2) (/ h l) 1) (* (sqrt (/ d l)) (sqrt (/ d h))))
1.0ms
(sqrt (/ d h))
1.0ms
(sqrt (/ d l))

series336.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

170.0ms
(* (fma (* (* (* (/ M 2) (/ D d)) (* (/ M 2) (/ D d))) -1/2) (/ h l) 1) (* (sqrt (/ d l)) (sqrt (/ d h))))
102.0ms
(fma (* (* (* (/ M 2) (/ D d)) (* (/ M 2) (/ D d))) -1/2) (/ h l) 1)
41.0ms
(sqrt (/ d h))
23.0ms
(sqrt (/ d l))

simplify3.1s

Counts
36 → 77
Calls

36 calls. Slowest were:

864.0ms
(* (cbrt (fma (* (* (* (/ M 2) (/ D d)) (* (/ M 2) (/ D d))) -1/2) (/ h l) 1)) (cbrt (fma (* (* (* (/ M 2) (/ D d)) (* (/ M 2) (/ D d))) -1/2) (/ h l) 1)))
611.0ms
(+ (log (fma (* (* (* (/ M 2) (/ D d)) (* (/ M 2) (/ D d))) -1/2) (/ h l) 1)) (+ (log (sqrt (/ d l))) (log (sqrt (/ d h)))))
541.0ms
(+ (log (fma (* (* (* (/ M 2) (/ D d)) (* (/ M 2) (/ D d))) -1/2) (/ h l) 1)) (log (* (sqrt (/ d l)) (sqrt (/ d h)))))

prune1.5s

Pruning

20 alts after pruning (20 fresh and 0 done)

Merged error: 21.1b

localize20.0ms

Local error

Found 4 expressions with local error:

15.0b
(sqrt (/ d h))
11.2b
(fma (* (* (* (/ M 2) (/ D d)) (* (/ M 2) (/ D d))) -1/2) (/ h l) 1)
9.8b
(sqrt (/ d l))
9.8b
(sqrt (/ d l))

rewrite6.0ms

Algorithm
rewrite-expression-head
Counts
4 → 58
Calls

4 calls. Slowest were:

2.0ms
(sqrt (/ d h))
1.0ms
(sqrt (/ d l))
1.0ms
(sqrt (/ d l))

series141.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

62.0ms
(fma (* (* (* (/ M 2) (/ D d)) (* (/ M 2) (/ D d))) -1/2) (/ h l) 1)
28.0ms
(sqrt (/ d h))
27.0ms
(sqrt (/ d l))
24.0ms
(sqrt (/ d l))

simplify116.0ms

Counts
30 → 70
Calls

30 calls. Slowest were:

92.0ms
(- 1 (* 1/8 (/ (* (pow M 2) (* (pow D 2) h)) (* l (pow d 2)))))
2.0ms
(sqrt (* (cbrt (/ d h)) (cbrt (/ d h))))
2.0ms
(sqrt (* (cbrt (/ d l)) (cbrt (/ d l))))

prune1.5s

Pruning

20 alts after pruning (20 fresh and 0 done)

Merged error: 21.1b

localize24.0ms

Local error

Found 4 expressions with local error:

15.0b
(sqrt (/ d h))
15.0b
(sqrt (/ d h))
11.2b
(fma (* (* (* (/ M 2) (/ D d)) (* (/ M 2) (/ D d))) -1/2) (/ h l) 1)
9.8b
(sqrt (/ d l))

rewrite3.0ms

Algorithm
rewrite-expression-head
Counts
4 → 58
Calls

4 calls. Slowest were:

1.0ms
(sqrt (/ d h))
1.0ms
(sqrt (/ d h))
1.0ms
(sqrt (/ d l))

series155.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

68.0ms
(fma (* (* (* (/ M 2) (/ D d)) (* (/ M 2) (/ D d))) -1/2) (/ h l) 1)
31.0ms
(sqrt (/ d h))
28.0ms
(sqrt (/ d l))
27.0ms
(sqrt (/ d h))

simplify147.0ms

Counts
30 → 70
Calls

30 calls. Slowest were:

107.0ms
(- 1 (* 1/8 (/ (* (pow M 2) (* (pow D 2) h)) (* l (pow d 2)))))
5.0ms
(sqrt (* (cbrt (/ d h)) (cbrt (/ d h))))
4.0ms
(sqrt (* (cbrt (/ d h)) (cbrt (/ d h))))

prune1.4s

Pruning

20 alts after pruning (19 fresh and 1 done)

Merged error: 21.1b

localize66.0ms

Local error

Found 4 expressions with local error:

15.0b
(pow (/ d h) (/ 1 2))
13.4b
(* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (/ h l))
9.8b
(pow (/ d l) (/ 1 2))
6.8b
(* (* (pow (/ d h) (/ 1 2)) (pow (/ d l) (/ 1 2))) (- 1 (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (/ h l))))

rewrite31.0ms

Algorithm
rewrite-expression-head
Counts
4 → 99
Calls

4 calls. Slowest were:

15.0ms
(* (* (pow (/ d h) (/ 1 2)) (pow (/ d l) (/ 1 2))) (- 1 (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (/ h l))))
11.0ms
(* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (/ h l))
3.0ms
(pow (/ d h) (/ 1 2))

series460.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

227.0ms
(* (* (pow (/ d h) (/ 1 2)) (pow (/ d l) (/ 1 2))) (- 1 (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (/ h l))))
80.0ms
(pow (/ d h) (/ 1 2))
79.0ms
(pow (/ d l) (/ 1 2))
75.0ms
(* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (/ h l))

simplify7.4s

Counts
71 → 111
Calls

71 calls. Slowest were:

517.0ms
(* (* 1 (pow (/ (* M D) (* 2 d)) 2)) h)
447.0ms
(+ (+ (log (/ 1 2)) (log (pow (/ (* M D) (* 2 d)) 2))) (log (/ h l)))
345.0ms
(+ (* 1 1) (+ (* (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (/ h l)) (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (/ h l))) (* 1 (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (/ h l)))))

prune2.1s

Pruning

24 alts after pruning (23 fresh and 1 done)

Merged error: 13.2b

regimes2.3s

Accuracy

54.8% (6.1b remaining)

Error of 17.4b against oracle of 11.4b and baseline of 24.8b

bsearch4.0s

end0.0ms

sample25.2s

Algorithm
intervals