Average Error: 30.8 → 0.1
Time: 19.4s
Precision: 64
Internal Precision: 128
\[\frac{1 - \cos x}{x \cdot x}\]
\[\frac{\frac{1}{\frac{x}{\sin x}}}{\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. Applied associate-/r*0.3

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

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

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

Reproduce

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

Details

Time bar (total: 18.9s)Debug log

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

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
2 → 37
Calls

2 calls. Slowest were:

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

series101.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

69.0ms
(/ (- 1 (cos x)) (* x x))
32.0ms
(- 1 (cos x))

simplify815.0ms

Counts
19 → 43
Calls

19 calls. Slowest were:

431.0ms
(/ (* (* (- 1 (cos x)) (- 1 (cos x))) (- 1 (cos x))) (* (* (* x x) (* x x)) (* x x)))
91.0ms
(- (+ (* 1/720 (pow x 4)) 1/2) (* 1/24 (pow x 2)))
85.0ms
(- (+ (* 1/2 (pow x 2)) (* 1/720 (pow x 6))) (* 1/24 (pow x 4)))

prune356.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0.0b

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

rewrite28.0ms

Algorithm
rewrite-expression-head
Counts
4 → 84
Calls

4 calls. Slowest were:

17.0ms
(/ (* (sin x) (sin x)) (* (* x x) (+ 1 (cos x))))
5.0ms
(* (sin x) (sin x))
4.0ms
(* (* x x) (+ 1 (cos x)))

series112.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

54.0ms
(/ (* (sin x) (sin x)) (* (* x x) (+ 1 (cos x))))
34.0ms
(* (* x x) (+ 1 (cos x)))
15.0ms
(* (sin x) (sin x))
9.0ms
(+ 1 (cos x))

simplify4.7s

Counts
51 → 96
Calls

51 calls. Slowest were:

797.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)))))
483.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)))))
366.0ms
(- (+ (log (sin x)) (log (sin x))) (+ (log (* x x)) (log (+ 1 (cos x)))))

prune919.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 0b

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

rewrite25.0ms

Algorithm
rewrite-expression-head
Counts
4 → 76
Calls

4 calls. Slowest were:

13.0ms
(/ (* (sin x) (sin x)) (* x (* x (+ 1 (cos x)))))
7.0ms
(* (sin x) (sin x))
2.0ms
(* x (+ 1 (cos x)))

series115.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

55.0ms
(/ (* (sin x) (sin x)) (* x (* x (+ 1 (cos x)))))
36.0ms
(* x (+ 1 (cos x)))
16.0ms
(* (sin x) (sin x))
9.0ms
(+ 1 (cos x))

simplify2.5s

Counts
44 → 88
Calls

44 calls. Slowest were:

369.0ms
(- (+ (log (sin x)) (log (sin x))) (log (* x (* x (+ 1 (cos x))))))
349.0ms
(- (log (* (sin x) (sin x))) (log (* x (* x (+ 1 (cos x))))))
282.0ms
(/ (pow (sin x) 2) (* (pow x 2) (+ (cos x) 1)))

prune771.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 0b

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

rewrite17.0ms

Algorithm
rewrite-expression-head
Counts
4 → 82
Calls

4 calls. Slowest were:

6.0ms
(/ (* x (* x (+ 1 (cos x)))) (* (sin x) (sin x)))
5.0ms
(/ 1 (/ (* x (* x (+ 1 (cos x)))) (* (sin x) (sin x))))
4.0ms
(* (sin x) (sin x))

series125.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

47.0ms
(/ (* x (* x (+ 1 (cos x)))) (* (sin x) (sin x)))
44.0ms
(/ 1 (/ (* x (* x (+ 1 (cos x)))) (* (sin x) (sin x))))
23.0ms
(* (sin x) (sin x))
11.0ms
(+ 1 (cos x))

simplify3.9s

Counts
41 → 94
Calls

41 calls. Slowest were:

519.0ms
(/ (* (pow x 2) (+ (cos x) 1)) (pow (sin x) 2))
496.0ms
(* x (* x (+ (pow 1 3) (pow (cos x) 3))))
442.0ms
(/ (* (pow x 2) (+ (cos x) 1)) (pow (sin x) 2))

prune612.0ms

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 0b

regimes61.0ms

Accuracy

0% (0.1b remaining)

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

bsearch2.0ms

end0.0ms

sample3.5s

Algorithm
intervals