Average Error: 43.5 → 0.7
Time: 26.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.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.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 2019022 
(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: 23.0s)Debug log

sample408.0ms

Algorithm
halfpoints
Results

simplify94.0ms

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

prune22.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 42.8b

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

rewrite39.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))
9.0ms
(* (/ (- (exp x) (exp (- x))) 2) (sin y))
8.0ms
(+ (exp x) (exp (- x)))
4.0ms
(- (exp x) (exp (- x)))

series246.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
87.0ms
(* (/ (- (exp x) (exp (- x))) 2) (sin y))
67.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
63.0ms
(- (exp x) (exp (- x)))
29.0ms
(+ (exp x) (exp (- x)))

simplify1.8s

Counts
38 → 76
Calls
38 calls:
Slowest
354.0ms
(* (* (* (/ (- (exp x) (exp (- x))) 2) (/ (- (exp x) (exp (- x))) 2)) (/ (- (exp x) (exp (- x))) 2)) (* (* (sin y) (sin y)) (sin y)))
235.0ms
(* 1/2 (* (- (exp x) (exp (- x))) (sin y)))
229.0ms
(* (* (* (/ (+ (exp x) (exp (- x))) 2) (/ (+ (exp x) (exp (- x))) 2)) (/ (+ (exp x) (exp (- x))) 2)) (* (* (cos y) (cos y)) (cos y)))
200.0ms
(* 1/2 (* (- (exp x) (exp (* -1 x))) (sin y)))
174.0ms
(* 1/2 (* (+ (exp (* -1 x)) (exp x)) (cos y)))

prune900.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.1b

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

rewrite23.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
16.0ms
(* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y))
4.0ms
(+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))
1.0ms
(* 1/3 (pow x 3))
1.0ms
(* 1/60 (pow x 5))

series175.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
74.0ms
(* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y))
50.0ms
(+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))
28.0ms
(* 1/60 (pow x 5))
22.0ms
(* 1/3 (pow x 3))

simplify699.0ms

Counts
30 → 66
Calls
30 calls:
Slowest
114.0ms
(* (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) (sin y))
100.0ms
(* (/ (+ (* 2 x) (+ (* 1/3 (pow x 3)) (* 1/60 (pow x 5)))) 2) (sin y))
84.0ms
(+ (* 1/120 (* (pow x 5) (sin y))) (* 1/6 (* (pow x 3) (sin y))))
64.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)))
63.0ms
(+ (* 1/120 (* (pow x 5) (sin y))) (* 1/6 (* (pow x 3) (sin y))))

prune1.1s

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 0.1b

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

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

series555.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
151.0ms
(cbrt (sin y))
150.0ms
(* (cbrt (sin y)) (cbrt (sin y)))
135.0ms
(cbrt (sin y))
117.0ms
(cbrt (sin y))

simplify236.0ms

Counts
41 → 73
Calls
41 calls:
Slowest
56.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
48.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
40.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
38.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.5s

Pruning

11 alts after pruning (10 fresh and 1 done)

Merged error: 0.0b

localize20.0ms

Local error

Found 4 expressions with local error:

0.6b
(cbrt (cbrt (sin y)))
0.6b
(cbrt (* (cbrt (sin y)) (cbrt (sin y))))
0.6b
(cbrt (sin y))
0.6b
(cbrt (sin y))

rewrite7.0ms

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

series554.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
143.0ms
(cbrt (sin y))
143.0ms
(cbrt (sin y))
141.0ms
(cbrt (* (cbrt (sin y)) (cbrt (sin y))))
127.0ms
(cbrt (cbrt (sin y)))

simplify273.0ms

Counts
25 → 57
Calls
25 calls:
Slowest
63.0ms
(- (pow y 2/9) (+ (* 2/3645 (pow (pow y 38) 1/9)) (* 1/27 (pow (pow y 20) 1/9))))
61.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
60.0ms
(- (pow y 1/9) (+ (* 13/29160 (pow (pow y 37) 1/9)) (* 1/54 (pow (pow y 19) 1/9))))
51.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
3.0ms
(pow (pow (sin y) 2) 1/9)

prune1.3s

Pruning

11 alts after pruning (10 fresh and 1 done)

Merged error: 0.0b

regimes350.0ms

Accuracy

0% (0.7b remaining)

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

bsearch3.0ms

end0.0ms

sample12.5s

Algorithm
halfpoints
Results