Average Error: 25.5 → 17.4
Time: 1.5m
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.5320809787726 \cdot 10^{-310}:\\ \;\;\;\;\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) \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)\\ \mathbf{elif}\;\ell \le 1.720803034800728 \cdot 10^{-34}:\\ \;\;\;\;\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) \cdot \left(\left({\left(\frac{1}{\ell}\right)}^{\frac{1}{2}} \cdot \sqrt{d}\right) \cdot {\left(\frac{d}{h}\right)}^{\frac{1}{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\sqrt{d} \cdot {\left(\frac{1}{h}\right)}^{\frac{1}{2}}\right) \cdot {\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\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 3 regimes
  2. if l < -1.5320809787726e-310

    1. Initial program 25.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-inv25.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*24.9

      \[\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)\]
    5. Taylor expanded around -inf 22.1

      \[\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(\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h\right) \cdot \frac{1}{\ell}\right)\]
    6. Simplified18.7

      \[\leadsto \left(\color{blue}{\left({\left(\frac{-1}{d}\right)}^{\frac{-1}{2}} \cdot \sqrt{\frac{-1}{h}}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \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 -1.5320809787726e-310 < l < 1.720803034800728e-34

    1. Initial program 26.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. Using strategy rm
    3. Applied div-inv26.4

      \[\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.2

      \[\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)\]
    5. Using strategy rm
    6. Applied div-inv21.3

      \[\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(\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h\right) \cdot \frac{1}{\ell}\right)\]
    7. Applied unpow-prod-down12.3

      \[\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(\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h\right) \cdot \frac{1}{\ell}\right)\]
    8. Simplified12.3

      \[\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(\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 1.720803034800728e-34 < l

    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. Using strategy rm
    3. Applied div-inv25.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-down17.6

      \[\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. Simplified17.6

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

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

Reproduce

herbie shell --seed 2019008 
(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: 1.4m)Debug log

sample1.2s

Algorithm
intervals

simplify131.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune13.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 26.6b

localize61.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))))

rewrite35.0ms

Algorithm
rewrite-expression-head
Counts
4 → 91
Calls

4 calls. Slowest were:

20.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 h) (/ 1 2))

series397.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

225.0ms
(* (* (pow (/ d h) (/ 1 2)) (pow (/ d l) (/ 1 2))) (- 1 (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (/ h l))))
60.0ms
(pow (/ d h) (/ 1 2))
59.0ms
(pow (/ d l) (/ 1 2))
53.0ms
(* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (/ h l))

simplify7.0s

Counts
71 → 103
Calls

71 calls. Slowest were:

543.0ms
(* (* 1 (pow (/ (* M D) (* 2 d)) 2)) h)
443.0ms
(sqrt (- 1 (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (/ h l))))
424.0ms
(+ (+ (log (/ 1 2)) (log (pow (/ (* M D) (* 2 d)) 2))) (log (/ h l)))

prune1.9s

Pruning

22 alts after pruning (22 fresh and 0 done)

Merged error: 13.2b

localize29.0ms

Local error

Found 4 expressions with local error:

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

rewrite90.0ms

Algorithm
rewrite-expression-head
Counts
4 → 87
Calls

4 calls. Slowest were:

47.0ms
(* (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h) (/ 1 l))
30.0ms
(* (* (pow (/ d h) (/ 1 2)) (pow (/ d l) (/ 1 2))) (- 1 (* (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h) (/ 1 l))))
7.0ms
(pow (/ d h) (/ 1 2))

series487.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

222.0ms
(* (* (pow (/ d h) (/ 1 2)) (pow (/ d l) (/ 1 2))) (- 1 (* (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h) (/ 1 l))))
103.0ms
(pow (/ d h) (/ 1 2))
81.0ms
(* (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h) (/ 1 l))
80.0ms
(pow (/ d l) (/ 1 2))

simplify8.4s

Counts
66 → 99
Calls

66 calls. Slowest were:

644.0ms
(* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2))
559.0ms
(* (* (* 1 (pow (/ (* M D) (* 2 d)) 2)) h) 1)
371.0ms
(* (* (* (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h) (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h)) (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h)) (* (* (/ 1 l) (/ 1 l)) (/ 1 l)))

prune2.1s

Pruning

23 alts after pruning (23 fresh and 0 done)

Merged error: 10.7b

localize53.0ms

Local error

Found 4 expressions with local error:

15.0b
(pow (/ d h) (/ 1 2))
15.0b
(sqrt (/ d h))
11.1b
(* (/ (/ M 2) (/ d D)) (/ (* 1/2 h) l))
10.4b
(* (* (- (sqrt (/ d h))) (sqrt (/ d l))) (* (/ (/ M 2) (/ d D)) (* (/ (/ M 2) (/ d D)) (/ (* 1/2 h) l))))

