Average Error: 44.0 → 0.7
Time: 25.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 44.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 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 2019010 +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: 22.2s)Debug log

sample351.0ms

Algorithm
halfpoints

simplify86.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
86.0ms
(im (complex (* (/ (+ (exp x) (exp (- x))) 2) (cos y)) (* (/ (- (exp x) (exp (- x))) 2) (sin y))))

prune11.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 44.7b

localize73.0ms

Local error

Found 2 expressions with local error:

58.8b
(- (exp x) (exp (- x)))
0.1b
(* (/ (- (exp x) (exp (- x))) 2) (sin y))

rewrite16.0ms

Algorithm
rewrite-expression-head
Rules
13×*-un-lft-identity
13×add-sqr-sqrt
11×add-cube-cbrt
prod-diff
add-log-exp
add-exp-log
associate-*l*
add-cbrt-cube
pow1
associate-*r*
fma-neg
log1p-expm1-u
expm1-log1p-u
difference-of-squares
distribute-lft-out--
flip--
div-inv
cbrt-unprod
*-commutative
prod-exp
associate-*l/
pow-prod-down
diff-log
flip3--
sub-neg
Counts
2 → 49
Calls
2 calls:
Slowest
10.0ms
(* (/ (- (exp x) (exp (- x))) 2) (sin y))
5.0ms
(- (exp x) (exp (- x)))

series118.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
77.0ms
(* (/ (- (exp x) (exp (- x))) 2) (sin y))
41.0ms
(- (exp x) (exp (- x)))

simplify1.5s

Counts
40 → 55
Calls
40 calls:
Slowest
324.0ms
(* (* (* (/ (- (exp x) (exp (- x))) 2) (/ (- (exp x) (exp (- x))) 2)) (/ (- (exp x) (exp (- x))) 2)) (* (* (sin y) (sin y)) (sin y)))
295.0ms
(* 1/2 (* (- (exp x) (exp (- x))) (sin y)))
215.0ms
(* 1/2 (* (- (exp x) (exp (* -1 x))) (sin y)))
61.0ms
(* (- (exp x) (exp (- x))) (sin y))
59.0ms
(* (/ (- (exp x) (exp (- x))) 2) (sin y))

prune518.0ms

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.1b

localize25.0ms

Local error

Found 3 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))

rewrite8.0ms

Algorithm
rewrite-expression-head
Rules
associate-*l*
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-exp-log
add-cbrt-cube
pow1
add-log-exp
log1p-expm1-u
associate-*r*
expm1-log1p-u
*-commutative
div-inv
fma-udef
cbrt-unprod
prod-exp
associate-*l/
pow-prod-down
Counts
3 → 44
Calls
3 calls:
Slowest
5.0ms
(* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y))
2.0ms
(* (pow x 5) 1/60)
0.0ms
(fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60))

series128.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
61.0ms
(* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y))
36.0ms
(fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60))
31.0ms
(* (pow x 5) 1/60)

simplify977.0ms

Counts
21 → 53
Calls
21 calls:
Slowest
193.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)) 2) (sin y))
142.0ms
(* (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) (sin y))
60.0ms
(* (cbrt (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2)) (cbrt (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2)))
59.0ms
(+ (* 1/120 (* (pow x 5) (sin y))) (* 1/6 (* (pow x 3) (sin y))))

prune876.0ms

Pruning

12 alts after pruning (11 fresh and 1 done)

Merged error: 0.0b

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

rewrite13.0ms

Algorithm
rewrite-expression-head
Rules
15×cbrt-prod
11×add-cube-cbrt
11×*-un-lft-identity
11×add-sqr-sqrt
pow1
pow1/3
add-exp-log
associate-*l*
associate-*r*
add-log-exp
log1p-expm1-u
add-cbrt-cube
expm1-log1p-u
pow-prod-up
pow-prod-down
cbrt-unprod
*-commutative
prod-exp
pow-plus
pow2
Counts
4 → 69
Calls
4 calls:
Slowest
9.0ms
(* (cbrt (sin y)) (cbrt (sin y)))
1.0ms
(cbrt (sin y))
1.0ms
(cbrt (sin y))
1.0ms
(cbrt (sin y))

series678.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
178.0ms
(cbrt (sin y))
169.0ms
(cbrt (sin y))
166.0ms
(cbrt (sin y))
165.0ms
(* (cbrt (sin y)) (cbrt (sin y)))

simplify334.0ms

Counts
41 → 81
Calls
41 calls:
Slowest
91.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))))
61.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
37.0ms
(- (+ (pow y 2/3) (* 1/405 (pow (pow y 14) 1/3))) (* 1/9 (pow (pow y 8) 1/3)))
2.0ms
(pow (sin y) 1/3)

prune1.2s

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 0.0b

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

rewrite3.0ms

Algorithm
rewrite-expression-head
Rules
12×cbrt-prod
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-log-exp
log1p-expm1-u
add-exp-log
pow1/3
add-cbrt-cube
pow1
expm1-log1p-u
Counts
4 → 52
Calls
4 calls:
Slowest
1.0ms
(cbrt (sin y))
1.0ms
(cbrt (sin y))
1.0ms
(cbrt (sin y))
1.0ms
(cbrt (sin y))

series558.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
162.0ms
(cbrt (sin y))
152.0ms
(cbrt (sin y))
124.0ms
(cbrt (sin y))
121.0ms
(cbrt (sin y))

simplify395.0ms

Counts
24 → 64
Calls
24 calls:
Slowest
96.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
93.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
91.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))))
2.0ms
(pow (sin y) 1/3)

prune1.0s

Pruning

10 alts after pruning (8 fresh and 2 done)

Merged error: 0.0b

regimes267.0ms

Accuracy

0% (0.7b remaining)

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

bsearch4.0ms

end0.0ms

sample13.0s

Algorithm
halfpoints