Average Error: 29.8 → 0.6
Time: 13.2s
Precision: 64
Internal Precision: 128
\[\left(e^{x} - 2\right) + e^{-x}\]
\[\sqrt{{x}^{2} + \left({x}^{6} \cdot \frac{1}{360} + \frac{1}{12} \cdot {x}^{4}\right)} \cdot \sqrt{{x}^{2} + \left({x}^{6} \cdot \frac{1}{360} + \frac{1}{12} \cdot {x}^{4}\right)}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original29.8
Target0.0
Herbie0.6
\[4 \cdot {\left(\sinh \left(\frac{x}{2}\right)\right)}^{2}\]

Derivation

  1. Initial program 29.8

    \[\left(e^{x} - 2\right) + e^{-x}\]
  2. Taylor expanded around 0 0.6

    \[\leadsto \color{blue}{{x}^{2} + \left(\frac{1}{12} \cdot {x}^{4} + \frac{1}{360} \cdot {x}^{6}\right)}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt0.6

    \[\leadsto \color{blue}{\sqrt{{x}^{2} + \left(\frac{1}{12} \cdot {x}^{4} + \frac{1}{360} \cdot {x}^{6}\right)} \cdot \sqrt{{x}^{2} + \left(\frac{1}{12} \cdot {x}^{4} + \frac{1}{360} \cdot {x}^{6}\right)}}\]
  5. Final simplification0.6

    \[\leadsto \sqrt{{x}^{2} + \left({x}^{6} \cdot \frac{1}{360} + \frac{1}{12} \cdot {x}^{4}\right)} \cdot \sqrt{{x}^{2} + \left({x}^{6} \cdot \frac{1}{360} + \frac{1}{12} \cdot {x}^{4}\right)}\]

Reproduce

herbie shell --seed 2019022 
(FPCore (x)
  :name "exp2 (problem 3.3.7)"

  :herbie-target
  (* 4 (pow (sinh (/ x 2)) 2))

  (+ (- (exp x) 2) (exp (- x))))

Details

Time bar (total: 12.5s)Debug log

sample165.0ms

Algorithm
intervals
Results
120.0ms188×body1280valid
14.0ms246×body80valid
11.0ms30×body640valid
5.0ms24×body320valid
1.0msbody160valid

simplify27.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
27.0ms
(+ (- (exp x) 2) (exp (- x)))

prune4.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 27.1b

localize12.0ms

Local error

Found 2 expressions with local error:

4.4b
(+ (- (exp x) 2) (exp (- x)))
0.0b
(- (exp x) 2)

rewrite47.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
frac-add
*-un-lft-identity
flip--
flip3--
add-cube-cbrt
add-exp-log
exp-diff
add-cbrt-cube
sub-neg
associate-+l+
pow1
exp-neg
add-sqr-sqrt
neg-sub0
distribute-lft-out
flip-+
associate-+l-
flip3-+
sum-log
+-commutative
Counts
2 → 30
Calls
2 calls:
Slowest
41.0ms
(+ (- (exp x) 2) (exp (- x)))
6.0ms
(- (exp x) 2)

series116.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
103.0ms
(+ (- (exp x) 2) (exp (- x)))
13.0ms
(- (exp x) 2)

simplify1.4s

Counts
19 → 36
Calls
19 calls:
Slowest
296.0ms
(+ (* (- (pow (exp x) 3) (pow 2 3)) (exp x)) (* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) (exp 0)))
252.0ms
(+ (* (- (pow (exp x) 3) (pow 2 3)) (exp x)) (* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) 1))
197.0ms
(+ (* (- (* (exp x) (exp x)) (* 2 2)) (exp x)) (* (+ (exp x) 2) (exp 0)))
190.0ms
(+ (* (- (* (exp x) (exp x)) (* 2 2)) (exp x)) (* (+ (exp x) 2) 1))
115.0ms
(* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) (exp x))

prune303.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.0b

localize37.0ms

Local error

Found 4 expressions with local error:

0.1b
(* 1/12 (pow x 4))
0.1b
(* 1/360 (pow x 6))
0.0b
(+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))
0.0b
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))

rewrite28.0ms

Algorithm
rewrite-expression-head
Rules
11×add-log-exp
*-un-lft-identity
add-cube-cbrt
associate-*r*
add-sqr-sqrt
add-exp-log
add-cbrt-cube
sum-log
pow1
flip-+
*-commutative
flip3-+
+-commutative
distribute-lft-out
associate-+r+
Counts
4 → 47
Calls
4 calls:
Slowest
17.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
6.0ms
(+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))
2.0ms
(* 1/12 (pow x 4))
2.0ms
(* 1/360 (pow x 6))

series142.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
55.0ms
(+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))
35.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
28.0ms
(* 1/12 (pow x 4))
24.0ms
(* 1/360 (pow x 6))

simplify192.0ms

