Average Error: 27.8 → 2.5
Time: 27.4s
Precision: 64
Internal Precision: 128
\[\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}\]
\[\left(\frac{\frac{1}{x}}{cos} \cdot \frac{\cos \left(2 \cdot x\right)}{sin}\right) \cdot \frac{1}{\left(cos \cdot x\right) \cdot sin}\]

Error

Bits error versus x

Bits error versus cos

Bits error versus sin

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 27.8

    \[\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}\]
  2. Initial simplification2.6

    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(\left(x \cdot cos\right) \cdot sin\right) \cdot \left(\left(x \cdot cos\right) \cdot sin\right)}\]
  3. Using strategy rm
  4. Applied associate-/r*2.3

    \[\leadsto \color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot cos\right) \cdot sin}}{\left(x \cdot cos\right) \cdot sin}}\]
  5. Using strategy rm
  6. Applied *-un-lft-identity2.3

    \[\leadsto \frac{\frac{\color{blue}{1 \cdot \cos \left(2 \cdot x\right)}}{\left(x \cdot cos\right) \cdot sin}}{\left(x \cdot cos\right) \cdot sin}\]
  7. Applied times-frac2.5

    \[\leadsto \frac{\color{blue}{\frac{1}{x \cdot cos} \cdot \frac{\cos \left(2 \cdot x\right)}{sin}}}{\left(x \cdot cos\right) \cdot sin}\]
  8. Using strategy rm
  9. Applied div-inv2.5

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

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

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

Reproduce

herbie shell --seed 2018362 +o rules:numerics
(FPCore (x cos sin)
  :name "cos(2*x)/(cos^2(x)*sin^2(x))"
  (/ (cos (* 2 x)) (* (pow cos 2) (* (* x (pow sin 2)) x))))

Details

Time bar (total: 19.3s)Debug log

start246.0ms

Algorithm
intervals

setup282.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 2.4b

localize37.0ms

Local error

Found 4 expressions with local error:

4.4b
(* (* x cos) sin)
4.4b
(* (* x cos) sin)
0.4b
(/ (cos (* 2 x)) (* (* (* x cos) sin) (* (* x cos) sin)))
0.3b
(* (* (* x cos) sin) (* (* x cos) sin))

rewrite52.0ms

Algorithm
rewrite-expression-head
Counts
4 → 64
Calls

4 calls. Slowest were:

23.0ms
(/ (cos (* 2 x)) (* (* (* x cos) sin) (* (* x cos) sin)))
19.0ms
(* (* (* x cos) sin) (* (* x cos) sin))
4.0ms
(* (* x cos) sin)

series525.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

392.0ms
(* (* (* x cos) sin) (* (* x cos) sin))
88.0ms
(/ (cos (* 2 x)) (* (* (* x cos) sin) (* (* x cos) sin)))
28.0ms
(* (* x cos) sin)
17.0ms
(* (* x cos) sin)

simplify3.3s

Counts
33 → 76
Calls

33 calls. Slowest were:

492.0ms
(* (* (* (* (* x cos) sin) (* (* x cos) sin)) (* (* x cos) sin)) (* (* (* (* x cos) sin) (* (* x cos) sin)) (* (* x cos) sin)))
340.0ms
(/ (* (cos x) (cos x)) (* (* (* x cos) sin) (* (* x cos) sin)))
313.0ms
(- (log (cos (* 2 x))) (log (* (* (* x cos) sin) (* (* x cos) sin))))

prune822.0ms

Pruning

15 alts after pruning (15 fresh and 0 done)

Merged error: 1.4b

localize5.0ms

Local error

Found 4 expressions with local error:

4.4b
(* (* x cos) sin)
4.4b
(* (* x cos) sin)
0.3b
(/ (cos (* 2 x)) (* (* x cos) sin))
0.2b
(/ (/ (cos (* 2 x)) (* (* x cos) sin)) (* (* x cos) sin))

rewrite22.0ms

Algorithm
rewrite-expression-head
Counts
4 → 77
Calls

4 calls. Slowest were:

10.0ms
(/ (/ (cos (* 2 x)) (* (* x cos) sin)) (* (* x cos) sin))
7.0ms
(/ (cos (* 2 x)) (* (* x cos) sin))
2.0ms
(* (* x cos) sin)

series149.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

56.0ms
(/ (cos (* 2 x)) (* (* x cos) sin))
52.0ms
(/ (/ (cos (* 2 x)) (* (* x cos) sin)) (* (* x cos) sin))
24.0ms
(* (* x cos) sin)
17.0ms
(* (* x cos) sin)

