Average Error: 13.4 → 8.1
Time: 53.4s
Precision: 64
Internal Precision: 576
\[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\]
\[\begin{array}{l} \mathbf{if}\;\frac{h}{\ell} = -\infty:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}{\ell}}\\ \mathbf{elif}\;\frac{h}{\ell} \le -1.6993049758073772 \cdot 10^{-119}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 - \left(\frac{1}{2 \cdot d} \cdot \left(M \cdot D\right)\right) \cdot \frac{h \cdot \left(\frac{1}{2 \cdot d} \cdot \left(M \cdot D\right)\right)}{\ell}} \cdot w0\\ \end{array}\]

Error

Bits error versus w0

Bits error versus M

Bits error versus D

Bits error versus h

Bits error versus l

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 (/ h l) < -inf.0

    1. Initial program 61.6

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\]
    2. Using strategy rm
    3. Applied associate-*r/25.4

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

    if -inf.0 < (/ h l) < -1.6993049758073772e-119

    1. Initial program 13.1

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \cdot \frac{h}{\ell}}\]
    4. Applied associate-*l*12.6

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

    if -1.6993049758073772e-119 < (/ h l)

    1. Initial program 9.2

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \cdot \frac{h}{\ell}}\]
    4. Applied associate-*l*7.0

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{h}{\ell}\right)}}\]
    5. Using strategy rm
    6. Applied associate-*r/4.1

      \[\leadsto w0 \cdot \sqrt{1 - \frac{M \cdot D}{2 \cdot d} \cdot \color{blue}{\frac{\frac{M \cdot D}{2 \cdot d} \cdot h}{\ell}}}\]
    7. Using strategy rm
    8. Applied div-inv4.1

      \[\leadsto w0 \cdot \sqrt{1 - \frac{M \cdot D}{2 \cdot d} \cdot \frac{\color{blue}{\left(\left(M \cdot D\right) \cdot \frac{1}{2 \cdot d}\right)} \cdot h}{\ell}}\]
    9. Using strategy rm
    10. Applied div-inv4.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{h}{\ell} = -\infty:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}{\ell}}\\ \mathbf{elif}\;\frac{h}{\ell} \le -1.6993049758073772 \cdot 10^{-119}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 - \left(\frac{1}{2 \cdot d} \cdot \left(M \cdot D\right)\right) \cdot \frac{h \cdot \left(\frac{1}{2 \cdot d} \cdot \left(M \cdot D\right)\right)}{\ell}} \cdot w0\\ \end{array}\]

Runtime

Time bar (total: 53.4s)Debug logProfile

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