Average Error: 13.5 → 8.9
Time: 1.8m
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}\;\ell \le -8.592583311612747 \cdot 10^{-65} \lor \neg \left(\ell \le 1.2916441788270657 \cdot 10^{-80}\right):\\ \;\;\;\;\sqrt{1 - \frac{M \cdot D}{2 \cdot d} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{\ell}{h}}} \cdot w0\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \left(\frac{D}{\frac{2}{h}} \cdot \frac{M}{d}\right) \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\ell}}\\ \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 2 regimes
  2. if l < -8.592583311612747e-65 or 1.2916441788270657e-80 < l

    1. Initial program 9.7

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\]
    2. Initial simplification9.5

      \[\leadsto \sqrt{1 - \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}}{\frac{\ell}{h}}} \cdot w0\]
    3. Using strategy rm
    4. Applied *-un-lft-identity9.5

      \[\leadsto \sqrt{1 - \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}}{\color{blue}{1 \cdot \frac{\ell}{h}}}} \cdot w0\]
    5. Applied times-frac7.3

      \[\leadsto \sqrt{1 - \color{blue}{\frac{\frac{M \cdot D}{2 \cdot d}}{1} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{\ell}{h}}}} \cdot w0\]
    6. Simplified7.3

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

    if -8.592583311612747e-65 < l < 1.2916441788270657e-80

    1. Initial program 21.4

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\]
    2. Initial simplification20.3

      \[\leadsto \sqrt{1 - \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}}{\frac{\ell}{h}}} \cdot w0\]
    3. Using strategy rm
    4. Applied div-inv20.3

      \[\leadsto \sqrt{1 - \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}}{\color{blue}{\ell \cdot \frac{1}{h}}}} \cdot w0\]
    5. Applied times-frac10.1

      \[\leadsto \sqrt{1 - \color{blue}{\frac{\frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}} \cdot w0\]
    6. Simplified12.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \le -8.592583311612747 \cdot 10^{-65} \lor \neg \left(\ell \le 1.2916441788270657 \cdot 10^{-80}\right):\\ \;\;\;\;\sqrt{1 - \frac{M \cdot D}{2 \cdot d} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{\ell}{h}}} \cdot w0\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \left(\frac{D}{\frac{2}{h}} \cdot \frac{M}{d}\right) \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\ell}}\\ \end{array}\]

Runtime

Time bar (total: 1.8m)Debug logProfile

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