Average Error: 30.9 → 0.1
Time: 22.6s
Precision: 64
Internal Precision: 128
\[\frac{1 - \cos x}{x \cdot x}\]
\[\frac{\frac{\tan \left(\frac{x}{2}\right)}{x}}{\frac{x}{\sin x}}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 30.9

    \[\frac{1 - \cos x}{x \cdot x}\]
  2. Using strategy rm
  3. Applied flip--31.0

    \[\leadsto \frac{\color{blue}{\frac{1 \cdot 1 - \cos x \cdot \cos x}{1 + \cos x}}}{x \cdot x}\]
  4. Applied associate-/l/31.0

    \[\leadsto \color{blue}{\frac{1 \cdot 1 - \cos x \cdot \cos x}{\left(x \cdot x\right) \cdot \left(1 + \cos x\right)}}\]
  5. Simplified15.4

    \[\leadsto \frac{\color{blue}{\sin x \cdot \sin x}}{\left(x \cdot x\right) \cdot \left(1 + \cos x\right)}\]
  6. Taylor expanded around -inf 15.4

    \[\leadsto \color{blue}{\frac{{\left(\sin x\right)}^{2}}{{x}^{2} \cdot \left(\cos x + 1\right)}}\]
  7. Simplified15.6

    \[\leadsto \color{blue}{\frac{\tan \left(\frac{x}{2}\right)}{\frac{x \cdot x}{\sin x}}}\]
  8. Using strategy rm
  9. Applied *-un-lft-identity15.6

    \[\leadsto \frac{\tan \left(\frac{x}{2}\right)}{\frac{x \cdot x}{\color{blue}{1 \cdot \sin x}}}\]
  10. Applied times-frac0.5

    \[\leadsto \frac{\tan \left(\frac{x}{2}\right)}{\color{blue}{\frac{x}{1} \cdot \frac{x}{\sin x}}}\]
  11. Applied associate-/r*0.1

    \[\leadsto \color{blue}{\frac{\frac{\tan \left(\frac{x}{2}\right)}{\frac{x}{1}}}{\frac{x}{\sin x}}}\]
  12. Final simplification0.1

    \[\leadsto \frac{\frac{\tan \left(\frac{x}{2}\right)}{x}}{\frac{x}{\sin x}}\]

Reproduce

herbie shell --seed 2019005 
(FPCore (x)
  :name "cos2 (problem 3.4.1)"
  (/ (- 1 (cos x)) (* x x)))

Details

Time bar (total: 22.1s)Debug log

sample168.0ms

Algorithm
intervals

simplify26.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

26.0ms
(/ (- 1 (cos x)) (* x x))

prune4.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 30.8b

localize12.0ms

Local error

Found 2 expressions with local error:

15.5b
(/ (- 1 (cos x)) (* x x))
1.6b
(- 1 (cos x))

rewrite5.0ms

Algorithm
rewrite-expression-head
Counts
2 → 33
Calls

2 calls. Slowest were:

4.0ms
(/ (- 1 (cos x)) (* x x))
1.0ms
(- 1 (cos x))

series78.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

57.0ms
(/ (- 1 (cos x)) (* x x))
21.0ms
(- 1 (cos x))

simplify600.0ms

Counts
19 → 39
Calls

19 calls. Slowest were:

300.0ms
(/ (* (* (- 1 (cos x)) (- 1 (cos x))) (- 1 (cos x))) (* (* (* x x) (* x x)) (* x x)))
69.0ms
(- (+ (* 1/2 (pow x 2)) (* 1/720 (pow x 6))) (* 1/24 (pow x 4)))
66.0ms
(- (+ (* 1/720 (pow x 4)) 1/2) (* 1/24 (pow x 2)))

prune378.0ms

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 0.0b

localize27.0ms

Local error

Found 4 expressions with local error:

15.3b
(/ (* (sin x) (sin x)) (* (* x x) (+ 1 (cos x))))
0.4b
(+ 1 (cos x))
0.2b
(* (sin x) (sin x))
0.1b
(* (* x x) (+ 1 (cos x)))

rewrite37.0ms

Algorithm
rewrite-expression-head
Counts
4 → 76
Calls

4 calls. Slowest were:

16.0ms
(/ (* (sin x) (sin x)) (* (* x x) (+ 1 (cos x))))
8.0ms
(* (sin x) (sin x))
7.0ms
(* (* x x) (+ 1 (cos x)))

series102.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

40.0ms
(/ (* (sin x) (sin x)) (* (* x x) (+ 1 (cos x))))
28.0ms
(* (* x x) (+ 1 (cos x)))
25.0ms
(* (sin x) (sin x))
8.0ms
(+ 1 (cos x))

simplify5.3s

Counts
51 → 88
Calls

51 calls. Slowest were:

1.5s
(* (* (* (* x x) (* x x)) (* x x)) (* (* (+ 1 (cos x)) (+ 1 (cos x))) (+ 1 (cos x))))
411.0ms
(/ (* (* (* (sin x) (sin x)) (* (sin x) (sin x))) (* (sin x) (sin x))) (* (* (* (* x x) (+ 1 (cos x))) (* (* x x) (+ 1 (cos x)))) (* (* x x) (+ 1 (cos x)))))
374.0ms
(/ (* (* (* (sin x) (sin x)) (sin x)) (* (* (sin x) (sin x)) (sin x))) (* (* (* (* x x) (+ 1 (cos x))) (* (* x x) (+ 1 (cos x)))) (* (* x x) (+ 1 (cos x)))))

prune690.0ms

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 0b

localize20.0ms

Local error

Found 2 expressions with local error:

15.0b
(/ (* x x) (sin x))
0.2b
(/ (tan (/ x 2)) (/ (* x x) (sin x)))

rewrite16.0ms

Algorithm
rewrite-expression-head
Counts
2 → 66
Calls

2 calls. Slowest were:

9.0ms
(/ (tan (/ x 2)) (/ (* x x) (sin x)))
5.0ms
(/ (* x x) (sin x))

series102.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

70.0ms
(/ (tan (/ x 2)) (/ (* x x) (sin x)))
32.0ms
(/ (* x x) (sin x))

simplify2.3s

Counts
74 → 72
Calls

74 calls. Slowest were:

849.0ms
(/ (* (* (tan (/ x 2)) (tan (/ x 2))) (tan (/ x 2))) (* (* (/ (* x x) (sin x)) (/ (* x x) (sin x))) (/ (* x x) (sin x))))
181.0ms
(/ (* (* (* x x) (* x x)) (* x x)) (* (* (sin x) (sin x)) (sin x)))
139.0ms
(/ (* (sin x) (sin (* 1/2 x))) (* (cos (* 1/2 x)) (pow x 2)))

prune461.0ms

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 0b

localize10.0ms

Local error

Found 3 expressions with local error:

0.1b
(/ (tan (/ x 2)) (/ x 1))
0.1b
(/ x (sin x))
0.1b
(/ (/ (tan (/ x 2)) (/ x 1)) (/ x (sin x)))

rewrite13.0ms

Algorithm
rewrite-expression-head
Counts
3 → 151
Calls

3 calls. Slowest were:

6.0ms
(/ (/ (tan (/ x 2)) (/ x 1)) (/ x (sin x)))
4.0ms
(/ (tan (/ x 2)) (/ x 1))
0.0ms
(/ x (sin x))

series111.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

55.0ms
(/ (/ (tan (/ x 2)) (/ x 1)) (/ x (sin x)))
33.0ms
(/ (tan (/ x 2)) (/ x 1))
22.0ms
(/ x (sin x))

simplify5.0s

Counts
207 → 160
Calls

207 calls. Slowest were:

661.0ms
(/ (* (* (/ (tan (/ x 2)) (/ x 1)) (/ (tan (/ x 2)) (/ x 1))) (/ (tan (/ x 2)) (/ x 1))) (* (* (/ x (sin x)) (/ x (sin x))) (/ x (sin x))))
218.0ms
(/ (/ (* (cbrt (tan (/ x 2))) (cbrt (tan (/ x 2)))) (* (cbrt (/ x 1)) (cbrt (/ x 1)))) (* (cbrt (/ x (sin x))) (cbrt (/ x (sin x)))))
181.0ms
(/ (* (sin x) (sin (* 1/2 x))) (* (cos (* 1/2 x)) (pow x 2)))

prune1.4s

Pruning

6 alts after pruning (4 fresh and 2 done)

Merged error: 0b

regimes48.0ms

Accuracy

0% (0.1b remaining)

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

bsearch1.0ms

end0.0ms

sample5.0s

Algorithm
intervals