Average Error: 43.3 → 0.9
Time: 32.0s
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{{x}^{5} \cdot \frac{1}{60} + (\frac{1}{3} \cdot \left(x \cdot x\right) + 2)_* \cdot x}{2} \cdot \sin y i\right))\]

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 43.3

    \[\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 0.9

    \[\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. Simplified0.9

    \[\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. Using strategy rm
  5. Applied fma-udef0.9

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

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

Reproduce

herbie shell --seed 2019007 +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: 28.9s)Debug log

sample386.0ms

Algorithm
halfpoints

simplify130.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune15.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 47.0b

localize88.0ms

Local error

Found 4 expressions with local error:

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

rewrite30.0ms

Algorithm
rewrite-expression-head
Counts
4 → 87
Calls

4 calls. Slowest were:

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

series214.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

73.0ms
(* (/ (- (exp x) (exp (- x))) 2) (sin y))
60.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
43.0ms
(- (exp x) (exp (- x)))
38.0ms
(+ (exp x) (exp (- x)))

simplify2.7s

Counts
60 → 99
Calls

60 calls. Slowest were:

404.0ms
(* 1/2 (* (- (exp x) (exp (- x))) (sin y)))
336.0ms
(* 1/2 (* (- (exp x) (exp (* -1 x))) (sin y)))
303.0ms
(* (* (* (/ (+ (exp x) (exp (- x))) 2) (/ (+ (exp x) (exp (- x))) 2)) (/ (+ (exp x) (exp (- x))) 2)) (* (* (cos y) (cos y)) (cos y)))

prune1.5s

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.1b

localize56.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.1b
(* (pow x 5) 1/60)
0.0b
(fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60))
0.0b
(+ (exp x) (exp (- x)))

rewrite17.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

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

series158.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

74.0ms
(* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y))
35.0ms
(+ (exp x) (exp (- x)))
27.0ms
(fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60))
23.0ms
(* (pow x 5) 1/60)

simplify1.3s

Counts
28 → 73
Calls

28 calls. Slowest were:

275.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)))
184.0ms
(* (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) (sin y))
164.0ms
(* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y))

prune1.5s

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 0.0b

localize35.0ms

Local error

Found 4 expressions with local error:

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

rewrite18.0ms

Algorithm
rewrite-expression-head
Counts
4 → 64
Calls

4 calls. Slowest were:

8.0ms
(* (/ (+ (* (fma 1/3 (* x x) 2) x) (* (pow x 5) 1/60)) 2) (sin y))
4.0ms
(+ (exp x) (exp (- x)))
2.0ms
(* (fma 1/3 (* x x) 2) x)

series176.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

75.0ms
(* (/ (+ (* (fma 1/3 (* x x) 2) x) (* (pow x 5) 1/60)) 2) (sin y))
52.0ms
(* (fma 1/3 (* x x) 2) x)
26.0ms
(+ (exp x) (exp (- x)))
23.0ms
(* (pow x 5) 1/60)

simplify1.4s

Counts
30 → 76
Calls

30 calls. Slowest were:

390.0ms
(* (* (* (/ (+ (* (fma 1/3 (* x x) 2) x) (* (pow x 5) 1/60)) 2) (/ (+ (* (fma 1/3 (* x x) 2) x) (* (pow x 5) 1/60)) 2)) (/ (+ (* (fma 1/3 (* x x) 2) x) (* (pow x 5) 1/60)) 2)) (* (* (sin y) (sin y)) (sin y)))
205.0ms
(* (+ (* (fma 1/3 (* x x) 2) x) (* (pow x 5) 1/60)) (sin y))
135.0ms
(* (/ (+ (* (fma 1/3 (* x x) 2) x) (* (pow x 5) 1/60)) 2) (sin y))

prune1.5s

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 0.0b

localize21.0ms

Local error

Found 4 expressions with local error:

0.2b
(/ (fma (fma (* x x) 1/3 2) x (* (pow x 5) 1/60)) (/ 2 (sin y)))
0.1b
(/ 2 (sin y))
0.1b
(* (pow x 5) 1/60)
0.0b
(fma (fma (* x x) 1/3 2) x (* (pow x 5) 1/60))

rewrite13.0ms

Algorithm
rewrite-expression-head
Counts
4 → 72
Calls

4 calls. Slowest were:

7.0ms
(/ (fma (fma (* x x) 1/3 2) x (* (pow x 5) 1/60)) (/ 2 (sin y)))
4.0ms
(* (pow x 5) 1/60)
1.0ms
(/ 2 (sin y))

series151.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

69.0ms
(/ (fma (fma (* x x) 1/3 2) x (* (pow x 5) 1/60)) (/ 2 (sin y)))
36.0ms
(fma (fma (* x x) 1/3 2) x (* (pow x 5) 1/60))
30.0ms
(* (pow x 5) 1/60)
14.0ms
(/ 2 (sin y))

simplify2.5s

Counts
50 → 84
Calls

50 calls. Slowest were:

410.0ms
(/ (* (* (fma (fma (* x x) 1/3 2) x (* (pow x 5) 1/60)) (fma (fma (* x x) 1/3 2) x (* (pow x 5) 1/60))) (fma (fma (* x x) 1/3 2) x (* (pow x 5) 1/60))) (* (* (/ 2 (sin y)) (/ 2 (sin y))) (/ 2 (sin y))))
338.0ms
(/ (fma (fma (* x x) 1/3 2) x (* (pow x 5) 1/60)) (/ 1 (sin y)))
105.0ms
(/ (fma (fma (* x x) 1/3 2) x (* (pow x 5) 1/60)) (/ 2 (sin y)))

prune1.7s

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 0.0b

regimes204.0ms

Accuracy

0% (0.8b remaining)

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

bsearch6.0ms

end0.0ms

sample13.1s

Algorithm
halfpoints