Average Error: 29.4 → 0.6
Time: 28.4s
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.4
Target0.0
Herbie0.6
\[4 \cdot {\left(\sinh \left(\frac{x}{2}\right)\right)}^{2}\]

Derivation

  1. Initial program 29.4

    \[\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 323378853 
(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: 26.5s)Debug log

sample228.0ms

Algorithm
intervals
Results
140.0ms180×body1280valid
25.0ms285×body80valid
22.0ms45×body640valid
5.0ms15×body320valid
2.0ms11×body160valid

simplify67.0ms

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

prune12.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 29.5b

localize35.0ms

Local error

Found 2 expressions with local error:

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

rewrite37.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
30.0ms
(+ (- (exp x) 2) (exp (- x)))
6.0ms
(- (exp x) 2)

series147.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
131.0ms
(+ (- (exp x) 2) (exp (- x)))
17.0ms
(- (exp x) 2)

simplify2.0s

Counts
19 → 36
Calls
19 calls:
Slowest
445.0ms
(+ (* (- (pow (exp x) 3) (pow 2 3)) (exp x)) (* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) (exp 0)))
429.0ms
(+ (* (- (pow (exp x) 3) (pow 2 3)) (exp x)) (* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) 1))
303.0ms
(+ (* (- (* (exp x) (exp x)) (* 2 2)) (exp x)) (* (+ (exp x) 2) (exp 0)))
208.0ms
(+ (* (- (* (exp x) (exp x)) (* 2 2)) (exp x)) (* (+ (exp x) 2) 1))
133.0ms
(* (+ (* (exp x) (exp x)) (+ (* 2 2) (* (exp x) 2))) (exp x))

prune533.0ms

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.0b

localize54.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
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
0.0b
(+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))

rewrite30.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
16.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
8.0ms
(+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))
3.0ms
(* 1/12 (pow x 4))
3.0ms
(* 1/360 (pow x 6))

series235.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
109.0ms
(+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))
48.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
46.0ms
(* 1/360 (pow x 6))
33.0ms
(* 1/12 (pow x 4))

simplify329.0ms

Counts
23 → 59
Calls
23 calls:
Slowest
67.0ms
(* (exp (pow x 2)) (* (exp (* 1/12 (pow x 4))) (exp (* 1/360 (pow x 6)))))
66.0ms
(* (exp (pow x 2)) (exp (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
28.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
28.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))
27.0ms
(+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))

prune1.0s

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0.0b

localize17.0ms

Local error

Found 4 expressions with local error:

28.6b
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
28.6b
(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))

rewrite44.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
19.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
18.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
3.0ms
(* 1/12 (pow x 4))
3.0ms
(* 1/12 (pow x 4))

series237.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
87.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
84.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
33.0ms
(* 1/12 (pow x 4))
32.0ms
(* 1/12 (pow x 4))

simplify2.8s

Counts
32 → 64
Calls
32 calls:
Slowest
417.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))))
411.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))))
372.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))))))
371.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))))))
263.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))))))

prune1.4s

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 0.0b

localize75.0ms

Local error

Found 4 expressions with local error:

29.6b
(cbrt (+ (+ (* (pow x 6) 1/360) (* x x)) (* 1/12 (pow x 4))))
29.6b
(cbrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
28.6b
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
0.3b
(* (fabs (cbrt (+ (+ (* (pow x 6) 1/360) (* x x)) (* 1/12 (pow x 4))))) (sqrt (cbrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))))

rewrite78.0ms

Algorithm
rewrite-expression-head
Rules
17×*-un-lft-identity
12×add-sqr-sqrt
11×sqrt-prod
11×add-cube-cbrt
11×cbrt-prod
10×associate-*r*
add-exp-log
add-cbrt-cube
cbrt-div
pow1
add-log-exp
flip-+
sqrt-div
flip3-+
distribute-lft-out
associate-*l*
associate-*r/
pow1/3
cbrt-unprod
*-commutative
prod-exp
pow-prod-down
pow1/2
rem-sqrt-square
Counts
4 → 68
Calls
4 calls:
Slowest
29.0ms
(* (fabs (cbrt (+ (+ (* (pow x 6) 1/360) (* x x)) (* 1/12 (pow x 4))))) (sqrt (cbrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))))
18.0ms
(cbrt (+ (+ (* (pow x 6) 1/360) (* x x)) (* 1/12 (pow x 4))))
18.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
10.0ms
(cbrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))

series765.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
250.0ms
(* (fabs (cbrt (+ (+ (* (pow x 6) 1/360) (* x x)) (* 1/12 (pow x 4))))) (sqrt (cbrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))))
215.0ms
(cbrt (+ (+ (* (pow x 6) 1/360) (* x x)) (* 1/12 (pow x 4))))
215.0ms
(cbrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))
85.0ms
(sqrt (+ (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6)))))

simplify6.5s

Counts
47 → 80
Calls
47 calls:
Slowest
786.0ms
(+ (* 10 (/ (exp (* 1/3 (- (log 1/360) (* 6 (log (/ 1 x)))))) (pow x 2))) (+ (exp (* 1/3 (- (log 1/360) (* 6 (log (/ 1 x)))))) (* 20 (/ (exp (* 1/3 (- (log 1/360) (* 6 (log (/ 1 x)))))) (pow x 4)))))
783.0ms
(+ (* 10 (/ (exp (* 1/3 (- (log 1/360) (* 6 (log (/ 1 x)))))) (pow x 2))) (+ (exp (* 1/3 (- (log 1/360) (* 6 (log (/ 1 x)))))) (* 20 (/ (exp (* 1/3 (- (log 1/360) (* 6 (log (/ 1 x)))))) (pow x 4)))))
499.0ms
(sqrt (cbrt (+ (* (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)))) (* (pow x 2) (+ (* 1/12 (pow x 4)) (* 1/360 (pow x 6))))))))
411.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))))
374.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))))))

prune2.4s

Pruning

6 alts after pruning (4 fresh and 2 done)

Merged error: 0.0b

regimes171.0ms

Accuracy

0% (0.6b remaining)

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

bsearch4.0ms

end0.0ms

sample7.3s

Algorithm
intervals
Results
5.2s5743×body1280valid
742.0ms8077×body80valid
705.0ms1174×body640valid
230.0ms608×body320valid
69.0ms311×body160valid