Average Error: 0.3 → 0.5
Time: 27.7s
Precision: 64
Internal Precision: 128
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1 - {\left(\tan x\right)}^{3} \cdot \frac{\sin x}{\cos x}}{\left(1 + \frac{\sin x \cdot \tan x}{\cos x}\right) \cdot \left(\tan x \cdot \tan x + 1\right)}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.3

    \[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
  2. Using strategy rm
  3. Applied div-sub0.4

    \[\leadsto \color{blue}{\frac{1}{1 + \tan x \cdot \tan x} - \frac{\tan x \cdot \tan x}{1 + \tan x \cdot \tan x}}\]
  4. Using strategy rm
  5. Applied tan-quot0.4

    \[\leadsto \frac{1}{1 + \tan x \cdot \color{blue}{\frac{\sin x}{\cos x}}} - \frac{\tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
  6. Applied associate-*r/0.4

    \[\leadsto \frac{1}{1 + \color{blue}{\frac{\tan x \cdot \sin x}{\cos x}}} - \frac{\tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
  7. Using strategy rm
  8. Applied frac-sub0.4

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

    \[\leadsto \frac{\color{blue}{1 - \frac{\sin x}{\cos x} \cdot {\left(\tan x\right)}^{3}}}{\left(1 + \frac{\tan x \cdot \sin x}{\cos x}\right) \cdot \left(1 + \tan x \cdot \tan x\right)}\]
  10. Final simplification0.5

    \[\leadsto \frac{1 - {\left(\tan x\right)}^{3} \cdot \frac{\sin x}{\cos x}}{\left(1 + \frac{\sin x \cdot \tan x}{\cos x}\right) \cdot \left(\tan x \cdot \tan x + 1\right)}\]

Reproduce

herbie shell --seed 2019002 
(FPCore (x)
  :name "Trigonometry B"
  (/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x)))))

Details

Time bar (total: 25.8s)Debug log

sample377.0ms

Algorithm
intervals

simplify65.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

64.0ms
(/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x))))

prune10.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.3b

localize32.0ms

Local error

Found 4 expressions with local error:

0.3b
(* (tan x) (tan x))
0.3b
(* (tan x) (tan x))
0.2b
(/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x))))
0.1b
(- 1 (* (tan x) (tan x)))

rewrite69.0ms

Algorithm
rewrite-expression-head
Counts
4 → 89
Calls

4 calls. Slowest were:

11.0ms
(/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x))))
9.0ms
(* (tan x) (tan x))
7.0ms
(* (tan x) (tan x))

series337.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

167.0ms
(* (tan x) (tan x))
75.0ms
(/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x))))
53.0ms
(* (tan x) (tan x))
41.0ms
(- 1 (* (tan x) (tan x)))

simplify2.0s

Counts
72 → 101
Calls

72 calls. Slowest were:

500.0ms
(/ (* (* (- 1 (* (tan x) (tan x))) (- 1 (* (tan x) (tan x)))) (- 1 (* (tan x) (tan x)))) (* (* (+ 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x)))) (+ 1 (* (tan x) (tan x)))))
248.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))
218.0ms
(+ (* 1 1) (- (* (* (tan x) (tan x)) (* (tan x) (tan x))) (* 1 (* (tan x) (tan x)))))

prune931.0ms

Pruning

11 alts after pruning (11 fresh and 0 done)

Merged error: 0.0b

localize19.0ms

Local error

Found 4 expressions with local error:

0.3b
(- (/ 1 (+ 1 (* (tan x) (tan x)))) (/ (* (tan x) (tan x)) (+ 1 (* (tan x) (tan x)))))
0.3b
(* (tan x) (tan x))
0.3b
(* (tan x) (tan x))
0.3b
(* (tan x) (tan x))

rewrite18.0ms

Algorithm
rewrite-expression-head
Counts
4 → 91
Calls

4 calls. Slowest were:

6.0ms
(- (/ 1 (+ 1 (* (tan x) (tan x)))) (/ (* (tan x) (tan x)) (+ 1 (* (tan x) (tan x)))))
4.0ms
(* (tan x) (tan x))
4.0ms
(* (tan x) (tan x))

series202.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

97.0ms
(- (/ 1 (+ 1 (* (tan x) (tan x)))) (/ (* (tan x) (tan x)) (+ 1 (* (tan x) (tan x)))))
41.0ms
(* (tan x) (tan x))
36.0ms
(* (tan x) (tan x))
28.0ms
(* (tan x) (tan x))