simplify4.3s

Counts
49 → 89
Calls

49 calls. Slowest were:

638.0ms
(/ (/ (* (cos x) (cos x)) (* (* x cos) sin)) (* (* x cos) sin))
633.0ms
(- (- (log (cos (* 2 x))) (log (* (* x cos) sin))) (log (* (* x cos) sin)))
566.0ms
(- (log (/ (cos (* 2 x)) (* (* x cos) sin))) (log (* (* x cos) sin)))

prune952.0ms

Pruning

12 alts after pruning (12 fresh and 0 done)

Merged error: 1.4b

localize11.0ms

Local error

Found 4 expressions with local error:

4.4b
(* (* x cos) sin)
4.2b
(* (/ 1 (* x cos)) (/ (cos (* 2 x)) sin))
0.4b
(/ 1 (* x cos))
0.2b
(/ (* (/ 1 (* x cos)) (/ (cos (* 2 x)) sin)) (* (* x cos) sin))

rewrite26.0ms

Algorithm
rewrite-expression-head
Counts
4 → 75
Calls

4 calls. Slowest were:

17.0ms
(/ (* (/ 1 (* x cos)) (/ (cos (* 2 x)) sin)) (* (* x cos) sin))
5.0ms
(* (/ 1 (* x cos)) (/ (cos (* 2 x)) sin))
2.0ms
(* (* x cos) sin)

series141.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

66.0ms
(/ (* (/ 1 (* x cos)) (/ (cos (* 2 x)) sin)) (* (* x cos) sin))
35.0ms
(* (/ 1 (* x cos)) (/ (cos (* 2 x)) sin))
29.0ms
(* (* x cos) sin)
11.0ms
(/ 1 (* x cos))

simplify4.6s

Counts
37 → 87
Calls

37 calls. Slowest were:

860.0ms
(/ (* (* (* (/ 1 (* x cos)) (/ 1 (* x cos))) (/ 1 (* x cos))) (* (* (/ (cos (* 2 x)) sin) (/ (cos (* 2 x)) sin)) (/ (cos (* 2 x)) sin))) (* (* (* (* x cos) sin) (* (* x cos) sin)) (* (* x cos) sin)))
784.0ms
(/ (* (* (* (/ 1 (* x cos)) (/ (cos (* 2 x)) sin)) (* (/ 1 (* x cos)) (/ (cos (* 2 x)) sin))) (* (/ 1 (* x cos)) (/ (cos (* 2 x)) sin))) (* (* (* (* x cos) sin) (* (* x cos) sin)) (* (* x cos) sin)))
495.0ms
(+ (log (/ 1 (* x cos))) (log (/ (cos (* 2 x)) sin)))

prune1.1s

Pruning

12 alts after pruning (12 fresh and 0 done)

Merged error: 1.2b

localize10.0ms

Local error

Found 4 expressions with local error:

4.4b
(* (* x cos) sin)
4.2b
(* (/ 1 (* x cos)) (/ (cos (* 2 x)) sin))
0.4b
(/ 1 (* x cos))
0.3b
(/ 1 (* (* x cos) sin))

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
4 → 68
Calls

4 calls. Slowest were:

5.0ms
(* (/ 1 (* x cos)) (/ (cos (* 2 x)) sin))
2.0ms
(/ 1 (* (* x cos) sin))
2.0ms
(* (* x cos) sin)

series75.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

37.0ms
(* (/ 1 (* x cos)) (/ (cos (* 2 x)) sin))
18.0ms
(* (* x cos) sin)
12.0ms
(/ 1 (* (* x cos) sin))
8.0ms
(/ 1 (* x cos))

simplify1.3s

Counts
27 → 80
Calls

27 calls. Slowest were:

483.0ms
(+ (log (/ 1 (* x cos))) (log (/ (cos (* 2 x)) sin)))
258.0ms
(* (/ 1 (* x cos)) (/ (cos (* 2 x)) sin))
158.0ms
(+ (- (log (* x cos))) (log (/ (cos (* 2 x)) sin)))

prune955.0ms

Pruning

12 alts after pruning (12 fresh and 0 done)

Merged error: 1.2b

regimes329.0ms

Accuracy

0% (1.2b remaining)

Error of 2.5b against oracle of 1.2b and baseline of 2.5b

bsearch3.0ms