Average Error: 30.8 → 0.1
Time: 16.7s
Precision: 64
Internal Precision: 128
\[\frac{1 - \cos x}{x \cdot x}\]
\[\frac{\frac{\sin x}{x} \cdot \tan \left(\frac{x}{2}\right)}{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.8

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

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

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

    \[\leadsto \frac{\color{blue}{\sin x \cdot \sin x}}{\left(x \cdot x\right) \cdot \left(1 + \cos x\right)}\]
  6. Using strategy rm
  7. Applied times-frac15.5

    \[\leadsto \color{blue}{\frac{\sin x}{x \cdot x} \cdot \frac{\sin x}{1 + \cos x}}\]
  8. Simplified15.3

    \[\leadsto \frac{\sin x}{x \cdot x} \cdot \color{blue}{\tan \left(\frac{x}{2}\right)}\]
  9. Using strategy rm
  10. Applied associate-/r*0.2

    \[\leadsto \color{blue}{\frac{\frac{\sin x}{x}}{x}} \cdot \tan \left(\frac{x}{2}\right)\]
  11. Using strategy rm
  12. Applied associate-*l/0.1

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

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

Reproduce

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

Details

Time bar (total: 16.2s)Debug log

sample163.0ms

Algorithm
intervals

simplify30.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune9.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 30.9b

localize24.0ms

Local error

Found 2 expressions with local error:

16.5b
(/ (- 1 (cos x)) (* x x))
1.8b
(- 1 (cos x))

rewrite34.0ms

Algorithm
rewrite-expression-head
Counts
2 → 33
Calls

2 calls. Slowest were:

8.0ms
(/ (- 1 (cos x)) (* x x))
2.0ms
(- 1 (cos x))

series93.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

64.0ms
(/ (- 1 (cos x)) (* x x))
30.0ms
(- 1 (cos x))

simplify956.0ms

Counts
19 → 39
Calls

19 calls. Slowest were:

742.0ms
(/ (* (* (- 1 (cos x)) (- 1 (cos x))) (- 1 (cos x))) (* (* (* x x) (* x x)) (* x x)))
39.0ms
(- (+ (* 1/2 (pow x 2)) (* 1/720 (pow x 6))) (* 1/24 (pow x 4)))
36.0ms
(- (+ (* 1/720 (pow x 4)) 1/2) (* 1/24 (pow x 2)))

prune306.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0.0b

localize30.0ms

Local error

Found 4 expressions with local error:

16.5b
(/ (* (sin x) (sin x)) (* (* x x) (+ 1 (cos x))))
0.3b
(+ 1 (cos x))
0.3b
(* (sin x) (sin x))
0.1b
(* (* x x) (+ 1 (cos x)))

rewrite34.0ms

Algorithm
rewrite-expression-head
Counts
4 → 76
Calls

4 calls. Slowest were:

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

series121.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

68.0ms
(/ (* (sin x) (sin x)) (* (* x x) (+ 1 (cos x))))
26.0ms
(* (* x x) (+ 1 (cos x)))
16.0ms
(* (sin x) (sin x))
12.0ms
(+ 1 (cos x))

simplify4.8s

Counts
51 → 88
Calls

51 calls. Slowest were:

1.0s
(* (* (* (* x x) (* x x)) (* x x)) (* (* (+ 1 (cos x)) (+ 1 (cos x))) (+ 1 (cos x))))
396.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)))))
379.0ms
(- (+ (log (sin x)) (log (sin x))) (log (* (* x x) (+ 1 (cos x)))))

prune833.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 0b

localize14.0ms

Local error

Found 2 expressions with local error:

15.9b
(/ (sin x) (* x x))
0.1b
(* (/ (sin x) (* x x)) (tan (/ x 2)))

rewrite22.0ms

Algorithm
rewrite-expression-head
Counts
2 → 45
Calls

2 calls. Slowest were:

15.0ms
(* (/ (sin x) (* x x)) (tan (/ x 2)))
6.0ms
(/ (sin x) (* x x))

series109.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

72.0ms
(* (/ (sin x) (* x x)) (tan (/ x 2)))
36.0ms
(/ (sin x) (* x x))

simplify1.5s

Counts
34 → 51
Calls

34 calls. Slowest were:

449.0ms
(* (* (* (/ (sin x) (* x x)) (/ (sin x) (* x x))) (/ (sin x) (* x x))) (* (* (tan (/ x 2)) (tan (/ x 2))) (tan (/ x 2))))
175.0ms
(/ (* (* (sin x) (sin x)) (sin x)) (* (* (* x x) (* x x)) (* x x)))
175.0ms
(/ (* (sin x) (sin (* 1/2 x))) (* (cos (* 1/2 x)) (pow x 2)))

prune564.0ms

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 0b

localize12.0ms

Local error

Found 3 expressions with local error:

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

rewrite16.0ms

Algorithm
rewrite-expression-head
Counts
3 → 49
Calls

3 calls. Slowest were:

9.0ms
(* (/ (/ (sin x) x) x) (tan (/ x 2)))
4.0ms
(/ (/ (sin x) x) x)
2.0ms
(/ (sin x) x)

series140.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

90.0ms
(* (/ (/ (sin x) x) x) (tan (/ x 2)))
26.0ms
(/ (sin x) x)
24.0ms
(/ (/ (sin x) x) x)

simplify984.0ms

Counts
28 → 58
Calls

28 calls. Slowest were:

353.0ms
(* (* (* (/ (/ (sin x) x) x) (/ (/ (sin x) x) x)) (/ (/ (sin x) x) x)) (* (* (tan (/ x 2)) (tan (/ x 2))) (tan (/ x 2))))
167.0ms
(/ (* (sin x) (sin (* 1/2 x))) (* (cos (* 1/2 x)) (pow x 2)))
137.0ms
(/ (* (sin x) (sin (* 1/2 x))) (* (cos (* 1/2 x)) (pow x 2)))

prune515.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0b

regimes39.0ms

Accuracy

0% (0.1b remaining)

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

bsearch1.0ms

end0.0ms

sample4.8s

Algorithm
intervals