Average Error: 13.9 → 1.5
Time: 37.9s
Precision: 64
Internal Precision: 128
\[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\]
\[\left(x - \left(x \cdot wj\right) \cdot \left(2 - \frac{5}{2} \cdot wj\right)\right) + \left(\left({wj}^{4} - {wj}^{3}\right) + {wj}^{2}\right)\]

Error

Bits error versus wj

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original13.9
Target13.3
Herbie1.5
\[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. Initial simplification7.2

    \[\leadsto \left(wj - \frac{wj}{wj + 1}\right) + \frac{\frac{x}{e^{wj}}}{wj + 1}\]
  3. Taylor expanded around 0 1.0

    \[\leadsto \color{blue}{\left(\left({wj}^{2} + {wj}^{4}\right) - {wj}^{3}\right)} + \frac{\frac{x}{e^{wj}}}{wj + 1}\]
  4. Taylor expanded around 0 1.5

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

    \[\leadsto \left(\left({wj}^{2} + {wj}^{4}\right) - {wj}^{3}\right) + \color{blue}{\left(x - \left(x \cdot wj\right) \cdot \left(2 - wj \cdot \frac{5}{2}\right)\right)}\]
  6. Using strategy rm
  7. Applied associate--l+1.5

    \[\leadsto \color{blue}{\left({wj}^{2} + \left({wj}^{4} - {wj}^{3}\right)\right)} + \left(x - \left(x \cdot wj\right) \cdot \left(2 - wj \cdot \frac{5}{2}\right)\right)\]
  8. Final simplification1.5

    \[\leadsto \left(x - \left(x \cdot wj\right) \cdot \left(2 - \frac{5}{2} \cdot wj\right)\right) + \left(\left({wj}^{4} - {wj}^{3}\right) + {wj}^{2}\right)\]

Reproduce

herbie shell --seed 2018360 
(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: 23.0s)Debug log

start705.0ms

Algorithm
intervals

setup524.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 7.5b

localize40.0ms

Local error

Found 4 expressions with local error:

6.8b
(- wj (/ wj (+ wj 1)))
0.0b
(/ (/ x (exp wj)) (+ wj 1))
0.0b
(/ x (exp wj))
0.0b
(/ wj (+ wj 1))

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
4 → 73
Calls

4 calls. Slowest were:

7.0ms
(/ (/ x (exp wj)) (+ wj 1))
1.0ms
(- wj (/ wj (+ wj 1)))
1.0ms
(/ x (exp wj))

series118.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

45.0ms
(/ (/ x (exp wj)) (+ wj 1))
43.0ms
(/ x (exp wj))
20.0ms
(- wj (/ wj (+ wj 1)))
10.0ms
(/ wj (+ wj 1))

simplify1.3s

Counts
53 → 85
Calls

53 calls. Slowest were:

328.0ms
(/ (* (* (/ x (exp wj)) (/ x (exp wj))) (/ x (exp wj))) (* (* (+ wj 1) (+ wj 1)) (+ wj 1)))
126.0ms
(- (+ x (* 5/2 (* x (pow wj 2)))) (* 2 (* x wj)))
120.0ms
(- (+ x (* 1/2 (* x (pow wj 2)))) (* x wj))

prune1.1s

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.1b

localize32.0ms

Local error

Found 4 expressions with local error:

0.0b
(/ (/ x (exp wj)) (+ wj 1))
0.0b
(/ x (exp wj))
0.0b
(- (+ (pow wj 2) (pow wj 4)) (pow wj 3))
0.0b
(+ (pow wj 2) (pow wj 4))

rewrite31.0ms

Algorithm
rewrite-expression-head
Counts
4 → 76
Calls

4 calls. Slowest were:

19.0ms
(- (+ (pow wj 2) (pow wj 4)) (pow wj 3))
6.0ms
(+ (pow wj 2) (pow wj 4))
4.0ms
(/ (/ x (exp wj)) (+ wj 1))

series160.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

53.0ms
(+ (pow wj 2) (pow wj 4))
49.0ms
(/ (/ x (exp wj)) (+ wj 1))
44.0ms
(/ x (exp wj))
13.0ms
(- (+ (pow wj 2) (pow wj 4)) (pow wj 3))

simplify1.5s

Counts
57 → 88
Calls

57 calls. Slowest were:

396.0ms
(/ (* (* (/ x (exp wj)) (/ x (exp wj))) (/ x (exp wj))) (* (* (+ wj 1) (+ wj 1)) (+ wj 1)))
157.0ms
(- (+ x (* 5/2 (* x (pow wj 2)))) (* 2 (* x wj)))
120.0ms
(- (+ x (* 1/2 (* x (pow wj 2)))) (* x wj))

prune1.8s

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0.0b

localize29.0ms

Local error

Found 4 expressions with local error:

0.1b
(* (* x wj) (- 2 (* wj 5/2)))
0.0b
(- (+ (pow wj 2) (pow wj 4)) (pow wj 3))
0.0b
(+ (pow wj 2) (pow wj 4))
0.0b
(+ (- (+ (pow wj 2) (pow wj 4)) (pow wj 3)) (- x (* (* x wj) (- 2 (* wj 5/2)))))

rewrite157.0ms

Algorithm
rewrite-expression-head
Counts
4 → 77
Calls

4 calls. Slowest were:

127.0ms
(+ (- (+ (pow wj 2) (pow wj 4)) (pow wj 3)) (- x (* (* x wj) (- 2 (* wj 5/2)))))
20.0ms
(- (+ (pow wj 2) (pow wj 4)) (pow wj 3))
4.0ms
(* (* x wj) (- 2 (* wj 5/2)))

series148.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

52.0ms
(* (* x wj) (- 2 (* wj 5/2)))
44.0ms
(+ (- (+ (pow wj 2) (pow wj 4)) (pow wj 3)) (- x (* (* x wj) (- 2 (* wj 5/2)))))
36.0ms
(+ (pow wj 2) (pow wj 4))
16.0ms
(- (+ (pow wj 2) (pow wj 4)) (pow wj 3))

simplify5.7s

Counts
54 → 89
Calls

54 calls. Slowest were:

344.0ms
(+ (* (- (* (+ (pow wj 2) (pow wj 4)) (+ (pow wj 2) (pow wj 4))) (* (pow wj 3) (pow wj 3))) (+ (* x x) (+ (* (* (* x wj) (- 2 (* wj 5/2))) (* (* x wj) (- 2 (* wj 5/2)))) (* x (* (* x wj) (- 2 (* wj 5/2))))))) (* (+ (+ (pow wj 2) (pow wj 4)) (pow wj 3)) (- (pow x 3) (pow (* (* x wj) (- 2 (* wj 5/2))) 3))))
337.0ms
(+ (- (+ (pow wj 2) (pow wj 4)) (pow wj 3)) (- x (* (* x wj) (- 2 (* wj 5/2)))))
326.0ms
(+ (* (- (pow (+ (pow wj 2) (pow wj 4)) 3) (pow (pow wj 3) 3)) (+ (* x x) (+ (* (* (* x wj) (- 2 (* wj 5/2))) (* (* x wj) (- 2 (* wj 5/2)))) (* x (* (* x wj) (- 2 (* wj 5/2))))))) (* (+ (* (+ (pow wj 2) (pow wj 4)) (+ (pow wj 2) (pow wj 4))) (+ (* (pow wj 3) (pow wj 3)) (* (+ (pow wj 2) (pow wj 4)) (pow wj 3)))) (- (pow x 3) (pow (* (* x wj) (- 2 (* wj 5/2))) 3))))

prune1.6s

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0.0b

localize13.0ms

Local error

Found 4 expressions with local error:

0.1b
(* (* x wj) (- 2 (* wj 5/2)))
0.0b
(- (pow wj 4) (pow wj 3))
0.0b
(+ (+ (pow wj 2) (- (pow wj 4) (pow wj 3))) (- x (* (* x wj) (- 2 (* wj 5/2)))))
0.0b
(+ (pow wj 2) (- (pow wj 4) (pow wj 3)))

rewrite102.0ms

Algorithm
rewrite-expression-head
Counts
4 → 77
Calls

4 calls. Slowest were:

68.0ms
(+ (+ (pow wj 2) (- (pow wj 4) (pow wj 3))) (- x (* (* x wj) (- 2 (* wj 5/2)))))
17.0ms
(+ (pow wj 2) (- (pow wj 4) (pow wj 3)))
8.0ms
(* (* x wj) (- 2 (* wj 5/2)))

series170.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

60.0ms
(- (pow wj 4) (pow wj 3))
51.0ms
(* (* x wj) (- 2 (* wj 5/2)))
44.0ms
(+ (+ (pow wj 2) (- (pow wj 4) (pow wj 3))) (- x (* (* x wj) (- 2 (* wj 5/2)))))
15.0ms
(+ (pow wj 2) (- (pow wj 4) (pow wj 3)))

simplify5.7s

Counts
54 → 89
Calls

54 calls. Slowest were:

360.0ms
(+ (* (+ (pow (pow wj 2) 3) (pow (- (pow wj 4) (pow wj 3)) 3)) (+ (* x x) (+ (* (* (* x wj) (- 2 (* wj 5/2))) (* (* x wj) (- 2 (* wj 5/2)))) (* x (* (* x wj) (- 2 (* wj 5/2))))))) (* (+ (* (pow wj 2) (pow wj 2)) (- (* (- (pow wj 4) (pow wj 3)) (- (pow wj 4) (pow wj 3))) (* (pow wj 2) (- (pow wj 4) (pow wj 3))))) (- (pow x 3) (pow (* (* x wj) (- 2 (* wj 5/2))) 3))))
342.0ms
(* (exp (+ (pow wj 2) (- (pow wj 4) (pow wj 3)))) (exp (- x (* (* x wj) (- 2 (* wj 5/2))))))
307.0ms
(+ (+ (pow wj 2) (- (pow wj 4) (pow wj 3))) (- x (* (* x wj) (- 2 (* wj 5/2)))))

prune1.9s

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 0.0b

regimes207.0ms

Accuracy

0% (1.5b remaining)

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

bsearch4.0ms