Average Error: 43.2 → 0.7
Time: 35.5s
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}{60} \cdot {x}^{5} + \frac{1}{3} \cdot {x}^{3}\right) + 2 \cdot x}{2} \cdot \sin y i\right))\]

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 43.2

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

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

Reproduce

herbie shell --seed 2019018 
(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: 31.7s)Debug log

sample333.0ms

Algorithm
halfpoints
Results

simplify124.0ms

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

prune20.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 44.0b

localize121.0ms

Local error

Found 4 expressions with local error:

58.5b
(- (exp x) (exp (- x)))
0.2b
(* (/ (- (exp x) (exp (- x))) 2) (sin y))
0.0b
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
0.0b
(+ (exp x) (exp (- x)))

rewrite48.0ms

Algorithm
rewrite-expression-head
Rules
12×*-un-lft-identity
10×add-sqr-sqrt
add-log-exp
add-cube-cbrt
add-exp-log
associate-*l*
add-cbrt-cube
pow1
associate-*r*
div-inv
cbrt-unprod
*-commutative
prod-exp
associate-*l/
pow-prod-down
difference-of-squares
distribute-lft-out--
distribute-lft-out
flip--
flip-+
diff-log
flip3--
flip3-+
sub-neg
sum-log
+-commutative
Counts
4 → 64
Calls
4 calls:
Slowest
17.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
17.0ms
(* (/ (- (exp x) (exp (- x))) 2) (sin y))
7.0ms
(- (exp x) (exp (- x)))
7.0ms
(+ (exp x) (exp (- x)))

series210.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
81.0ms
(* (/ (- (exp x) (exp (- x))) 2) (sin y))
56.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
50.0ms
(- (exp x) (exp (- x)))
24.0ms
(+ (exp x) (exp (- x)))

simplify2.0s

Counts
38 → 76
Calls
38 calls:
Slowest
361.0ms
(* (* (* (/ (- (exp x) (exp (- x))) 2) (/ (- (exp x) (exp (- x))) 2)) (/ (- (exp x) (exp (- x))) 2)) (* (* (sin y) (sin y)) (sin y)))
287.0ms
(* 1/2 (* (- (exp x) (exp (- x))) (sin y)))
264.0ms
(* 1/2 (* (- (exp x) (exp (* -1 x))) (sin y)))
201.0ms
(* 1/2 (* (+ (exp (* -1 x)) (exp x)) (cos y)))
191.0ms
(* (* (* (/ (+ (exp x) (exp (- x))) 2) (/ (+ (exp x) (exp (- x))) 2)) (/ (+ (exp x) (exp (- x))) 2)) (* (* (cos y) (cos y)) (cos y)))

prune1.0s

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.1b

localize30.0ms

Local error

Found 4 expressions with local error:

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

rewrite32.0ms

Algorithm
rewrite-expression-head
Rules
14×associate-*r*
10×add-cube-cbrt
10×*-un-lft-identity
10×add-sqr-sqrt
add-exp-log
associate-*l*
add-cbrt-cube
pow1
add-log-exp
*-commutative
div-inv
cbrt-unprod
prod-exp
associate-*l/
pow-prod-down
unpow3
cube-mult
Counts
4 → 62
Calls
4 calls:
Slowest
16.0ms
(* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y))
13.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
1.0ms
(* 1/3 (pow x 3))
1.0ms
(* 1/60 (pow x 5))

series229.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
88.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
78.0ms
(* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y))
34.0ms
(* 1/60 (pow x 5))
29.0ms
(* 1/3 (pow x 3))

simplify1.4s

Counts
39 → 74
Calls
39 calls:
Slowest
213.0ms
(* (* (* (/ (+ (exp x) (exp (- x))) 2) (/ (+ (exp x) (exp (- x))) 2)) (/ (+ (exp x) (exp (- x))) 2)) (* (* (cos y) (cos y)) (cos y)))
177.0ms
(* 1/2 (* (+ (exp (* -1 x)) (exp x)) (cos y)))
165.0ms
(* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y))
129.0ms
(* 1/2 (* (+ (exp x) (exp (- x))) (cos y)))
105.0ms
(* (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) (sin y))

