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

    if (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj)))) < 0.9037125f0

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

    if 0.9037125f0 < (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))

    1. Started with
      \[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\]
      17.9
    2. Using strategy rm
      17.9
    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}}}\]
      17.9
    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}}\]
      17.9
    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}}}\]
      17.9
    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.1

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