Average Error: 43.6 → 0.8
Time: 38.1s
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.6

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

    \[\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 2019002 +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: 34.9s)Debug log

sample504.0ms

Algorithm
halfpoints

simplify144.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

144.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

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

rewrite34.0ms

Algorithm
rewrite-expression-head
Counts
4 → 87
Calls

4 calls. Slowest were:

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

series240.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

100.0ms
(* (/ (- (exp x) (exp (- x))) 2) (sin y))
63.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
53.0ms
(- (exp x) (exp (- x)))
23.0ms
(+ (exp x) (exp (- x)))

simplify3.1s

Counts
60 → 99
Calls

60 calls. Slowest were:

388.0ms
(* (* (* (/ (- (exp x) (exp (- x))) 2) (/ (- (exp x) (exp (- x))) 2)) (/ (- (exp x) (exp (- x))) 2)) (* (* (sin y) (sin y)) (sin y)))
378.0ms
(* (* (* (/ (+ (exp x) (exp (- x))) 2) (/ (+ (exp x) (exp (- x))) 2)) (/ (+ (exp x) (exp (- x))) 2)) (* (* (cos y) (cos y)) (cos y)))
296.0ms
(* 1/2 (* (- (exp x) (exp (* -1 x))) (sin y)))

prune1.5s

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.1b

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

rewrite30.0ms

Algorithm
rewrite-expression-head
Counts
4 → 72
Calls

4 calls. Slowest were:

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

series199.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

86.0ms
(* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y))
70.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
24.0ms
(+ (exp x) (exp (- x)))
19.0ms
(* (pow x 5) 1/60)

simplify2.0s

Counts
38 → 84
Calls

38 calls. Slowest were:

256.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)))
238.0ms
(* (* (* (/ (+ (exp x) (exp (- x))) 2) (/ (+ (exp x) (exp (- x))) 2)) (/ (+ (exp x) (exp (- x))) 2)) (* (* (cos y) (cos y)) (cos y)))
237.0ms
(* 1/2 (* (+ (exp (* -1 x)) (exp x)) (cos y)))

prune1.5s

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 0.1b

localize19.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)))

rewrite14.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))

series632.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

178.0ms
(cbrt (sin y))
161.0ms
(cbrt (sin y))
155.0ms
(* (cbrt (sin y)) (cbrt (sin y)))
137.0ms
(cbrt (sin y))

simplify434.0ms

Counts
41 → 81
Calls

41 calls. Slowest were:

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

prune1.9s

Pruning

12 alts after pruning (11 fresh and 1 done)

Merged error: 0.0b

localize36.0ms

Local error

Found 4 expressions with local error:

14.6b
(cbrt (* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y)))
14.6b
(cbrt (* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y)))
14.6b
(cbrt (* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y)))
0.4b
(* (cbrt (* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y))) (cbrt (* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y))))

rewrite40.0ms

Algorithm
rewrite-expression-head
Counts
4 → 65
Calls

4 calls. Slowest were:

24.0ms
(* (cbrt (* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y))) (cbrt (* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y))))
5.0ms
(cbrt (* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y)))
5.0ms
(cbrt (* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y)))

series962.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

327.0ms
(* (cbrt (* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y))) (cbrt (* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y))))
231.0ms
(cbrt (* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y)))
216.0ms
(cbrt (* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y)))
187.0ms
(cbrt (* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y)))

simplify7.1s

Counts
38 → 77
Calls

38 calls. Slowest were:

644.0ms
(+ (* 20/3 (/ (* (cbrt 1/2) (exp (* 1/3 (- (log (* 1/60 (sin y))) (* 5 (log (/ 1 x))))))) (pow x 2))) (* (cbrt 1/2) (exp (* 1/3 (- (log (* 1/60 (sin y))) (* 5 (log (/ 1 x))))))))
463.0ms
(- (+ (* 1/18 (* (cbrt 1/2) (* (pow x 2) (exp (* 1/3 (+ (log 2) (+ (log y) (log x)))))))) (* (cbrt 1/2) (exp (* 1/3 (+ (log 2) (+ (log y) (log x))))))) (* 1/18 (* (cbrt 1/2) (* (exp (* 1/3 (+ (log 2) (+ (log y) (log x))))) (pow y 2)))))
425.0ms
(* (* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y)) (* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y)))

prune1.8s

Pruning

11 alts after pruning (10 fresh and 1 done)

Merged error: 0.0b

regimes235.0ms

Accuracy

0% (0.8b remaining)

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

bsearch3.0ms

end0.0ms

sample12.4s

Algorithm
halfpoints