Average Error: 43.5 → 0.8
Time: 47.3s
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.5

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

    \[\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 1137770271 
(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: 43.8s)Debug log

sample600.0ms

Algorithm
halfpoints
Results

simplify183.0ms

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

prune32.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 42.0b

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

rewrite70.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
24.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
24.0ms
(* (/ (- (exp x) (exp (- x))) 2) (sin y))
10.0ms
(- (exp x) (exp (- x)))
10.0ms
(+ (exp x) (exp (- x)))

series397.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
148.0ms
(* (/ (- (exp x) (exp (- x))) 2) (sin y))
104.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
88.0ms
(- (exp x) (exp (- x)))
56.0ms
(+ (exp x) (exp (- x)))

simplify3.2s

Counts
38 → 76
Calls
38 calls:
Slowest
560.0ms
(* (* (* (/ (- (exp x) (exp (- x))) 2) (/ (- (exp x) (exp (- x))) 2)) (/ (- (exp x) (exp (- x))) 2)) (* (* (sin y) (sin y)) (sin y)))
415.0ms
(* 1/2 (* (- (exp x) (exp (- x))) (sin y)))
411.0ms
(* (* (* (/ (+ (exp x) (exp (- x))) 2) (/ (+ (exp x) (exp (- x))) 2)) (/ (+ (exp x) (exp (- x))) 2)) (* (* (cos y) (cos y)) (cos y)))
406.0ms
(* 1/2 (* (- (exp x) (exp (* -1 x))) (sin y)))
259.0ms
(* 1/2 (* (+ (exp (* -1 x)) (exp x)) (cos y)))

prune1.9s

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.1b

localize94.0ms

Local error

Found 4 expressions with local error:

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

rewrite65.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
29.0ms
(* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y))
28.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
3.0ms
(* 1/3 (pow x 3))
3.0ms
(* 1/60 (pow x 5))

series314.0ms

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

simplify2.5s

Counts
39 → 74
Calls
39 calls:
Slowest
413.0ms
(* (* (* (/ (+ (exp x) (exp (- x))) 2) (/ (+ (exp x) (exp (- x))) 2)) (/ (+ (exp x) (exp (- x))) 2)) (* (* (cos y) (cos y)) (cos y)))
260.0ms
(* 1/2 (* (+ (exp (* -1 x)) (exp x)) (cos y)))
243.0ms
(* 1/2 (* (+ (exp x) (exp (- x))) (cos y)))
228.0ms
(* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y))
201.0ms
(* (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) (sin y))

prune2.5s

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 0.0b

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

rewrite17.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
12.0ms
(* (cbrt (sin y)) (cbrt (sin y)))
1.0ms
(cbrt (sin y))
1.0ms
(cbrt (sin y))
1.0ms
(cbrt (sin y))

series1.0s

Counts
4 → 12
Calls
4 calls:
Slowest
262.0ms
(* (cbrt (sin y)) (cbrt (sin y)))
257.0ms
(cbrt (sin y))
253.0ms
(cbrt (sin y))
248.0ms
(cbrt (sin y))

simplify448.0ms

Counts
41 → 73
Calls
41 calls:
Slowest
107.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
97.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
94.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
67.0ms
(- (+ (pow y 2/3) (* 1/405 (pow (pow y 14) 1/3))) (* 1/9 (pow (pow y 8) 1/3)))
5.0ms
(pow (pow (sin y) 2) 1/3)

prune2.7s

Pruning

10 alts after pruning (8 fresh and 2 done)

Merged error: 0.0b

localize54.0ms

Local error

Found 4 expressions with local error:

0.7b
(cbrt (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2))
0.7b
(cbrt (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2))
0.7b
(cbrt (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2))
0.5b
(* (cbrt (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2)) (cbrt (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2)))

rewrite76.0ms

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

series1.2s

Counts
4 → 12
Calls
4 calls:
Slowest
332.0ms
(* (cbrt (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2)) (cbrt (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2)))
283.0ms
(cbrt (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2))
281.0ms
(cbrt (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2))
281.0ms
(cbrt (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2))

simplify6.7s

Counts
53 → 84
Calls
53 calls:
Slowest
627.0ms
(* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2))
626.0ms
(* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2))
396.0ms
(+ (* (pow (cbrt 1/2) 2) (exp (* 1/3 (+ (log 4) (* 2 (log x)))))) (+ (* 1/405 (* (pow (cbrt 1/2) 2) (* (pow x 4) (exp (* 1/3 (+ (log 4) (* 2 (log x)))))))) (* 1/9 (* (pow (cbrt 1/2) 2) (* (pow x 2) (exp (* 1/3 (+ (log 4) (* 2 (log x))))))))))
331.0ms
(- (+ (* 1/18 (* (cbrt 1/2) (* (pow x 2) (exp (* 1/3 (+ (log 2) (log x))))))) (* (cbrt 1/2) (exp (* 1/3 (+ (log 2) (log x)))))) (* 1/3240 (* (cbrt 1/2) (* (pow x 4) (exp (* 1/3 (+ (log 2) (log x))))))))
327.0ms
(- (+ (* 1/18 (* (cbrt 1/2) (* (pow x 2) (exp (* 1/3 (+ (log 2) (log x))))))) (* (cbrt 1/2) (exp (* 1/3 (+ (log 2) (log x)))))) (* 1/3240 (* (cbrt 1/2) (* (pow x 4) (exp (* 1/3 (+ (log 2) (log x))))))))

prune3.0s

Pruning

10 alts after pruning (8 fresh and 2 done)

Merged error: 0.0b

regimes412.0ms

Accuracy

0% (0.7b remaining)

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

bsearch6.0ms

end0.0ms

sample16.1s

Algorithm
halfpoints
Results