Average Error: 43.0 → 0.8
Time: 31.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}{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.0

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

start382.0ms

Algorithm
halfpoints

setup202.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 44.2b

localize40.0ms

Local error

Found 3 expressions with local error:

44.2b
(- (* (exp x) (sin y)) (/ (sin y) (exp x)))
0.0b
(* (exp x) (sin y))
0.0b
(/ (sin y) (exp x))

rewrite16.0ms

Algorithm
rewrite-expression-head
Counts
3 → 76
Calls

3 calls. Slowest were:

8.0ms
(- (* (exp x) (sin y)) (/ (sin y) (exp x)))
4.0ms
(* (exp x) (sin y))
3.0ms
(/ (sin y) (exp x))

series225.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

135.0ms
(- (* (exp x) (sin y)) (/ (sin y) (exp x)))
57.0ms
(* (exp x) (sin y))
33.0ms
(/ (sin y) (exp x))

simplify4.7s

Counts
70 → 85
Calls

70 calls. Slowest were:

456.0ms
(fma (exp x) (sin y) (- (* (/ (cbrt (sin y)) (cbrt (exp x))) (/ (* (cbrt (sin y)) (cbrt (sin y))) (* (cbrt (exp x)) (cbrt (exp x)))))))
348.0ms
(fma (exp x) (sin y) (- (* (/ (sin y) (sqrt (exp x))) (/ 1 (sqrt (exp x))))))
339.0ms
(fma (- (/ (sin y) (cbrt (exp x)))) (/ 1 (* (cbrt (exp x)) (cbrt (exp x)))) (* (/ (sin y) (cbrt (exp x))) (/ 1 (* (cbrt (exp x)) (cbrt (exp x))))))

prune1.0s

Pruning

17 alts after pruning (17 fresh and 0 done)

Merged error: 29.6b

localize15.0ms

Local error

Found 0 expressions with local error:

rewrite0.0ms

Algorithm
rewrite-expression-head
Counts
0 → 0
Calls

0 calls. Slowest were:

series0.0ms

Counts
0 → 0
Calls

0 calls. Slowest were:

simplify0.0ms

Counts
0 → 0
Calls

0 calls. Slowest were:

prune99.0ms

Pruning

17 alts after pruning (16 fresh and 1 done)

Merged error: 29.6b

localize78.0ms

Local error

Found 4 expressions with local error:

57.9b
(- (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))

rewrite64.0ms

Algorithm
rewrite-expression-head
Counts
4 → 87
Calls

4 calls. Slowest were:

23.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
20.0ms
(* (/ (- (exp x) (exp (- x))) 2) (sin y))
11.0ms
(- (exp x) (exp (- x)))

series280.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

121.0ms
(* (/ (- (exp x) (exp (- x))) 2) (sin y))
76.0ms
(* (/ (+ (exp x) (exp (- x))) 2) (cos y))
53.0ms
(- (exp x) (exp (- x)))
31.0ms
(+ (exp x) (exp (- x)))

simplify3.3s

Counts
60 → 99
Calls

60 calls. Slowest were:

405.0ms
(* (* (* (/ (- (exp x) (exp (- x))) 2) (/ (- (exp x) (exp (- x))) 2)) (/ (- (exp x) (exp (- x))) 2)) (* (* (sin y) (sin y)) (sin y)))
369.0ms
(* 1/2 (* (- (exp x) (exp (- x))) (sin y)))
366.0ms
(* (* (* (/ (+ (exp x) (exp (- x))) 2) (/ (+ (exp x) (exp (- x))) 2)) (/ (+ (exp x) (exp (- x))) 2)) (* (* (cos y) (cos y)) (cos y)))

prune1.6s

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.1b

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

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

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

series197.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

99.0ms
(* (/ (fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60)) 2) (sin y))
43.0ms
(+ (exp x) (exp (- x)))
35.0ms
(fma (fma 1/3 (* x x) 2) x (* (pow x 5) 1/60))
19.0ms
(* (pow x 5) 1/60)

simplify1.3s

Counts
28 → 73
Calls

28 calls. Slowest were:

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

prune1.8s

Pruning

11 alts after pruning (10 fresh and 1 done)

Merged error: 0.1b

regimes256.0ms

Accuracy

0% (0.7b remaining)

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

bsearch2.0ms