Average Error: 25.6 → 19.4
Time: 56.7s
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}\;h \le 3.07392795616015 \cdot 10^{-310}:\\ \;\;\;\;\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(\frac{d}{\ell}\right)}^{\frac{1}{2}} \cdot \left({\left(\frac{-1}{d}\right)}^{\frac{-1}{2}} \cdot \sqrt{\frac{-1}{h}}\right)\right)\\ \mathbf{elif}\;h \le 7.885859366515571 \cdot 10^{-126}:\\ \;\;\;\;\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(\frac{d}{\ell}\right)}^{\frac{1}{2}} \cdot \left(\sqrt{d} \cdot {\left(\frac{1}{h}\right)}^{\frac{1}{2}}\right)\right)\\ \mathbf{elif}\;h \le 7.64082611628439 \cdot 10^{+166}:\\ \;\;\;\;\left(\left({\left(\frac{1}{\ell}\right)}^{\frac{1}{2}} \cdot \sqrt{d}\right) \cdot {\left(\frac{d}{h}\right)}^{\frac{1}{2}}\right) \cdot \left(1 - \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;\left({\left(\frac{d}{h}\right)}^{\frac{1}{2}} \cdot {\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}\right) \cdot \left(1 - \left(h \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right) \cdot \frac{1}{\ell}\right)\\ \end{array}\]

Error

Bits error versus d

Bits error versus h

Bits error versus l

Bits error versus M

