\[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.6 s
Input Error: 28.9
Output Error: 0.0
Log:
Profile: 🕒
\(\begin{cases} (wj * \left(wj - {wj}^2\right) + \left({wj}^{4}\right))_* + \frac{x}{(wj * \left(e^{wj}\right) + \left(e^{wj}\right))_*} & \text{when } wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}} \le 4.477717099564361 \cdot 10^{-09} \\ \left(wj - \frac{wj}{1 + wj}\right) + \frac{x}{e^{wj} + wj \cdot e^{wj}} & \text{otherwise} \end{cases}\)

    if (- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))) < 4.477717099564361e-09

    1. Started with
      \[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\]
      17.6
    2. Using strategy rm
      17.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)}\]
      17.6
    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}}}\]
      9.3
    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}}\]
      9.3
    6. Applied taylor to get
      \[\left(wj - \frac{wj}{1 + wj}\right) + \frac{x}{e^{wj} + wj \cdot e^{wj}} \leadsto \left(\left({wj}^{4} + {wj}^2\right) - {wj}^{3}\right) + \frac{x}{e^{wj} + wj \cdot e^{wj}}\]
      0.0
    7. Taylor expanded around 0 to get
      \[\color{red}{\left(\left({wj}^{4} + {wj}^2\right) - {wj}^{3}\right)} + \frac{x}{e^{wj} + wj \cdot e^{wj}} \leadsto \color{blue}{\left(\left({wj}^{4} + {wj}^2\right) - {wj}^{3}\right)} + \frac{x}{e^{wj} + wj \cdot e^{wj}}\]
      0.0
    8. Applied simplify to get
      \[\color{red}{\left(\left({wj}^{4} + {wj}^2\right) - {wj}^{3}\right) + \frac{x}{e^{wj} + wj \cdot e^{wj}}} \leadsto \color{blue}{(wj * \left(wj - {wj}^2\right) + \left({wj}^{4}\right))_* + \frac{x}{(wj * \left(e^{wj}\right) + \left(e^{wj}\right))_*}}\]
      0.0

    if 4.477717099564361e-09 < (- wj (/ (- (* 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}}\]
      39.3
    2. Using strategy rm
      39.3
    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)}\]
      39.3
    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}}}\]
      39.3
    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.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)))))))