simplify1.7s

Counts
76 → 103
Calls

76 calls. Slowest were:

364.0ms
(- (* 1 (+ 1 (* (tan x) (tan x)))) (* (+ 1 (* (tan x) (tan x))) (* (tan x) (tan x))))
251.0ms
(+ (* 1 1) (- (* (* (tan x) (tan x)) (* (tan x) (tan x))) (* 1 (* (tan x) (tan x)))))
155.0ms
(- (/ 1 (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1)) (/ (pow (sin x) 2) (* (pow (cos x) 2) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))))

prune1.1s

Pruning

12 alts after pruning (12 fresh and 0 done)

Merged error: 0.0b

localize42.0ms

Local error

Found 4 expressions with local error:

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

rewrite30.0ms

Algorithm
rewrite-expression-head
Counts
4 → 81
Calls

4 calls. Slowest were:

12.0ms
(- (/ 1 (+ 1 (/ (* (tan x) (sin x)) (cos x)))) (/ (* (tan x) (tan x)) (+ 1 (* (tan x) (tan x)))))
7.0ms
(* (tan x) (tan x))
7.0ms
(* (tan x) (tan x))

series343.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

175.0ms
(- (/ 1 (+ 1 (/ (* (tan x) (sin x)) (cos x)))) (/ (* (tan x) (tan x)) (+ 1 (* (tan x) (tan x)))))
78.0ms
(/ 1 (+ 1 (/ (* (tan x) (sin x)) (cos x))))
45.0ms
(* (tan x) (tan x))
45.0ms
(* (tan x) (tan x))

simplify2.0s

Counts
57 → 93
Calls

57 calls. Slowest were:

570.0ms
(- (* 1 (+ 1 (* (tan x) (tan x)))) (* (+ 1 (/ (* (tan x) (sin x)) (cos x))) (* (tan x) (tan x))))
194.0ms
(+ (* 1 1) (- (* (/ (* (tan x) (sin x)) (cos x)) (/ (* (tan x) (sin x)) (cos x))) (* 1 (/ (* (tan x) (sin x)) (cos x)))))
176.0ms
(* (+ 1 (/ (* (tan x) (sin x)) (cos x))) (+ 1 (* (tan x) (tan x))))

prune1.2s

Pruning

12 alts after pruning (12 fresh and 0 done)

Merged error: 0.0b

localize18.0ms

Local error

Found 4 expressions with local error:

0.3b
(pow (tan x) 3)
0.3b
(* (tan x) (tan x))
0.2b
(* (+ 1 (/ (* (tan x) (sin x)) (cos x))) (+ 1 (* (tan x) (tan x))))
0.2b
(* (/ (sin x) (cos x)) (pow (tan x) 3))

rewrite30.0ms

Algorithm
rewrite-expression-head
Counts
4 → 113
Calls

4 calls. Slowest were:

11.0ms
(* (tan x) (tan x))
9.0ms
(* (+ 1 (/ (* (tan x) (sin x)) (cos x))) (+ 1 (* (tan x) (tan x))))
7.0ms
(* (/ (sin x) (cos x)) (pow (tan x) 3))

series290.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

113.0ms
(* (/ (sin x) (cos x)) (pow (tan x) 3))
109.0ms
(* (+ 1 (/ (* (tan x) (sin x)) (cos x))) (+ 1 (* (tan x) (tan x))))
42.0ms
(pow (tan x) 3)
26.0ms
(* (tan x) (tan x))

simplify6.9s

Counts
94 → 125
Calls

94 calls. Slowest were:

708.0ms
(* (+ (pow 1 3) (pow (/ (* (tan x) (sin x)) (cos x)) 3)) (+ (pow 1 3) (pow (* (tan x) (tan x)) 3)))
580.0ms
(* (+ (pow 1 3) (pow (/ (* (tan x) (sin x)) (cos x)) 3)) (+ 1 (* (tan x) (tan x))))
540.0ms
(* (- 1 (/ (* (tan x) (sin x)) (cos x))) (+ (* 1 1) (- (* (* (tan x) (tan x)) (* (tan x) (tan x))) (* 1 (* (tan x) (tan x))))))

prune2.1s

Pruning

12 alts after pruning (11 fresh and 1 done)

Merged error: 0.0b

regimes360.0ms

Accuracy

0% (0.4b remaining)

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

bsearch2.0ms

end0.0ms

sample5.8s

Algorithm
intervals