Average Error: 43.7 → 0.8
Time: 29.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 43.7

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

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

    \[\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 2019005 +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: 25.9s)Debug log

sample462.0ms

Algorithm
halfpoints

simplify123.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

123.0ms
(im (complex (* (/ (+ (exp x) (exp (- x))) 2) (cos y)) (* (/ (- (exp x) (exp (- x))) 2) (sin y))))

prune28.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 43.0b

localize97.0ms

Local error

Found 3 expressions with local error:

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

rewrite21.0ms

Algorithm
rewrite-expression-head
Counts
3 → 66
Calls

3 calls. Slowest were:

10.0ms
(* (/ (- (exp x) (exp (- x))) 2) (sin y))
5.0ms
(- (exp x) (exp (- x)))
4.0ms
(+ (exp x) (exp (- x)))

series188.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

85.0ms
(- (exp x) (exp (- x)))
78.0ms
(* (/ (- (exp x) (exp (- x))) 2) (sin y))
25.0ms
(+ (exp x) (exp (- x)))

simplify2.2s

Counts
47 → 75
Calls

47 calls. Slowest were:

433.0ms
(* (* (* (/ (- (exp x) (exp (- x))) 2) (/ (- (exp x) (exp (- x))) 2)) (/ (- (exp x) (exp (- x))) 2)) (* (* (sin y) (sin y)) (sin y)))
410.0ms
(* 1/2 (* (- (exp x) (exp (- x))) (sin y)))
325.0ms
(* 1/2 (* (- (exp x) (exp (* -1 x))) (sin y)))

prune1.0s

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0.1b

localize57.0ms

Local error

Found 4 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))
0.0b
(+ (exp x) (exp (- x)))

rewrite24.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

11.0ms
(* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y))
8.0ms
(+ (exp x) (exp (- x)))
4.0ms
(* (pow x 5) 1/60)

series199.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

100.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))
33.0ms
(+ (exp x) (exp (- x)))
30.0ms
(* (pow x 5) 1/60)

simplify1.4s

Counts
28 → 73
Calls

28 calls. Slowest were:

335.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)))
213.0ms
(* (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) (sin y))
192.0ms
(* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y))

prune1.6s

Pruning

13 alts after pruning (12 fresh and 1 done)

Merged error: 0.0b

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

rewrite8.0ms

Algorithm
rewrite-expression-head
Counts
4 → 69
Calls

4 calls. Slowest were:

5.0ms
(* (cbrt (sin y)) (cbrt (sin y)))
1.0ms
(cbrt (sin y))
1.0ms
(cbrt (sin y))

series628.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

190.0ms
(cbrt (sin y))
158.0ms
(* (cbrt (sin y)) (cbrt (sin y)))
158.0ms
(cbrt (sin y))
122.0ms
(cbrt (sin y))

simplify356.0ms

Counts
41 → 81
Calls

41 calls. Slowest were:

108.0ms
(- (pow y 1/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))
71.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/3) (+ (* 1/18 (pow (pow y 7) 1/3)) (* 1/3240 (pow (pow y 13) 1/3))))

prune1.7s

Pruning

13 alts after pruning (11 fresh and 2 done)

Merged error: 0.0b

localize34.0ms

Local error

Found 4 expressions with local error:

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

rewrite4.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

1.0ms
(cbrt (cbrt (sin y)))
1.0ms
(cbrt (cbrt (sin y)))
1.0ms
(cbrt (cbrt (sin y)))

series679.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

193.0ms
(cbrt (sin y))
167.0ms
(cbrt (cbrt (sin y)))
165.0ms
(cbrt (cbrt (sin y)))
154.0ms
(cbrt (cbrt (sin y)))

simplify403.0ms

Counts
33 → 73
Calls

33 calls. Slowest were:

103.0ms
(- (pow y 1/9) (+ (* 13/29160 (pow (pow y 37) 1/9)) (* 1/54 (pow (pow y 19) 1/9))))
101.0ms
(- (pow y 1/9) (+ (* 13/29160 (pow (pow y 37) 1/9)) (* 1/54 (pow (pow y 19) 1/9))))
78.0ms
(- (pow y 1/9) (+ (* 13/29160 (pow (pow y 37) 1/9)) (* 1/54 (pow (pow y 19) 1/9))))

prune1.9s

Pruning

13 alts after pruning (10 fresh and 3 done)

Merged error: 0.0b

regimes685.0ms

Accuracy

0% (0.7b remaining)

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

bsearch5.0ms

end0.0ms

sample12.0s

Algorithm
halfpoints