Average Error: 43.1 → 0.7
Time: 31.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{(\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.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.7

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

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

    \[\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 2019004 +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.0s)Debug log

sample467.0ms

Algorithm
halfpoints

simplify112.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune12.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 43.8b

localize99.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))) 2) (cos y))
0.0b
(+ (exp x) (exp (- x)))

rewrite50.0ms

Algorithm
rewrite-expression-head
Counts
4 → 87
Calls

4 calls. Slowest were:

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

series293.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

106.0ms
(* (/ (- (exp x) (exp (- x))) 2) (sin y))
81.0ms
(- (exp x) (exp (- x)))
69.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
37.0ms
(+ (exp x) (exp (- x)))

simplify3.1s

Counts
60 → 99
Calls

60 calls. Slowest were:

390.0ms
(* 1/2 (* (- (exp x) (exp (- x))) (sin y)))
386.0ms
(* 1/2 (* (- (exp x) (exp (* -1 x))) (sin y)))
371.0ms
(* (* (* (/ (- (exp x) (exp (- x))) 2) (/ (- (exp x) (exp (- x))) 2)) (/ (- (exp x) (exp (- x))) 2)) (* (* (sin y) (sin y)) (sin y)))

prune1.5s

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.1b

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

rewrite350.0ms

Algorithm
rewrite-expression-head
Counts
4 → 65
Calls

4 calls. Slowest were:

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

series251.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

101.0ms
(* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y))
68.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
43.0ms
(fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60))
38.0ms
(* (pow x 5) 1/60)

simplify2.0s

Counts
34 → 77
Calls

34 calls. Slowest were:

265.0ms
(* (* (* (/ (+ (exp x) (exp (- x))) 2) (/ (+ (exp x) (exp (- x))) 2)) (/ (+ (exp x) (exp (- x))) 2)) (* (* (cos y) (cos y)) (cos y)))
257.0ms
(* 1/2 (* (+ (exp (* -1 x)) (exp x)) (cos y)))
238.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.4s

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 0.0b

localize39.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.6b
(* (cbrt (sin y)) (cbrt (sin y)))

rewrite16.0ms

Algorithm
rewrite-expression-head
Counts
4 → 69
Calls

4 calls. Slowest were:

10.0ms
(* (cbrt (sin y)) (cbrt (sin y)))
2.0ms
(cbrt (sin y))
1.0ms
(cbrt (sin y))

series642.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

183.0ms
(* (cbrt (sin y)) (cbrt (sin y)))
166.0ms
(cbrt (sin y))
158.0ms
(cbrt (sin y))
135.0ms
(cbrt (sin y))

simplify438.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))))
88.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
85.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))

prune1.8s

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 0.0b

localize50.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.6b
(* (cbrt (sin y)) (cbrt (sin y)))

rewrite7.0ms

Algorithm
rewrite-expression-head
Counts
4 → 69
Calls

4 calls. Slowest were:

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

series615.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

174.0ms
(cbrt (sin y))
162.0ms
(cbrt (sin y))
151.0ms
(* (cbrt (sin y)) (cbrt (sin y)))
128.0ms
(cbrt (sin y))

simplify436.0ms

Counts
41 → 81
Calls

41 calls. Slowest were:

116.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
89.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
80.0ms
(- (+ (pow y 2/3) (* 1/405 (pow (pow y 14) 1/3))) (* 1/9 (pow (pow y 8) 1/3)))

prune1.9s

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 0.0b

regimes219.0ms

Accuracy

0% (0.7b remaining)

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

bsearch2.0ms

end0.0ms

sample12.1s

Algorithm
halfpoints