Average Error: 13.8 → 1.1
Time: 1.2m
Precision: 64
Internal Precision: 896
\[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\]
\[(wj \cdot \left(wj - wj \cdot wj\right) + \left({\left(\frac{1}{wj}\right)}^{-4}\right))_* + \frac{x}{(wj \cdot \left(e^{wj}\right) + \left(e^{wj}\right))_*}\]

Error

Bits error versus wj

Bits error versus x

Target

Original13.8
Target13.1
Herbie1.1
\[wj - \left(\frac{wj}{wj + 1} - \frac{x}{e^{wj} + wj \cdot e^{wj}}\right)\]

Derivation

  1. Initial program 13.8

    \[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\]
  2. Using strategy rm
  3. Applied div-sub13.8

    \[\leadsto wj - \color{blue}{\left(\frac{wj \cdot e^{wj}}{e^{wj} + wj \cdot e^{wj}} - \frac{x}{e^{wj} + wj \cdot e^{wj}}\right)}\]
  4. Applied associate--r-7.5

    \[\leadsto \color{blue}{\left(wj - \frac{wj \cdot e^{wj}}{e^{wj} + wj \cdot e^{wj}}\right) + \frac{x}{e^{wj} + wj \cdot e^{wj}}}\]
  5. Applied simplify6.8

    \[\leadsto \color{blue}{\left(wj - \frac{wj}{1 + wj}\right)} + \frac{x}{e^{wj} + wj \cdot e^{wj}}\]
  6. Taylor expanded around 0 1.1

    \[\leadsto \color{blue}{\left(\left({wj}^{4} + {wj}^{2}\right) - {wj}^{3}\right)} + \frac{x}{e^{wj} + wj \cdot e^{wj}}\]
  7. Applied simplify1.1

    \[\leadsto \color{blue}{\frac{x}{(wj \cdot \left(e^{wj}\right) + \left(e^{wj}\right))_*} + (\left(wj \cdot wj\right) \cdot \left(1 - wj\right) + \left({wj}^{4}\right))_*}\]
  8. Taylor expanded around inf 1.1

    \[\leadsto \frac{x}{(wj \cdot \left(e^{wj}\right) + \left(e^{wj}\right))_*} + \color{blue}{\left(\left({\left(\frac{1}{wj}\right)}^{-4} + {wj}^{2}\right) - {wj}^{3}\right)}\]
  9. Applied simplify1.1

    \[\leadsto \color{blue}{(wj \cdot \left(wj - wj \cdot wj\right) + \left({\left(\frac{1}{wj}\right)}^{-4}\right))_* + \frac{x}{(wj \cdot \left(e^{wj}\right) + \left(e^{wj}\right))_*}}\]

Runtime

Time bar (total: 1.2m)Debug logProfile

herbie shell --seed '#(1070833653 108281690 3330367898 3632331308 3494323072 43156186)' +o rules:numerics
(FPCore (wj x)
  :name "Jmat.Real.lambertw, newton loop step"

  :herbie-target
  (- wj (- (/ wj (+ wj 1)) (/ x (+ (exp wj) (* wj (exp wj))))))

  (- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))