Average Error: 13.9 → 1.1
Time: 19.4s
Precision: 64
Internal Precision: 128
\[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\]
\[(\left(\sqrt{(\left(1 - wj\right) \cdot \left(wj \cdot wj\right) + \left({wj}^{4}\right))_*}\right) \cdot \left(\sqrt{(\left(1 - wj\right) \cdot \left(wj \cdot wj\right) + \left({wj}^{4}\right))_*}\right) + \left(\frac{x}{(wj \cdot \left(e^{wj}\right) + \left(e^{wj}\right))_*}\right))_*\]

Error

Bits error versus wj

Bits error versus x

Target

Original13.9
Target13.3
Herbie1.1
\[wj - \left(\frac{wj}{wj + 1} - \frac{x}{e^{wj} + wj \cdot e^{wj}}\right)\]

Derivation

  1. Initial program 13.9

    \[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\]
  2. Using strategy rm
  3. Applied div-sub13.9

    \[\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)}\]
  4. Applied associate--r-7.8

    \[\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}}}\]
  5. Simplified7.8

    \[\leadsto \left(wj - \frac{wj \cdot e^{wj}}{e^{wj} + wj \cdot e^{wj}}\right) + \color{blue}{\frac{x}{(wj \cdot \left(e^{wj}\right) + \left(e^{wj}\right))_*}}\]
  6. Taylor expanded around 0 1.1

    \[\leadsto \color{blue}{\left(\left({wj}^{2} + {wj}^{4}\right) - {wj}^{3}\right)} + \frac{x}{(wj \cdot \left(e^{wj}\right) + \left(e^{wj}\right))_*}\]
  7. Simplified1.1

    \[\leadsto \color{blue}{(\left(1 - wj\right) \cdot \left(wj \cdot wj\right) + \left({wj}^{4}\right))_*} + \frac{x}{(wj \cdot \left(e^{wj}\right) + \left(e^{wj}\right))_*}\]
  8. Using strategy rm
  9. Applied add-sqr-sqrt1.1

    \[\leadsto \color{blue}{\sqrt{(\left(1 - wj\right) \cdot \left(wj \cdot wj\right) + \left({wj}^{4}\right))_*} \cdot \sqrt{(\left(1 - wj\right) \cdot \left(wj \cdot wj\right) + \left({wj}^{4}\right))_*}} + \frac{x}{(wj \cdot \left(e^{wj}\right) + \left(e^{wj}\right))_*}\]
  10. Applied fma-def1.1

    \[\leadsto \color{blue}{(\left(\sqrt{(\left(1 - wj\right) \cdot \left(wj \cdot wj\right) + \left({wj}^{4}\right))_*}\right) \cdot \left(\sqrt{(\left(1 - wj\right) \cdot \left(wj \cdot wj\right) + \left({wj}^{4}\right))_*}\right) + \left(\frac{x}{(wj \cdot \left(e^{wj}\right) + \left(e^{wj}\right))_*}\right))_*}\]
  11. Final simplification1.1

    \[\leadsto (\left(\sqrt{(\left(1 - wj\right) \cdot \left(wj \cdot wj\right) + \left({wj}^{4}\right))_*}\right) \cdot \left(\sqrt{(\left(1 - wj\right) \cdot \left(wj \cdot wj\right) + \left({wj}^{4}\right))_*}\right) + \left(\frac{x}{(wj \cdot \left(e^{wj}\right) + \left(e^{wj}\right))_*}\right))_*\]

Reproduce

herbie shell --seed 2019002 +o rules:numerics
(FPCore (wj x)
  :name "Jmat.Real.lambertw, newton loop step"

  :herbie-target
  (- wj (- (/ wj (+ wj 1)) (/ x (+ (exp wj) (* wj (exp wj))))))

  (- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))

Details

Time bar (total: 18.5s)Debug log

sample246.0ms

Algorithm
intervals

simplify177.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

177.0ms
(- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj)))))

prune9.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 14.7b

localize19.0ms

Local error

Found 4 expressions with local error:

4.8b
(- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj)))))
0.3b
(/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))
0.0b
(+ (exp wj) (* wj (exp wj)))
0.0b
(* wj (exp wj))

rewrite15.0ms

Algorithm
rewrite-expression-head
Counts
4 → 87
Calls

4 calls. Slowest were:

9.0ms
(/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))
4.0ms
(+ (exp wj) (* wj (exp wj)))
1.0ms
(* wj (exp wj))

series169.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

57.0ms
(/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))
56.0ms
(- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj)))))
29.0ms
(+ (exp wj) (* wj (exp wj)))
27.0ms
(* wj (exp wj))

