\[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: 12.1 s
Input Error: 9.7
Output Error: 0.5
Log:
Profile: 🕒
\(\begin{cases} wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}} & \text{when } wj \le 7.279548f0 \\ \left(wj - \frac{wj}{1 + wj}\right) + (e^{\log_* (1 + \frac{x}{(wj * \left(e^{wj}\right) + \left(e^{wj}\right))_*})} - 1)^* & \text{otherwise} \end{cases}\)

    if wj < 7.279548f0

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

    if 7.279548f0 < wj

    1. Started with
      \[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\]
      28.0
    2. Using strategy rm
      28.0
    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)}\]
      28.0
    4. Applied associate--r- to get
      \[\color{red}{wj - \left(\frac{wj \cdot e^{wj}}{e^{wj} + wj \cdot e^{wj}} - \frac{x}{e^{wj} + wj \cdot e^{wj}}\right)} \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}}}\]
      28.0
    5. Applied simplify to get
      \[\color{red}{\left(wj - \frac{wj \cdot e^{wj}}{e^{wj} + wj \cdot e^{wj}}\right)} + \frac{x}{e^{wj} + wj \cdot e^{wj}} \leadsto \color{blue}{\left(wj - \frac{wj}{1 + wj}\right)} + \frac{x}{e^{wj} + wj \cdot e^{wj}}\]
      0.0
    6. Using strategy rm
      0.0
    7. Applied expm1-log1p-u to get
      \[\left(wj - \frac{wj}{1 + wj}\right) + \color{red}{\frac{x}{e^{wj} + wj \cdot e^{wj}}} \leadsto \left(wj - \frac{wj}{1 + wj}\right) + \color{blue}{(e^{\log_* (1 + \frac{x}{e^{wj} + wj \cdot e^{wj}})} - 1)^*}\]
      0.0
    8. Applied simplify to get
      \[\left(wj - \frac{wj}{1 + wj}\right) + (e^{\color{red}{\log_* (1 + \frac{x}{e^{wj} + wj \cdot e^{wj}})}} - 1)^* \leadsto \left(wj - \frac{wj}{1 + wj}\right) + (e^{\color{blue}{\log_* (1 + \frac{x}{(wj * \left(e^{wj}\right) + \left(e^{wj}\right))_*})}} - 1)^*\]
      0.0

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