Average Error: 25.3 → 18.0
Time: 1.6m
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 -3.03839147653203 \cdot 10^{-310}:\\ \;\;\;\;\left(1 - \frac{h \cdot \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)}{\ell}\right) \cdot \left(\left({\left(\frac{-1}{d}\right)}^{\frac{-1}{2}} \cdot \sqrt{\frac{-1}{h}}\right) \cdot \left(\sqrt{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}} \cdot \sqrt{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}}\right)\right)\\ \mathbf{elif}\;\ell \le 3.614489694183029 \cdot 10^{-159} \lor \neg \left(\ell \le 3.5173309634232524 \cdot 10^{+176}\right):\\ \;\;\;\;\left(1 - \frac{h \cdot \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)}{\ell}\right) \cdot \left(\left(\sqrt{d} \cdot {\left(\frac{1}{\ell}\right)}^{\frac{1}{2}}\right) \cdot {\left(\frac{d}{h}\right)}^{\frac{1}{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 - \frac{h \cdot \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)}{\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)\\ \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 < -3.03839147653203e-310

    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. Using strategy rm
    3. Applied associate-*r/24.1

      \[\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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right)\]
    4. Using strategy rm
    5. Applied add-sqr-sqrt24.3

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\left(\sqrt{{\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}} \cdot \sqrt{{\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}}\right)}\right) \cdot \left(1 - \frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}\right)\]
    6. Taylor expanded around -inf 21.6

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

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

    if -3.03839147653203e-310 < l < 3.614489694183029e-159 or 3.5173309634232524e+176 < l

    1. Initial program 31.8

      \[\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 associate-*r/31.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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right)\]
    4. Using strategy rm
    5. Applied div-inv31.2

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

    if 3.614489694183029e-159 < l < 3.5173309634232524e+176

    1. Initial program 21.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 associate-*r/20.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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right)\]
    4. Using strategy rm
    5. Applied div-inv20.6

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

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

      \[\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 - \frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}\right)\]
  3. Recombined 3 regimes into one program.
  4. Final simplification18.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \le -3.03839147653203 \cdot 10^{-310}:\\ \;\;\;\;\left(1 - \frac{h \cdot \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)}{\ell}\right) \cdot \left(\left({\left(\frac{-1}{d}\right)}^{\frac{-1}{2}} \cdot \sqrt{\frac{-1}{h}}\right) \cdot \left(\sqrt{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}} \cdot \sqrt{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}}\right)\right)\\ \mathbf{elif}\;\ell \le 3.614489694183029 \cdot 10^{-159} \lor \neg \left(\ell \le 3.5173309634232524 \cdot 10^{+176}\right):\\ \;\;\;\;\left(1 - \frac{h \cdot \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)}{\ell}\right) \cdot \left(\left(\sqrt{d} \cdot {\left(\frac{1}{\ell}\right)}^{\frac{1}{2}}\right) \cdot {\left(\frac{d}{h}\right)}^{\frac{1}{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 - \frac{h \cdot \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)}{\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)\\ \end{array}\]

Reproduce

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

start1.3s

Algorithm
intervals

setup596.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 27.5b

localize71.0ms

Local error

Found 4 expressions with local error:

13.8b
(* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (/ h l))
13.0b
(pow (/ d h) (/ 1 2))
11.7b
(pow (/ d l) (/ 1 2))
8.7b
(* (* (pow (/ d h) (/ 1 2)) (pow (/ d l) (/ 1 2))) (- 1 (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (/ h l))))

rewrite39.0ms

Algorithm
rewrite-expression-head
Counts
4 → 99
Calls

4 calls. Slowest were:

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

series492.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

287.0ms
(* (* (pow (/ d h) (/ 1 2)) (pow (/ d l) (/ 1 2))) (- 1 (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (/ h l))))
82.0ms
(pow (/ d h) (/ 1 2))
66.0ms
(pow (/ d l) (/ 1 2))
57.0ms
(* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (/ h l))

simplify8.4s

Counts
71 → 111
Calls

71 calls. Slowest were:

735.0ms
(* (* 1 (pow (/ (* M D) (* 2 d)) 2)) h)
556.0ms
(+ (+ (log (/ 1 2)) (log (pow (/ (* M D) (* 2 d)) 2))) (log (/ h l)))
419.0ms
(* (* (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2))) (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2))) (* (* (/ h l) (/ h l)) (/ h l)))

prune2.6s

Pruning

21 alts after pruning (21 fresh and 0 done)

Merged error: 13.4b

localize24.0ms

Local error

Found 4 expressions with local error:

13.0b
(pow (/ d h) (/ 1 2))
11.7b
(pow (/ d l) (/ 1 2))
8.7b
(* (* (pow (/ d h) (/ 1 2)) (pow (/ d l) (/ 1 2))) (- 1 (/ (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h) l)))
6.3b
(* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h)

rewrite56.0ms

Algorithm
rewrite-expression-head
Counts
4 → 85
Calls

4 calls. Slowest were:

31.0ms
(* (* (pow (/ d h) (/ 1 2)) (pow (/ d l) (/ 1 2))) (- 1 (/ (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h) l)))
19.0ms
(* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h)
3.0ms
(pow (/ d h) (/ 1 2))