Counts
23 → 59
Calls
23 calls:
Slowest
41.0ms
(* (exp (pow x 2)) (exp (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
30.0ms
(* (exp (pow x 2)) (* (exp (* 1/12 (pow x 4))) (exp (* 1/360 (pow x 6)))))
21.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
21.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
18.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))

prune574.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.0b

localize10.0ms

Local error

Found 4 expressions with local error:

30.5b
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
30.5b
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
0.1b
(* 1/12 (pow x 4))
0.1b
(* 1/12 (pow x 4))

rewrite23.0ms

Algorithm
rewrite-expression-head
Rules
12×*-un-lft-identity
10×add-sqr-sqrt
sqrt-prod
add-cube-cbrt
associate-*r*
add-log-exp
add-exp-log
sqrt-div
add-cbrt-cube
pow1
distribute-lft-out
flip-+
*-commutative
pow1/2
flip3-+
rem-sqrt-square
Counts
4 → 52
Calls
4 calls:
Slowest
11.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
10.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
1.0ms
(* 1/12 (pow x 4))
1.0ms
(* 1/12 (pow x 4))

series120.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
44.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
43.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
17.0ms
(* 1/12 (pow x 4))
15.0ms
(* 1/12 (pow x 4))

simplify1.9s

Counts
32 → 64
Calls
32 calls:
Slowest
308.0ms
(- (+ (* 1/2 (/ 1 (* (sqrt 1/360) x))) (+ (* (sqrt 1/360) (pow x 3)) (* 1/24 (/ x (sqrt 1/360))))) (* 1/1152 (/ 1 (* (pow (sqrt 1/360) 3) x))))
263.0ms
(- (* 1/1152 (/ 1 (* (pow (sqrt 1/360) 3) x))) (+ (* 1/2 (/ 1 (* (sqrt 1/360) x))) (+ (* (sqrt 1/360) (pow x 3)) (* 1/24 (/ x (sqrt 1/360))))))
242.0ms
(- (* 1/1152 (/ 1 (* (pow (sqrt 1/360) 3) x))) (+ (* 1/2 (/ 1 (* (sqrt 1/360) x))) (+ (* (sqrt 1/360) (pow x 3)) (* 1/24 (/ x (sqrt 1/360))))))
239.0ms
(- (+ (* 1/2 (/ 1 (* (sqrt 1/360) x))) (+ (* (sqrt 1/360) (pow x 3)) (* 1/24 (/ x (sqrt 1/360))))) (* 1/1152 (/ 1 (* (pow (sqrt 1/360) 3) x))))
173.0ms
(sqrt (- (* (pow x 2) (pow x 2)) (* (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))))

prune815.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.0b

localize10.0ms

Local error

Found 4 expressions with local error:

0.8b
(log (exp (* 1/360 (pow x 6))))
0.1b
(* 1/12 (pow x 4))
0.1b
(exp (* 1/360 (pow x 6)))
0.1b
(* 1/360 (pow x 6))

rewrite11.0ms

Algorithm
rewrite-expression-head
Rules
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
associate-*r*
add-log-exp
pow1
add-exp-log
add-cbrt-cube
log-prod
*-commutative
log-pow
exp-prod
rem-exp-log
rem-log-exp
Counts
4 → 44
Calls
4 calls:
Slowest
3.0ms
(exp (* 1/360 (pow x 6)))
3.0ms
(log (exp (* 1/360 (pow x 6))))
2.0ms
(* 1/12 (pow x 4))
2.0ms
(* 1/360 (pow x 6))

series434.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
370.0ms
(exp (* 1/360 (pow x 6)))
25.0ms
(log (exp (* 1/360 (pow x 6))))
22.0ms
(* 1/360 (pow x 6))
17.0ms
(* 1/12 (pow x 4))

simplify60.0ms

Counts
24 → 56
Calls
24 calls:
Slowest
11.0ms
(+ 1 (+ (* 1/360 (pow x 6)) (* 1/259200 (pow x 12))))
8.0ms
(log (* (cbrt (exp (* 1/360 (pow x 6)))) (cbrt (exp (* 1/360 (pow x 6))))))
7.0ms
(log (sqrt (exp (* 1/360 (pow x 6)))))
3.0ms
(exp (* 1/360 (pow x 6)))
3.0ms
(exp (* 1/360 (pow x 6)))

prune761.0ms

Pruning

4 alts after pruning (2 fresh and 2 done)

Merged error: 0.0b

regimes52.0ms

Accuracy

0% (0.6b remaining)

Error of 0.6b against oracle of 0.0b and baseline of 0.6b

bsearch4.0ms

end0.0ms

sample5.3s

Algorithm
intervals
Results
3.9s5636×body1280valid
585.0ms7995×body80valid
485.0ms1279×body640valid
134.0ms624×body320valid
39.0ms288×body160valid