Average Error: 44.1 → 0.8
Time: 33.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 \cdot \left((\frac{1}{3} \cdot \left(x \cdot x\right) + 2)_*\right) + \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 44.1

    \[\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.8

    \[\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.8

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

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

Reproduce

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

start363.0ms

Algorithm
halfpoints

setup157.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 45.5b

localize93.0ms

Local error

Found 4 expressions with local error:

58.0b
(- (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))

rewrite50.0ms

Algorithm
rewrite-expression-head
Counts
4 → 87
Calls

4 calls. Slowest were:

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

series286.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

120.0ms
(* (/ (- (exp x) (exp (- x))) 2) (sin y))
63.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
57.0ms
(- (exp x) (exp (- x)))
45.0ms
(+ (exp x) (exp (- x)))

simplify2.6s

Counts
60 → 99
Calls

60 calls. Slowest were:

385.0ms
(* (* (* (/ (- (exp x) (exp (- x))) 2) (/ (- (exp x) (exp (- x))) 2)) (/ (- (exp x) (exp (- x))) 2)) (* (* (sin y) (sin y)) (sin y)))
311.0ms
(* (* (* (/ (+ (exp x) (exp (- x))) 2) (/ (+ (exp x) (exp (- x))) 2)) (/ (+ (exp x) (exp (- x))) 2)) (* (* (cos y) (cos y)) (cos y)))
180.0ms
(* 1/2 (* (- (exp x) (exp (* -1 x))) (sin y)))

prune1.7s

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.1b

localize56.0ms

Local error

Found 4 expressions with local error:

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

rewrite23.0ms

Algorithm
rewrite-expression-head
Counts
4 → 72
Calls

4 calls. Slowest were:

10.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
5.0ms
(* (/ (fma x (fma 1/3 (* x x) 2) (* (pow x 5) 1/60)) 2) (sin y))
5.0ms
(+ (exp x) (exp (- x)))

series215.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

69.0ms
(* (/ (fma x (fma 1/3 (* x x) 2) (* (pow x 5) 1/60)) 2) (sin y))
67.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
39.0ms
(* (pow x 5) 1/60)
39.0ms
(+ (exp x) (exp (- x)))

simplify1.8s

Counts
38 → 84
Calls

38 calls. Slowest were:

379.0ms
(* (* (* (/ (fma x (fma 1/3 (* x x) 2) (* (pow x 5) 1/60)) 2) (/ (fma x (fma 1/3 (* x x) 2) (* (pow x 5) 1/60)) 2)) (/ (fma x (fma 1/3 (* x x) 2) (* (pow x 5) 1/60)) 2)) (* (* (sin y) (sin y)) (sin y)))
270.0ms
(* (* (* (/ (+ (exp x) (exp (- x))) 2) (/ (+ (exp x) (exp (- x))) 2)) (/ (+ (exp x) (exp (- x))) 2)) (* (* (cos y) (cos y)) (cos y)))
233.0ms
(* (fma x (fma 1/3 (* x x) 2) (* (pow x 5) 1/60)) (sin y))

prune2.3s

Pruning

9 alts after pruning (8 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)))

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
4 → 69
Calls

4 calls. Slowest were:

9.0ms
(* (cbrt (sin y)) (cbrt (sin y)))
1.0ms
(cbrt (sin y))
1.0ms
(cbrt (sin y))

series651.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

183.0ms
(cbrt (sin y))
179.0ms
(cbrt (sin y))
145.0ms
(cbrt (sin y))
144.0ms
(* (cbrt (sin y)) (cbrt (sin y)))

simplify372.0ms

Counts
41 → 81
Calls

41 calls. Slowest were:

100.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
90.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
78.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))

prune2.4s

Pruning

11 alts after pruning (10 fresh and 1 done)

Merged error: 0.0b

localize59.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
(* (log1p (expm1 (cbrt (sin y)))) (cbrt (sin y)))

rewrite13.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

8.0ms
(* (log1p (expm1 (cbrt (sin y)))) (cbrt (sin y)))
1.0ms
(cbrt (sin y))
1.0ms
(cbrt (sin y))

series907.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

418.0ms
(* (log1p (expm1 (cbrt (sin y)))) (cbrt (sin y)))
185.0ms
(cbrt (sin y))
153.0ms
(cbrt (sin y))
151.0ms
(cbrt (sin y))

simplify316.0ms

Counts
32 → 73
Calls

32 calls. Slowest were:

80.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
63.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
63.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))

prune2.0s

Pruning

11 alts after pruning (9 fresh and 2 done)

Merged error: 0.0b

regimes347.0ms

Accuracy

0% (0.7b remaining)

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

bsearch5.0ms