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

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--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.6

    \[\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 associate-*l*15.7

    \[\leadsto \frac{\sin x \cdot \sin x}{\color{blue}{x \cdot \left(x \cdot \left(1 + \cos x\right)\right)}}\]
  8. Using strategy rm
  9. Applied clear-num15.7

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

    \[\leadsto \frac{1}{\color{blue}{\frac{x}{\sin x} \cdot \frac{x \cdot \left(1 + \cos x\right)}{\sin x}}}\]
  12. Simplified0.5

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

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

Reproduce

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

Details

Time bar (total: 19.6s)Debug log

sample150.0ms

Algorithm
intervals

simplify29.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune8.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 33.1b

localize23.0ms

Local error

Found 2 expressions with local error:

14.7b
(/ (- 1 (cos x)) (* x x))
2.2b
(- 1 (cos x))

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

series83.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

65.0ms
(/ (- 1 (cos x)) (* x x))
18.0ms
(- 1 (cos x))

simplify576.0ms

Counts
19 → 39
Calls

19 calls. Slowest were:

374.0ms
(/ (* (* (- 1 (cos x)) (- 1 (cos x))) (- 1 (cos x))) (* (* (* x x) (* x x)) (* x x)))
45.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)))

prune303.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0.0b

localize13.0ms

Local error

Found 4 expressions with local error:

14.4b
(/ (* (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)))

rewrite20.0ms

Algorithm
rewrite-expression-head
Counts
4 → 76
Calls

4 calls. Slowest were:

11.0ms
(/ (* (sin x) (sin x)) (* (* x x) (+ 1 (cos x))))
4.0ms
(* (sin x) (sin x))
4.0ms
(* (* x x) (+ 1 (cos x)))

series137.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

61.0ms
(/ (* (sin x) (sin x)) (* (* x x) (+ 1 (cos x))))
37.0ms
(* (* x x) (+ 1 (cos x)))
25.0ms
(* (sin x) (sin x))
13.0ms
(+ 1 (cos x))

simplify5.3s

Counts
51 → 88
Calls

51 calls. Slowest were:

1.2s
(* (* (* (* x x) (* x x)) (* x x)) (* (* (+ 1 (cos x)) (+ 1 (cos x))) (+ 1 (cos x))))
418.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)))))
405.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)))))

prune816.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 0b

localize8.0ms

Local error

Found 4 expressions with local error:

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

rewrite13.0ms

Algorithm
rewrite-expression-head
Counts
4 → 68
Calls

4 calls. Slowest were:

6.0ms
(/ (* (sin x) (sin x)) (* x (* x (+ 1 (cos x)))))
3.0ms
(* (sin x) (sin x))
1.0ms
(* x (+ 1 (cos x)))

series127.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

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

simplify1.9s

Counts
44 → 80
Calls

44 calls. Slowest were:

319.0ms
(- (+ (log (sin x)) (log (sin x))) (log (* x (* x (+ 1 (cos x))))))
308.0ms
(- (log (* (sin x) (sin x))) (log (* x (* x (+ 1 (cos x))))))
275.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))))))

prune697.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 0b

localize10.0ms

Local error

Found 4 expressions with local error:

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

rewrite27.0ms

Algorithm
rewrite-expression-head
Counts
4 → 74
Calls

4 calls. Slowest were:

11.0ms
(/ (* x (* x (+ 1 (cos x)))) (* (sin x) (sin x)))
8.0ms
(* (sin x) (sin x))
5.0ms
(/ 1 (/ (* x (* x (+ 1 (cos x)))) (* (sin x) (sin x))))

series167.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

66.0ms
(/ 1 (/ (* x (* x (+ 1 (cos x)))) (* (sin x) (sin x))))
64.0ms
(/ (* x (* x (+ 1 (cos x)))) (* (sin x) (sin x)))
24.0ms
(* (sin x) (sin x))
13.0ms
(+ 1 (cos x))

simplify3.7s

Counts
41 → 86
Calls

41 calls. Slowest were:

557.0ms
(/ (* (pow x 2) (+ (cos x) 1)) (pow (sin x) 2))
490.0ms
(/ (* (pow x 2) (+ (cos x) 1)) (pow (sin x) 2))
303.0ms
(* x (* x (- (* 1 1) (* (cos x) (cos x)))))

prune704.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0b

regimes44.0ms

Accuracy

0% (0.5b remaining)

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

bsearch1.0ms

end0.0ms

sample4.8s

Algorithm
intervals