prune1.4s

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 0.1b

localize20.0ms

Local error

Found 4 expressions with local error:

14.7b
(cbrt (* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y)))
14.7b
(cbrt (* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y)))
14.7b
(cbrt (* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y)))
0.5b
(* (cbrt (* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y))) (cbrt (* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y))))

rewrite26.0ms

Algorithm
rewrite-expression-head
Rules
pow1
associate-*l/
pow1/3
cbrt-div
add-cube-cbrt
add-exp-log
*-un-lft-identity
add-sqr-sqrt
cbrt-prod
add-log-exp
associate-*l*
associate-*r*
add-cbrt-cube
pow-prod-up
pow-prod-down
cbrt-unprod
*-commutative
associate-*r/
prod-exp
pow-plus
frac-times
pow2
Counts
4 → 57
Calls
4 calls:
Slowest
9.0ms
(* (cbrt (* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y))) (cbrt (* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y))))
5.0ms
(cbrt (* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y)))
5.0ms
(cbrt (* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y)))
5.0ms
(cbrt (* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y)))

series1.0s

Counts
4 → 12
Calls
4 calls:
Slowest
301.0ms
(* (cbrt (* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y))) (cbrt (* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y))))
264.0ms
(cbrt (* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y)))
243.0ms
(cbrt (* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y)))
216.0ms
(cbrt (* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y)))

simplify6.0s

Counts
38 → 69
Calls
38 calls:
Slowest
414.0ms
(+ (* 20/3 (/ (* (exp (* 1/3 (- (log (* 1/60 (sin y))) (* 5 (log (/ -1 x)))))) (cbrt -1/2)) (pow x 2))) (* (exp (* 1/3 (- (log (* 1/60 (sin y))) (* 5 (log (/ -1 x)))))) (cbrt -1/2)))
354.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))))))))
322.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))))))))
312.0ms
(+ (* 20/3 (/ (* (exp (* 1/3 (- (log (* 1/60 (sin y))) (* 5 (log (/ -1 x)))))) (cbrt -1/2)) (pow x 2))) (* (exp (* 1/3 (- (log (* 1/60 (sin y))) (* 5 (log (/ -1 x)))))) (cbrt -1/2)))
307.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)))))

prune1.8s

Pruning

13 alts after pruning (12 fresh and 1 done)

Merged error: 0.0b

localize18.0ms

Local error

Found 4 expressions with local error:

0.7b
(cbrt (sin y))
0.7b
(cbrt (sin y))
0.7b
(cbrt (sin y))
0.5b
(* (cbrt (sin y)) (cbrt (sin y)))

rewrite7.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
add-cbrt-cube
pow-prod-up
pow-prod-down
cbrt-unprod
*-commutative
prod-exp
pow-plus
pow2
Counts
4 → 61
Calls
4 calls:
Slowest
5.0ms
(* (cbrt (sin y)) (cbrt (sin y)))
1.0ms
(cbrt (sin y))
0.0ms
(cbrt (sin y))
0.0ms
(cbrt (sin y))

series635.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
171.0ms
(* (cbrt (sin y)) (cbrt (sin y)))
165.0ms
(cbrt (sin y))
153.0ms
(cbrt (sin y))
145.0ms
(cbrt (sin y))

simplify277.0ms

Counts
41 → 73
Calls
41 calls:
Slowest
70.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
62.0ms
(- (+ (pow y 2/3) (* 1/405 (pow (pow y 14) 1/3))) (* 1/9 (pow (pow y 8) 1/3)))
45.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
43.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
4.0ms
(pow (pow (sin y) 2) 1/3)

prune1.7s

Pruning

16 alts after pruning (14 fresh and 2 done)

Merged error: 0.0b

regimes376.0ms

Accuracy

0% (0.7b remaining)

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

bsearch3.0ms

end0.0ms

sample12.9s

Algorithm
halfpoints
Results