Bits error versus D

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if h < 3.07392795616015e-310

    1. Initial program 25.4

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

      \[\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. Simplified20.1

      \[\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 3.07392795616015e-310 < h < 7.885859366515571e-126

    1. Initial program 31.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. Using strategy rm
    3. Applied div-inv31.1

      \[\leadsto \left({\color{blue}{\left(d \cdot \frac{1}{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)\]
    4. Applied unpow-prod-down16.9

      \[\leadsto \left(\color{blue}{\left({d}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{1}{h}\right)}^{\left(\frac{1}{2}\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)\]
    5. Simplified16.9

      \[\leadsto \left(\left(\color{blue}{\sqrt{d}} \cdot {\left(\frac{1}{h}\right)}^{\left(\frac{1}{2}\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)\]

    if 7.885859366515571e-126 < h < 7.64082611628439e+166

    1. Initial program 19.9

      \[\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-inv19.9

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\color{blue}{\left(d \cdot \frac{1}{\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)\]
    4. Applied unpow-prod-down15.4

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\left({d}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{1}{\ell}\right)}^{\left(\frac{1}{2}\right)}\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)\]
    5. Simplified15.4

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(\color{blue}{\sqrt{d}} \cdot {\left(\frac{1}{\ell}\right)}^{\left(\frac{1}{2}\right)}\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 7.64082611628439e+166 < h

    1. Initial program 31.6

      \[\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-inv31.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 - \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*27.8

      \[\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)\]
  3. Recombined 4 regimes into one program.
  4. Final simplification19.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \le 3.07392795616015 \cdot 10^{-310}:\\ \;\;\;\;\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(\frac{d}{\ell}\right)}^{\frac{1}{2}} \cdot \left({\left(\frac{-1}{d}\right)}^{\frac{-1}{2}} \cdot \sqrt{\frac{-1}{h}}\right)\right)\\ \mathbf{elif}\;h \le 7.885859366515571 \cdot 10^{-126}:\\ \;\;\;\;\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(\frac{d}{\ell}\right)}^{\frac{1}{2}} \cdot \left(\sqrt{d} \cdot {\left(\frac{1}{h}\right)}^{\frac{1}{2}}\right)\right)\\ \mathbf{elif}\;h \le 7.64082611628439 \cdot 10^{+166}:\\ \;\;\;\;\left(\left({\left(\frac{1}{\ell}\right)}^{\frac{1}{2}} \cdot \sqrt{d}\right) \cdot {\left(\frac{d}{h}\right)}^{\frac{1}{2}}\right) \cdot \left(1 - \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;\left({\left(\frac{d}{h}\right)}^{\frac{1}{2}} \cdot {\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}\right) \cdot \left(1 - \left(h \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right) \cdot \frac{1}{\ell}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019005 +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: 52.7s)Debug log

sample1.1s

Algorithm
intervals

simplify121.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune19.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 23.5b

localize54.0ms

Local error

Found 4 expressions with local error:

11.7b
(pow (/ d l) (/ 1 2))
11.2b
(pow (/ d h) (/ 1 2))
10.8b
(* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (/ h l))
6.0b
(* (* (pow (/ d h) (/ 1 2)) (pow (/ d l) (/ 1 2))) (- 1 (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (/ h l))))

rewrite29.0ms

Algorithm
rewrite-expression-head
Counts
4 → 99
Calls

4 calls. Slowest were:

14.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))
1.0ms
(pow (/ d l) (/ 1 2))

series385.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

180.0ms
(* (* (pow (/ d h) (/ 1 2)) (pow (/ d l) (/ 1 2))) (- 1 (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (/ h l))))
79.0ms
(* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (/ h l))
65.0ms
(pow (/ d l) (/ 1 2))
61.0ms
(pow (/ d h) (/ 1 2))

simplify6.3s

Counts
71 → 111
Calls

71 calls. Slowest were:

653.0ms
(* (* 1 (pow (/ (* M D) (* 2 d)) 2)) h)
320.0ms
(+ (+ (log (/ 1 2)) (log (pow (/ (* M D) (* 2 d)) 2))) (log (/ h l)))
315.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.0s

Pruning

22 alts after pruning (22 fresh and 0 done)

Merged error: 10.8b

localize34.0ms

Local error

Found 4 expressions with local error:

15.2b
(cbrt (/ h l))
15.2b
(cbrt (/ h l))
15.2b
(cbrt (/ h l))
11.7b
(pow (/ d l) (/ 1 2))

rewrite6.0ms

Algorithm
rewrite-expression-head
Counts
4 → 65
Calls

4 calls. Slowest were:

3.0ms
(pow (/ d l) (/ 1 2))
1.0ms
(cbrt (/ h l))
1.0ms
(cbrt (/ h l))

series288.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

89.0ms
(pow (/ d l) (/ 1 2))
76.0ms
(cbrt (/ h l))
64.0ms
(cbrt (/ h l))
59.0ms
(cbrt (/ h l))

simplify1.8s

Counts
37 → 77
Calls

37 calls. Slowest were:

228.0ms
(exp (* 1/3 (- (log (/ 1 l)) (log (/ 1 h)))))
212.0ms
(exp (* 1/3 (- (log (/ 1 l)) (log (/ 1 h)))))
206.0ms
(exp (* 1/2 (- (log (/ 1 l)) (log (/ 1 d)))))

prune2.0s

Pruning

22 alts after pruning (21 fresh and 1 done)

Merged error: 10.8b

localize37.0ms

Local error

Found 4 expressions with local error:

15.2b
(cbrt (/ h l))
15.2b
(cbrt (/ h l))
14.6b
(sqrt (/ h l))
14.6b
(sqrt (/ h l))

rewrite5.0ms

Algorithm
rewrite-expression-head
Counts
4 → 62
Calls

4 calls. Slowest were:

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

series246.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

94.0ms
(cbrt (/ h l))
90.0ms
(cbrt (/ h l))
39.0ms
(sqrt (/ h l))
23.0ms
(sqrt (/ h l))

simplify916.0ms

Counts
34 → 74
Calls

34 calls. Slowest were:

265.0ms
(exp (* 1/3 (- (log (/ 1 l)) (log (/ 1 h)))))
213.0ms
(exp (* 1/3 (- (log (/ 1 l)) (log (/ 1 h)))))
164.0ms
(exp (* 1/3 (- (log (/ -1 l)) (log (/ -1 h)))))

prune2.1s

Pruning

23 alts after pruning (21 fresh and 2 done)

Merged error: 10.8b

localize23.0ms

Local error

Found 4 expressions with local error:

15.2b
(cbrt (/ h l))
14.6b
(sqrt (/ h l))
14.6b
(sqrt (/ h l))
11.7b
(pow (/ d l) (/ 1 2))

rewrite4.0ms

Algorithm
rewrite-expression-head
Counts
4 → 67
Calls

4 calls. Slowest were:

1.0ms
(pow (/ d l) (/ 1 2))
1.0ms
(sqrt (/ h l))
1.0ms
(sqrt (/ h l))

series218.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

82.0ms
(pow (/ d l) (/ 1 2))
81.0ms
(cbrt (/ h l))
32.0ms
(sqrt (/ h l))
22.0ms
(sqrt (/ h l))

simplify947.0ms

Counts
39 → 79
Calls

39 calls. Slowest were:

232.0ms
(exp (* 1/3 (- (log (/ 1 l)) (log (/ 1 h)))))
184.0ms
(exp (* 1/2 (- (log (/ -1 l)) (log (/ -1 d)))))
162.0ms
(exp (* 1/2 (- (log (/ 1 l)) (log (/ 1 d)))))

prune2.1s

Pruning

23 alts after pruning (20 fresh and 3 done)

Merged error: 10.8b

regimes1.9s

Accuracy

46.5% (7.3b remaining)

Error of 19.4b against oracle of 12.1b and baseline of 25.7b

bsearch4.4s

end0.0ms

sample25.7s

Algorithm
intervals