rewrite62.0ms

Algorithm
rewrite-expression-head
Counts
4 → 149
Calls

4 calls. Slowest were:

49.0ms
(* (* (- (sqrt (/ d h))) (sqrt (/ d l))) (* (/ (/ M 2) (/ d D)) (* (/ (/ M 2) (/ d D)) (/ (* 1/2 h) l))))
6.0ms
(* (/ (/ M 2) (/ d D)) (/ (* 1/2 h) l))
1.0ms
(pow (/ d h) (/ 1 2))

series418.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

244.0ms
(* (* (- (sqrt (/ d h))) (sqrt (/ d l))) (* (/ (/ M 2) (/ d D)) (* (/ (/ M 2) (/ d D)) (/ (* 1/2 h) l))))
88.0ms
(pow (/ d h) (/ 1 2))
57.0ms
(* (/ (/ M 2) (/ d D)) (/ (* 1/2 h) l))
28.0ms
(sqrt (/ d h))

simplify22.9s

Counts
148 → 161
Calls

148 calls. Slowest were:

1.2s
(* (* (* (* (- (sqrt (/ d h))) (- (sqrt (/ d h)))) (- (sqrt (/ d h)))) (* (* (sqrt (/ d l)) (sqrt (/ d l))) (sqrt (/ d l)))) (* (/ (* (* (/ M 2) (/ M 2)) (/ M 2)) (* (* (/ d D) (/ d D)) (/ d D))) (* (* (* (/ (/ M 2) (/ d D)) (/ (* 1/2 h) l)) (* (/ (/ M 2) (/ d D)) (/ (* 1/2 h) l))) (* (/ (/ M 2) (/ d D)) (/ (* 1/2 h) l)))))
932.0ms
(* (* (* (* (- (sqrt (/ d h))) (sqrt (/ d l))) (* (- (sqrt (/ d h))) (sqrt (/ d l)))) (* (- (sqrt (/ d h))) (sqrt (/ d l)))) (* (/ (* (* (/ M 2) (/ M 2)) (/ M 2)) (* (* (/ d D) (/ d D)) (/ d D))) (* (/ (* (* (/ M 2) (/ M 2)) (/ M 2)) (* (* (/ d D) (/ d D)) (/ d D))) (* (* (/ (* 1/2 h) l) (/ (* 1/2 h) l)) (/ (* 1/2 h) l)))))
888.0ms
(* (* (* (* (- (sqrt (/ d h))) (sqrt (/ d l))) (* (- (sqrt (/ d h))) (sqrt (/ d l)))) (* (- (sqrt (/ d h))) (sqrt (/ d l)))) (* (* (* (/ (/ M 2) (/ d D)) (/ (/ M 2) (/ d D))) (/ (/ M 2) (/ d D))) (* (/ (* (* (/ M 2) (/ M 2)) (/ M 2)) (* (* (/ d D) (/ d D)) (/ d D))) (* (* (/ (* 1/2 h) l) (/ (* 1/2 h) l)) (/ (* 1/2 h) l)))))

prune4.2s

Pruning

33 alts after pruning (33 fresh and 0 done)

Merged error: 6.0b

localize21.0ms

Local error

Found 4 expressions with local error:

15.0b
(pow (/ d h) (/ 1 2))
15.0b
(sqrt (/ d h))
9.8b
(pow (/ d l) (/ 1 2))
9.8b
(sqrt (/ d l))

rewrite8.0ms

Algorithm
rewrite-expression-head
Counts
4 → 64
Calls

4 calls. Slowest were:

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

series226.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

85.0ms
(pow (/ d l) (/ 1 2))
76.0ms
(pow (/ d h) (/ 1 2))
39.0ms
(sqrt (/ d h))
26.0ms
(sqrt (/ d l))

simplify865.0ms

Counts
44 → 76
Calls

44 calls. Slowest were:

174.0ms
(exp (* 1/2 (- (log (/ 1 h)) (log (/ 1 d)))))
169.0ms
(exp (* 1/2 (- (log (/ 1 l)) (log (/ 1 d)))))
106.0ms
(exp (* 1/2 (- (log (/ -1 h)) (log (/ -1 d)))))

prune1.6s

Pruning

32 alts after pruning (32 fresh and 0 done)

Merged error: 6.0b

regimes2.7s

Accuracy

38.9% (11.0b remaining)

Error of 17.4b against oracle of 6.3b and baseline of 24.4b

bsearch9.0s

end0.0ms

sample22.7s

Algorithm
intervals