simplify3.5s

Counts
66 → 99
Calls

66 calls. Slowest were:

639.0ms
(/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))
419.0ms
(/ (* wj (exp wj)) (+ (exp wj) (* wj (exp wj))))
292.0ms
(+ (* (exp wj) (exp wj)) (- (* (* wj (exp wj)) (* wj (exp wj))) (* (exp wj) (* wj (exp wj)))))

prune818.0ms

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0.2b

localize14.0ms

Local error

Found 0 expressions with local error:

rewrite0.0ms

Algorithm
rewrite-expression-head
Counts
0 → 0
Calls

0 calls. Slowest were:

series0.0ms

Counts
0 → 0
Calls

0 calls. Slowest were:

simplify0.0ms

Counts
0 → 0
Calls

0 calls. Slowest were:

prune25.0ms

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0.2b

localize18.0ms

Local error

Found 4 expressions with local error:

5.4b
(- wj (/ (* wj (exp wj)) (+ (exp wj) (* wj (exp wj)))))
0.3b
(/ (* wj (exp wj)) (+ (exp wj) (* wj (exp wj))))
0.0b
(fma wj (exp wj) (exp wj))
0.0b
(+ (exp wj) (* wj (exp wj)))

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
4 → 68
Calls

4 calls. Slowest were:

6.0ms
(/ (* wj (exp wj)) (+ (exp wj) (* wj (exp wj))))
3.0ms
(+ (exp wj) (* wj (exp wj)))
1.0ms
(- wj (/ (* wj (exp wj)) (+ (exp wj) (* wj (exp wj)))))

series130.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

52.0ms
(- wj (/ (* wj (exp wj)) (+ (exp wj) (* wj (exp wj)))))
30.0ms
(fma wj (exp wj) (exp wj))
29.0ms
(/ (* wj (exp wj)) (+ (exp wj) (* wj (exp wj))))
19.0ms
(+ (exp wj) (* wj (exp wj)))

simplify1.4s

Counts
37 → 80
Calls

37 calls. Slowest were:

273.0ms
(+ (* (exp wj) (exp wj)) (- (* (* wj (exp wj)) (* wj (exp wj))) (* (exp wj) (* wj (exp wj)))))
157.0ms
(/ (* (* (* wj (exp wj)) (* wj (exp wj))) (* wj (exp wj))) (* (* (+ (exp wj) (* wj (exp wj))) (+ (exp wj) (* wj (exp wj)))) (+ (exp wj) (* wj (exp wj)))))
128.0ms
(- (log (* wj (exp wj))) (log (+ (exp wj) (* wj (exp wj)))))

prune878.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.0b

localize14.0ms

Local error

Found 4 expressions with local error:

0.0b
(fma (- 1 wj) (* wj wj) (pow wj 4))
0.0b
(fma wj (exp wj) (exp wj))
0.0b
(/ x (fma wj (exp wj) (exp wj)))
0.0b
(+ (fma (- 1 wj) (* wj wj) (pow wj 4)) (/ x (fma wj (exp wj) (exp wj))))

rewrite5.0ms

Algorithm
rewrite-expression-head
Counts
4 → 53
Calls

4 calls. Slowest were:

4.0ms
(+ (fma (- 1 wj) (* wj wj) (pow wj 4)) (/ x (fma wj (exp wj) (exp wj))))
0.0ms
(/ x (fma wj (exp wj) (exp wj)))
0.0ms
(fma (- 1 wj) (* wj wj) (pow wj 4))

series192.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

90.0ms
(/ x (fma wj (exp wj) (exp wj)))
48.0ms
(+ (fma (- 1 wj) (* wj wj) (pow wj 4)) (/ x (fma wj (exp wj) (exp wj))))
35.0ms
(fma wj (exp wj) (exp wj))
18.0ms
(fma (- 1 wj) (* wj wj) (pow wj 4))

simplify2.0s

Counts
20 → 65
Calls

20 calls. Slowest were:

555.0ms
(- (+ x (* 5/2 (* x (pow wj 2)))) (* 2 (* x wj)))
369.0ms
(* (exp (fma (- 1 wj) (* wj wj) (pow wj 4))) (exp (/ x (fma wj (exp wj) (exp wj)))))
324.0ms
(+ (fma (- 1 wj) (* wj wj) (pow wj 4)) (/ x (fma wj (exp wj) (exp wj))))

prune698.0ms

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0b

regimes104.0ms

Accuracy

0% (1.1b remaining)

Error of 1.1b against oracle of 0.1b and baseline of 1.1b

bsearch3.0ms

end0.0ms

sample8.1s

Algorithm
intervals