Average Error: 14.1 → 1.1
Time: 39.2s
Precision: 64
Internal Precision: 128
\[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\]
\[\sqrt{\left({wj}^{2} + {wj}^{4}\right) - {wj}^{3}} \cdot \sqrt{\left({wj}^{2} + {wj}^{4}\right) - {wj}^{3}} + \frac{x}{e^{wj} \cdot \left(1 + wj\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

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

Derivation

  1. Initial program 14.1

    \[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\]
  2. Initial simplification7.4

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

    \[\leadsto \color{blue}{\left(\left({wj}^{2} + {wj}^{4}\right) - {wj}^{3}\right)} + \frac{\frac{x}{e^{wj}}}{wj + 1}\]
  4. Using strategy rm
  5. Applied associate-/l/1.1

    \[\leadsto \left(\left({wj}^{2} + {wj}^{4}\right) - {wj}^{3}\right) + \color{blue}{\frac{x}{\left(wj + 1\right) \cdot e^{wj}}}\]
  6. Using strategy rm
  7. Applied add-sqr-sqrt1.1

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

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

Reproduce

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

start378.0ms

Algorithm
intervals

setup174.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 7.6b

localize22.0ms

Local error

Found 4 expressions with local error:

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

rewrite6.0ms

Algorithm
rewrite-expression-head
Counts
4 → 73
Calls

4 calls. Slowest were:

3.0ms
(/ (/ x (exp wj)) (+ wj 1))
1.0ms
(/ x (exp wj))
0.0ms
(- wj (/ wj (+ wj 1)))

series116.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

42.0ms
(/ (/ x (exp wj)) (+ wj 1))
37.0ms
(/ x (exp wj))
20.0ms
(- wj (/ wj (+ wj 1)))
17.0ms
(/ wj (+ wj 1))

simplify1.3s

Counts
53 → 85
Calls

53 calls. Slowest were:

397.0ms
(/ (* (* (/ x (exp wj)) (/ x (exp wj))) (/ x (exp wj))) (* (* (+ wj 1) (+ wj 1)) (+ wj 1)))
207.0ms
(- (+ x (* 5/2 (* x (pow wj 2)))) (* 2 (* x wj)))
76.0ms
(- (+ x (* 1/2 (* x (pow wj 2)))) (* x wj))

prune919.0ms

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.1b

localize18.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)) (pow wj 3)) (/ (/ x (exp wj)) (+ wj 1)))

rewrite132.0ms

Algorithm
rewrite-expression-head
Counts
4 → 86
Calls

4 calls. Slowest were:

98.0ms
(+ (- (+ (pow wj 2) (pow wj 4)) (pow wj 3)) (/ (/ x (exp wj)) (+ wj 1)))
28.0ms
(- (+ (pow wj 2) (pow wj 4)) (pow wj 3))
3.0ms
(/ (/ x (exp wj)) (+ wj 1))

series176.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

64.0ms
(/ (/ x (exp wj)) (+ wj 1))
54.0ms
(/ x (exp wj))
36.0ms
(+ (- (+ (pow wj 2) (pow wj 4)) (pow wj 3)) (/ (/ x (exp wj)) (+ wj 1)))
21.0ms
(- (+ (pow wj 2) (pow wj 4)) (pow wj 3))

simplify3.7s

Counts
69 → 98
Calls

69 calls. Slowest were:

471.0ms
(/ (* (* (/ x (exp wj)) (/ x (exp wj))) (/ x (exp wj))) (* (* (+ wj 1) (+ wj 1)) (+ wj 1)))
270.0ms
(+ (- (+ (pow wj 2) (pow wj 4)) (pow wj 3)) (/ (/ x (exp wj)) (+ wj 1)))
255.0ms
(* (/ (exp (+ (pow wj 2) (pow wj 4))) (exp (pow wj 3))) (exp (/ (/ x (exp wj)) (+ wj 1))))

prune1.9s

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0.1b

localize10.0ms

Local error

Found 4 expressions with local error:

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

rewrite139.0ms

Algorithm
rewrite-expression-head
Counts
4 → 71
Calls

4 calls. Slowest were:

115.0ms
(+ (- (+ (pow wj 2) (pow wj 4)) (pow wj 3)) (/ x (* (+ wj 1) (exp wj))))
18.0ms
(- (+ (pow wj 2) (pow wj 4)) (pow wj 3))
4.0ms
(* (+ wj 1) (exp wj))

series155.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

61.0ms
(/ x (* (+ wj 1) (exp wj)))
54.0ms
(+ (- (+ (pow wj 2) (pow wj 4)) (pow wj 3)) (/ x (* (+ wj 1) (exp wj))))
22.0ms
(- (+ (pow wj 2) (pow wj 4)) (pow wj 3))
18.0ms
(* (+ wj 1) (exp wj))

simplify3.8s

Counts
46 → 83
Calls

46 calls. Slowest were:

622.0ms
(* (+ (+ (pow wj 2) (pow wj 4)) (pow wj 3)) (* (+ wj 1) (exp wj)))
275.0ms
(* (/ (* (exp (pow wj 2)) (exp (pow wj 4))) (exp (pow wj 3))) (exp (/ x (* (+ wj 1) (exp wj)))))
247.0ms
(+ (- (+ (pow wj 2) (pow wj 4)) (pow wj 3)) (/ x (* (+ wj 1) (exp wj))))

prune1.4s

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0.1b

localize18.0ms

Local error

Found 4 expressions with local error:

24.8b
(sqrt (- (+ (pow wj 2) (pow wj 4)) (pow wj 3)))
24.8b
(sqrt (- (+ (pow wj 2) (pow wj 4)) (pow wj 3)))
0.0b
(* (sqrt (- (+ (pow wj 2) (pow wj 4)) (pow wj 3))) (sqrt (- (+ (pow wj 2) (pow wj 4)) (pow wj 3))))
0.0b
(* (+ wj 1) (exp wj))

rewrite122.0ms

Algorithm
rewrite-expression-head
Counts
4 → 97
Calls

4 calls. Slowest were:

76.0ms
(* (sqrt (- (+ (pow wj 2) (pow wj 4)) (pow wj 3))) (sqrt (- (+ (pow wj 2) (pow wj 4)) (pow wj 3))))
18.0ms
(sqrt (- (+ (pow wj 2) (pow wj 4)) (pow wj 3)))
18.0ms
(sqrt (- (+ (pow wj 2) (pow wj 4)) (pow wj 3)))

series91.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

30.0ms
(sqrt (- (+ (pow wj 2) (pow wj 4)) (pow wj 3)))
22.0ms
(* (sqrt (- (+ (pow wj 2) (pow wj 4)) (pow wj 3))) (sqrt (- (+ (pow wj 2) (pow wj 4)) (pow wj 3))))
20.0ms
(sqrt (- (+ (pow wj 2) (pow wj 4)) (pow wj 3)))
19.0ms
(* (+ wj 1) (exp wj))

simplify7.2s

Counts
81 → 109
Calls

81 calls. Slowest were:

826.0ms
(* (sqrt (- (* (+ (pow wj 2) (pow wj 4)) (+ (pow wj 2) (pow wj 4))) (* (pow wj 3) (pow wj 3)))) (sqrt (- (pow (+ (pow wj 2) (pow wj 4)) 3) (pow (pow wj 3) 3))))
571.0ms
(* (sqrt (- (pow (+ (pow wj 2) (pow wj 4)) 3) (pow (pow wj 3) 3))) (sqrt (- (* (+ (pow wj 2) (pow wj 4)) (+ (pow wj 2) (pow wj 4))) (* (pow wj 3) (pow wj 3)))))
560.0ms
(* (* (* (sqrt (- (+ (pow wj 2) (pow wj 4)) (pow wj 3))) (sqrt (- (+ (pow wj 2) (pow wj 4)) (pow wj 3)))) (sqrt (- (+ (pow wj 2) (pow wj 4)) (pow wj 3)))) (* (* (sqrt (- (+ (pow wj 2) (pow wj 4)) (pow wj 3))) (sqrt (- (+ (pow wj 2) (pow wj 4)) (pow wj 3)))) (sqrt (- (+ (pow wj 2) (pow wj 4)) (pow wj 3)))))

prune2.3s

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 0.1b

regimes99.0ms

Accuracy

0% (1.0b remaining)

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

bsearch2.0ms