Average Error: 43.0 → 1.0
Time: 33.7s
Precision: 64
Internal Precision: 1344
\[\Im(\left(\frac{e^{x} + e^{-x}}{2} \cdot \cos y + \frac{e^{x} - e^{-x}}{2} \cdot \sin y i\right))\]
\[\Im(\left(\frac{e^{x} + e^{-x}}{2} \cdot \cos y + \frac{(\left((\frac{1}{3} \cdot \left(x \cdot x\right) + 2)_*\right) \cdot x + \left(\frac{1}{60} \cdot {x}^{5}\right))_*}{2} \cdot \sin y i\right))\]

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 43.0

    \[\Im(\left(\frac{e^{x} + e^{-x}}{2} \cdot \cos y + \frac{e^{x} - e^{-x}}{2} \cdot \sin y i\right))\]
  2. Taylor expanded around 0 1.0

    \[\leadsto \Im(\left(\frac{e^{x} + e^{-x}}{2} \cdot \cos y + \frac{\color{blue}{2 \cdot x + \left(\frac{1}{3} \cdot {x}^{3} + \frac{1}{60} \cdot {x}^{5}\right)}}{2} \cdot \sin y i\right))\]
  3. Simplified1.0

    \[\leadsto \Im(\left(\frac{e^{x} + e^{-x}}{2} \cdot \cos y + \frac{\color{blue}{(\left((\frac{1}{3} \cdot \left(x \cdot x\right) + 2)_*\right) \cdot x + \left({x}^{5} \cdot \frac{1}{60}\right))_*}}{2} \cdot \sin y i\right))\]
  4. Final simplification1.0

    \[\leadsto \Im(\left(\frac{e^{x} + e^{-x}}{2} \cdot \cos y + \frac{(\left((\frac{1}{3} \cdot \left(x \cdot x\right) + 2)_*\right) \cdot x + \left(\frac{1}{60} \cdot {x}^{5}\right))_*}{2} \cdot \sin y i\right))\]

Reproduce

herbie shell --seed 2019008 +o rules:numerics
(FPCore (x y)
  :name "Euler formula imaginary part (p55)"
  (im (complex (* (/ (+ (exp x) (exp (- x))) 2) (cos y)) (* (/ (- (exp x) (exp (- x))) 2) (sin y)))))

Details

Time bar (total: 30.0s)Debug log

sample339.0ms

Algorithm
halfpoints

simplify86.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

86.0ms
(im (complex (* (/ (+ (exp x) (exp (- x))) 2) (cos y)) (* (/ (- (exp x) (exp (- x))) 2) (sin y))))

prune13.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 43.7b

localize65.0ms

Local error

Found 4 expressions with local error:

57.0b
(- (exp x) (exp (- x)))
0.1b
(* (/ (- (exp x) (exp (- x))) 2) (sin y))
0.0b
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
0.0b
(+ (exp x) (exp (- x)))

rewrite33.0ms

Algorithm
rewrite-expression-head
Counts
4 → 87
Calls

4 calls. Slowest were:

13.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
9.0ms
(* (/ (- (exp x) (exp (- x))) 2) (sin y))
5.0ms
(- (exp x) (exp (- x)))

series181.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

72.0ms
(* (/ (- (exp x) (exp (- x))) 2) (sin y))
48.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
38.0ms
(- (exp x) (exp (- x)))
23.0ms
(+ (exp x) (exp (- x)))

simplify2.3s

Counts
60 → 99
Calls

60 calls. Slowest were:

298.0ms
(* 1/2 (* (- (exp x) (exp (- x))) (sin y)))
266.0ms
(* (* (* (/ (- (exp x) (exp (- x))) 2) (/ (- (exp x) (exp (- x))) 2)) (/ (- (exp x) (exp (- x))) 2)) (* (* (sin y) (sin y)) (sin y)))
243.0ms
(* 1/2 (* (- (exp x) (exp (* -1 x))) (sin y)))

prune885.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.1b

localize42.0ms

Local error

Found 4 expressions with local error:

0.1b
(* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y))
0.0b
(* (pow x 5) 1/60)
0.0b
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
0.0b
(fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60))

rewrite34.0ms

Algorithm
rewrite-expression-head
Counts
4 → 65
Calls

