\[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\]
Test:
Jmat.Real.lambertw, newton loop step
Bits:
128 bits
Bits error versus wj
Bits error versus x
Time: 9.1 s
Input Error: 28.9
Output Error: 0.1
Log:
Profile: 🕒
\(\begin{cases} wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}} & \text{when } wj \le -1.1443077010023319 \cdot 10^{-10} \\ x + {wj}^2 & \text{when } wj \le 8.643107266700627 \cdot 10^{-10} \\ wj - \left(\frac{wj}{wj + 1} - \frac{\frac{x}{1 + wj}}{e^{wj}}\right) & \text{otherwise} \end{cases}\)

    if wj < -1.1443077010023319e-10

    1. Started with
      \[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\]
      4.7

    if -1.1443077010023319e-10 < wj < 8.643107266700627e-10

    1. Started with
      \[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\]
      13.2
    2. Applied taylor to get
      \[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}} \leadsto wj - \left(wj - \left({wj}^2 + x\right)\right)\]
      13.0
    3. Taylor expanded around 0 to get
      \[wj - \color{red}{\left(wj - \left({wj}^2 + x\right)\right)} \leadsto wj - \color{blue}{\left(wj - \left({wj}^2 + x\right)\right)}\]
      13.0
    4. Applied simplify to get
      \[\color{red}{wj - \left(wj - \left({wj}^2 + x\right)\right)} \leadsto \color{blue}{x + {wj}^2}\]
      0.0

    if 8.643107266700627e-10 < wj

    1. Started with
      \[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\]
      58.6
    2. Using strategy rm
      58.6
    3. Applied div-sub to get
      \[wj - \color{red}{\frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}} \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)}\]
      58.6
    4. Applied simplify to get
      \[wj - \left(\color{red}{\frac{wj \cdot e^{wj}}{e^{wj} + wj \cdot e^{wj}}} - \frac{x}{e^{wj} + wj \cdot e^{wj}}\right) \leadsto wj - \left(\color{blue}{\frac{wj}{wj + 1}} - \frac{x}{e^{wj} + wj \cdot e^{wj}}\right)\]
      0.2
    5. Applied simplify to get
      \[wj - \left(\frac{wj}{wj + 1} - \color{red}{\frac{x}{e^{wj} + wj \cdot e^{wj}}}\right) \leadsto wj - \left(\frac{wj}{wj + 1} - \color{blue}{\frac{\frac{x}{1 + wj}}{e^{wj}}}\right)\]
      0.2

  1. Removed slow pow expressions

Original test:


(lambda ((wj default) (x default))
  #:name "Jmat.Real.lambertw, newton loop step"
  (- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj)))))
  #:target
  (- wj (- (/ wj (+ wj 1)) (/ x (+ (exp wj) (* wj (exp wj)))))))