Average Error: 43.4 → 0.8
Time: 38.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}{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.4

    \[\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 2019021 
(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

sample398.0ms

Algorithm
halfpoints
Results

simplify95.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
95.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: 43.1b

localize71.0ms

Local error

Found 4 expressions with local error:

57.4b
(- (exp x) (exp (- x)))
0.1b
(* (/ (- (exp x) (exp (- x))) 2) (sin y))
0.0b
(+ (exp x) (exp (- x)))
0.0b
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))

rewrite38.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
12.0ms
(* (/ (- (exp x) (exp (- x))) 2) (sin y))
10.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
9.0ms
(+ (exp x) (exp (- x)))
7.0ms
(- (exp x) (exp (- x)))

series228.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
100.0ms
(* (/ (- (exp x) (exp (- x))) 2) (sin y))
53.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
48.0ms
(- (exp x) (exp (- x)))
27.0ms
(+ (exp x) (exp (- x)))

simplify2.0s

Counts
38 → 76
Calls
38 calls:
Slowest
385.0ms
(* (* (* (/ (- (exp x) (exp (- x))) 2) (/ (- (exp x) (exp (- x))) 2)) (/ (- (exp x) (exp (- x))) 2)) (* (* (sin y) (sin y)) (sin y)))
264.0ms
(* 1/2 (* (- (exp x) (exp (- x))) (sin y)))
231.0ms
(* (* (* (/ (+ (exp x) (exp (- x))) 2) (/ (+ (exp x) (exp (- x))) 2)) (/ (+ (exp x) (exp (- x))) 2)) (* (* (cos y) (cos y)) (cos y)))
214.0ms
(* 1/2 (* (- (exp x) (exp (* -1 x))) (sin y)))
187.0ms
(* 1/2 (* (+ (exp (* -1 x)) (exp x)) (cos y)))

prune1.2s

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.1b

localize59.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.0b
(* 1/60 (pow x 5))
0.0b
(+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))

rewrite35.0ms

Algorithm
rewrite-expression-head
Rules
11×associate-*r*
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-log-exp
add-exp-log
add-cbrt-cube
pow1
associate-*l*
*-commutative
div-inv
flip-+
cbrt-unprod
prod-exp
associate-*l/
pow-prod-down
unpow3
flip3-+
sum-log
+-commutative
cube-mult
Counts
4 → 54
Calls
4 calls:
Slowest
22.0ms
(* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y))
6.0ms
(+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))
3.0ms
(* 1/60 (pow x 5))
2.0ms
(* 1/3 (pow x 3))

series217.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
78.0ms
(+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))
76.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))

simplify891.0ms

Counts
30 → 66
Calls
30 calls:
Slowest
145.0ms
(* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y))
120.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)) (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2)) (* (* (sin y) (sin y)) (sin y)))
120.0ms
(* (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) (sin y))
94.0ms
(+ (* 1/120 (* (pow x 5) (sin y))) (* 1/6 (* (pow x 3) (sin y))))
80.0ms
(+ (log (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2)) (log (sin y)))

prune1.4s

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 0.0b

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

rewrite40.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
17.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)))
10.0ms
(cbrt (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2))
6.0ms
(cbrt (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2))
6.0ms
(cbrt (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2))

series729.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
204.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)))
182.0ms
(cbrt (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2))
177.0ms
(cbrt (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2))
166.0ms
(cbrt (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2))

simplify4.5s

Counts
53 → 84
Calls
53 calls:
Slowest
485.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))
413.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))
274.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))))))))))
236.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))))))))
228.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))))))))

prune1.9s

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 0.0b

localize28.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.6b
(cbrt (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))))
0.5b
(* (cbrt (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5))))) (cbrt (/ 1 2)))

rewrite22.0ms

Algorithm
rewrite-expression-head
Rules
18×cbrt-prod
11×add-cube-cbrt
11×*-un-lft-identity
11×cbrt-div
11×add-sqr-sqrt
associate-*r*
add-exp-log
associate-*l*
pow1
pow1/3
add-log-exp
add-cbrt-cube
div-inv
flip-+
flip3-+
associate-*l/
pow-prod-down
frac-times
cbrt-unprod
*-commutative
associate-*r/
prod-exp
Counts
4 → 69
Calls
4 calls:
Slowest
10.0ms
(* (cbrt (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5))))) (cbrt (/ 1 2)))
4.0ms
(cbrt (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2))
4.0ms
(cbrt (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))))
4.0ms
(cbrt (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2))

series744.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
200.0ms
(* (cbrt (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5))))) (cbrt (/ 1 2)))
197.0ms
(cbrt (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2))
179.0ms
(cbrt (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2))
168.0ms
(cbrt (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))))

simplify5.3s

Counts
50 → 81
Calls
50 calls:
Slowest
392.0ms
(* (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) (/ 1 2))
330.0ms
(* (cbrt (- (* (* 2 x) (* 2 x)) (* (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5))) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))))) (cbrt (/ 1 2)))
303.0ms
(cbrt (- (* (* 2 x) (* 2 x)) (* (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5))) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5))))))
301.0ms
(* (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) (/ 1 2))
284.0ms
(* (cbrt (- (* (* 2 x) (* 2 x)) (* (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5))) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))))) (cbrt 1))

prune2.8s

Pruning

11 alts after pruning (9 fresh and 2 done)

Merged error: 0.0b

regimes465.0ms

Accuracy

0% (0.7b remaining)

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

bsearch5.0ms

end0.0ms

sample11.8s

Algorithm
halfpoints
Results