series492.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

247.0ms
(* (* (pow (/ d h) (/ 1 2)) (pow (/ d l) (/ 1 2))) (- 1 (/ (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h) l)))
85.0ms
(pow (/ d h) (/ 1 2))
83.0ms
(pow (/ d l) (/ 1 2))
77.0ms
(* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h)

simplify6.8s

Counts
57 → 97
Calls

57 calls. Slowest were:

762.0ms
(* (* 1 (pow (/ (* M D) (* 2 d)) 2)) h)
335.0ms
(* 1/8 (/ (* (pow M 2) (* (pow D 2) h)) (pow d 2)))
331.0ms
(* 1/8 (/ (* (pow M 2) (* (pow D 2) h)) (pow d 2)))

prune2.2s

Pruning

22 alts after pruning (22 fresh and 0 done)

Merged error: 9.8b

localize19.0ms

Local error

Found 4 expressions with local error:

13.0b
(pow (/ d h) (/ 1 2))
11.7b
(pow (/ d l) (/ 1 2))
7.8b
(cbrt (- 1 (/ (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h) l)))
7.8b
(cbrt (- 1 (/ (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h) l)))

rewrite5.0ms

Algorithm
rewrite-expression-head
Counts
4 → 70
Calls

4 calls. Slowest were:

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

series696.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

264.0ms
(cbrt (- 1 (/ (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h) l)))
236.0ms
(cbrt (- 1 (/ (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h) l)))
106.0ms
(pow (/ d h) (/ 1 2))
90.0ms
(pow (/ d l) (/ 1 2))

simplify2.8s

Counts
42 → 82
Calls

42 calls. Slowest were:

213.0ms
(exp (* 1/2 (- (log (/ 1 l)) (log (/ 1 d)))))
201.0ms
(exp (* 1/2 (- (log (/ 1 h)) (log (/ 1 d)))))
197.0ms
(cbrt (- (pow 1 3) (pow (/ (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h) l) 3)))

prune2.1s

Pruning

22 alts after pruning (21 fresh and 1 done)

Merged error: 9.8b

localize15.0ms

Local error

Found 4 expressions with local error:

13.0b
(pow (/ d h) (/ 1 2))
11.7b
(pow (/ d l) (/ 1 2))
11.7b
(pow (/ d l) (/ 1 2))
8.7b
(* (* (pow (/ d h) (/ 1 2)) (* (sqrt (pow (/ d l) (/ 1 2))) (sqrt (pow (/ d l) (/ 1 2))))) (- 1 (/ (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h) l)))

rewrite58.0ms

Algorithm
rewrite-expression-head
Counts
4 → 91
Calls

4 calls. Slowest were:

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

series462.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

234.0ms
(* (* (pow (/ d h) (/ 1 2)) (* (sqrt (pow (/ d l) (/ 1 2))) (sqrt (pow (/ d l) (/ 1 2))))) (- 1 (/ (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h) l)))
80.0ms
(pow (/ d l) (/ 1 2))
75.0ms
(pow (/ d l) (/ 1 2))
74.0ms
(pow (/ d h) (/ 1 2))

simplify5.6s

Counts
63 → 103
Calls

63 calls. Slowest were:

591.0ms
(* (* (pow (/ d h) (/ 1 2)) (* (sqrt (pow (/ d l) (/ 1 2))) (sqrt (pow (/ d l) (/ 1 2))))) (- 1 (/ (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h) l)))
280.0ms
(* (* (* (* (pow (/ d h) (/ 1 2)) (* (sqrt (pow (/ d l) (/ 1 2))) (sqrt (pow (/ d l) (/ 1 2))))) (* (pow (/ d h) (/ 1 2)) (* (sqrt (pow (/ d l) (/ 1 2))) (sqrt (pow (/ d l) (/ 1 2)))))) (* (pow (/ d h) (/ 1 2)) (* (sqrt (pow (/ d l) (/ 1 2))) (sqrt (pow (/ d l) (/ 1 2)))))) (* (* (- 1 (/ (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h) l)) (- 1 (/ (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h) l))) (- 1 (/ (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h) l))))
255.0ms
(* (* (* (* (pow (/ d h) (/ 1 2)) (pow (/ d h) (/ 1 2))) (pow (/ d h) (/ 1 2))) (* (* (* (sqrt (pow (/ d l) (/ 1 2))) (sqrt (pow (/ d l) (/ 1 2)))) (sqrt (pow (/ d l) (/ 1 2)))) (* (* (sqrt (pow (/ d l) (/ 1 2))) (sqrt (pow (/ d l) (/ 1 2)))) (sqrt (pow (/ d l) (/ 1 2)))))) (* (* (- 1 (/ (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h) l)) (- 1 (/ (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h) l))) (- 1 (/ (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) h) l))))

prune2.4s

Pruning

23 alts after pruning (22 fresh and 1 done)

Merged error: 9.6b

regimes2.2s

Accuracy

43.5% (8.6b remaining)

Error of 18.0b against oracle of 9.4b and baseline of 24.6b

bsearch8.0s