4 calls. Slowest were:

20.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
9.0ms
(* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y))
4.0ms
(* (pow x 5) 1/60)

series157.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

66.0ms
(* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y))
49.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
23.0ms
(fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60))
19.0ms
(* (pow x 5) 1/60)

simplify1.5s

Counts
34 → 77
Calls

34 calls. Slowest were:

189.0ms
(* 1/2 (* (+ (exp (* -1 x)) (exp x)) (cos y)))
188.0ms
(* (* (* (/ (+ (exp x) (exp (- x))) 2) (/ (+ (exp x) (exp (- x))) 2)) (/ (+ (exp x) (exp (- x))) 2)) (* (* (cos y) (cos y)) (cos y)))
185.0ms
(* (* (* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2)) (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2)) (* (* (sin y) (sin y)) (sin y)))

prune1.1s

Pruning

13 alts after pruning (12 fresh and 1 done)

Merged error: 0.0b

localize17.0ms

Local error

Found 4 expressions with local error:

0.6b
(cbrt (sin y))
0.6b
(cbrt (sin y))
0.6b
(cbrt (sin y))
0.5b
(* (cbrt (sin y)) (cbrt (sin y)))

rewrite9.0ms

Algorithm
rewrite-expression-head
Counts
4 → 69
Calls

4 calls. Slowest were:

7.0ms
(* (cbrt (sin y)) (cbrt (sin y)))
1.0ms
(cbrt (sin y))
0.0ms
(cbrt (sin y))

series570.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

167.0ms
(cbrt (sin y))
152.0ms
(* (cbrt (sin y)) (cbrt (sin y)))
130.0ms
(cbrt (sin y))
120.0ms
(cbrt (sin y))

simplify411.0ms

Counts
41 → 81
Calls

41 calls. Slowest were:

105.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
94.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
76.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))

prune1.8s

Pruning

13 alts after pruning (12 fresh and 1 done)

Merged error: 0.0b

localize51.0ms

Local error

Found 4 expressions with local error:

0.6b
(cbrt (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)))
0.6b
(cbrt (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)))
0.6b
(cbrt (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)))
0.5b
(* (cbrt (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60))) (cbrt (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60))))

rewrite14.0ms

Algorithm
rewrite-expression-head
Counts
4 → 69
Calls

4 calls. Slowest were:

9.0ms
(* (cbrt (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60))) (cbrt (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60))))
1.0ms
(cbrt (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)))
1.0ms
(cbrt (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)))

series625.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

164.0ms
(* (cbrt (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60))) (cbrt (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60))))
162.0ms
(cbrt (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)))
159.0ms
(cbrt (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)))
139.0ms
(cbrt (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)))

simplify4.3s

Counts
41 → 81
Calls

41 calls. Slowest were:

380.0ms
(+ (exp (* 1/3 (- (log 1/3600) (* 10 (log (/ 1 x)))))) (+ (* 40/3 (/ (exp (* 1/3 (- (log 1/3600) (* 10 (log (/ 1 x)))))) (pow x 2))) (* 320/9 (/ (exp (* 1/3 (- (log 1/3600) (* 10 (log (/ 1 x)))))) (pow x 4)))))
369.0ms
(+ (* 1/9 (* (pow x 2) (exp (* 1/3 (+ (log 4) (* 2 (log x))))))) (+ (exp (* 1/3 (+ (log 4) (* 2 (log x))))) (* 1/405 (* (pow x 4) (exp (* 1/3 (+ (log 4) (* 2 (log x)))))))))
281.0ms
(- (+ (exp (* 1/3 (- (log -1/60) (* 5 (log (/ -1 x)))))) (* 20/3 (/ (exp (* 1/3 (- (log -1/60) (* 5 (log (/ -1 x)))))) (pow x 2)))) (* 40/9 (/ (exp (* 1/3 (- (log -1/60) (* 5 (log (/ -1 x)))))) (pow x 4))))

prune1.9s

Pruning

13 alts after pruning (11 fresh and 2 done)

Merged error: 0.0b

regimes331.0ms

Accuracy

0% (0.9b remaining)

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

bsearch2.0ms

end0.0ms

sample13.1s

Algorithm
halfpoints