\[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: 15.8 s
Input Error: 9.5
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 3.5037975f0 \\ wj - \frac{1}{wj + 1} \cdot \left(wj - \frac{x}{e^{wj}}\right) & \text{otherwise} \end{cases}\)

    if wj < 3.5037975f0

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

    if 3.5037975f0 < wj

    1. Started with
      \[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\]
      27.4
    2. Using strategy rm
      27.4
    3. Applied distribute-rgt1-in to get
      \[wj - \frac{wj \cdot e^{wj} - x}{\color{red}{e^{wj} + wj \cdot e^{wj}}} \leadsto wj - \frac{wj \cdot e^{wj} - x}{\color{blue}{\left(wj + 1\right) \cdot e^{wj}}}\]
      27.4
    4. Applied *-un-lft-identity to get
      \[wj - \frac{\color{red}{wj \cdot e^{wj} - x}}{\left(wj + 1\right) \cdot e^{wj}} \leadsto wj - \frac{\color{blue}{1 \cdot \left(wj \cdot e^{wj} - x\right)}}{\left(wj + 1\right) \cdot e^{wj}}\]
      27.4
    5. Applied times-frac to get
      \[wj - \color{red}{\frac{1 \cdot \left(wj \cdot e^{wj} - x\right)}{\left(wj + 1\right) \cdot e^{wj}}} \leadsto wj - \color{blue}{\frac{1}{wj + 1} \cdot \frac{wj \cdot e^{wj} - x}{e^{wj}}}\]
      27.4
    6. Applied simplify to get
      \[wj - \frac{1}{wj + 1} \cdot \color{red}{\frac{wj \cdot e^{wj} - x}{e^{wj}}} \leadsto wj - \frac{1}{wj + 1} \cdot \color{blue}{\left(wj - \frac{x}{e^{wj}}\right)}\]
      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)))))))