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

    if wj < 4.117893899060259e-06

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

    9. Applied final simplification
    10. Applied simplify to get
      \[\color{red}{\left(\left(\left(wj - wj\right) - {wj}^3\right) + {wj}^2\right) + \frac{x}{(wj * \left(e^{wj}\right) + \left(e^{wj}\right))_*}} \leadsto \color{blue}{(wj * \left(wj - {wj}^2\right) + \left(\frac{x}{(wj * \left(e^{wj}\right) + \left(e^{wj}\right))_*}\right))_*}\]
      0.0

    if 4.117893899060259e-06 < wj

    1. Started with
      \[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\]
      58.8
    2. Using strategy rm
      58.8
    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.8
    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.1
    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{x}{(wj * \left(e^{wj}\right) + \left(e^{wj}\right))_*}}\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)))))))