Average Error: 0.3 → 0.4
Time: 21.7s
Precision: 64
Internal Precision: 128
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{\left(\tan x \cdot \tan x + 1\right) - \left(\tan x \cdot \tan x\right) \cdot \left(1 + \frac{\sin x \cdot \sin x}{\cos x \cdot \cos x}\right)}{\left(1 + \frac{\sin x \cdot \sin x}{\cos x \cdot \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. Initial simplification0.3

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

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

    \[\leadsto \frac{1}{\tan x \cdot \color{blue}{\frac{\sin x}{\cos x}} + 1} - \frac{\tan x \cdot \tan x}{\tan x \cdot \tan x + 1}\]
  7. Applied tan-quot0.4

    \[\leadsto \frac{1}{\color{blue}{\frac{\sin x}{\cos x}} \cdot \frac{\sin x}{\cos x} + 1} - \frac{\tan x \cdot \tan x}{\tan x \cdot \tan x + 1}\]
  8. Applied frac-times0.4

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

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

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

Reproduce

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

Details

Time bar (total: 11.7s)Debug log

start482.0ms

Algorithm
intervals

setup58.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.3b

localize55.0ms

Local error

Found 4 expressions with local error:

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

rewrite25.0ms

Algorithm
rewrite-expression-head
Counts
4 → 89
Calls

4 calls. Slowest were:

10.0ms
(* (tan x) (tan x))
7.0ms
(/ (- 1 (* (tan x) (tan x))) (+ (* (tan x) (tan x)) 1))
4.0ms
(* (tan x) (tan x))

series222.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

101.0ms
(/ (- 1 (* (tan x) (tan x))) (+ (* (tan x) (tan x)) 1))
59.0ms
(* (tan x) (tan x))
37.0ms
(* (tan x) (tan x))
24.0ms
(- 1 (* (tan x) (tan x)))

simplify1.9s

Counts
72 → 101
Calls

72 calls. Slowest were:

495.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))
302.0ms
(/ (* (* (- 1 (* (tan x) (tan x))) (- 1 (* (tan x) (tan x)))) (- 1 (* (tan x) (tan x)))) (* (* (+ (* (tan x) (tan x)) 1) (+ (* (tan x) (tan x)) 1)) (+ (* (tan x) (tan x)) 1)))
194.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))

prune984.0ms

Pruning

12 alts after pruning (12 fresh and 0 done)

Merged error: 0.0b

localize22.0ms

Local error

Found 4 expressions with local error:

0.2b
(pow (cos x) 2)
0.2b
(pow (cos x) 2)
0.2b
(pow (sin x) 2)
0.2b
(pow (sin x) 2)

rewrite4.0ms

Algorithm
rewrite-expression-head
Counts
4 → 56
Calls

4 calls. Slowest were:

1.0ms
(pow (cos x) 2)
1.0ms
(pow (sin x) 2)
1.0ms
(pow (cos x) 2)

series68.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

25.0ms
(pow (sin x) 2)
16.0ms
(pow (sin x) 2)
15.0ms
(pow (cos x) 2)
12.0ms
(pow (cos x) 2)

simplify250.0ms

Counts
32 → 68
Calls

32 calls. Slowest were:

46.0ms
(- (+ (* 1/3 (pow x 4)) 1) (pow x 2))
46.0ms
(- (+ (pow x 2) (* 2/45 (pow x 6))) (* 1/3 (pow x 4)))
44.0ms
(- (+ (pow x 2) (* 2/45 (pow x 6))) (* 1/3 (pow x 4)))

prune1.2s

Pruning

11 alts after pruning (11 fresh and 0 done)

Merged error: 0.0b

localize20.0ms

Local error

Found 4 expressions with local error:

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

rewrite59.0ms

Algorithm
rewrite-expression-head
Counts
4 → 91
Calls

4 calls. Slowest were:

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

series248.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

139.0ms
(- (/ 1 (+ (* (tan x) (tan x)) 1)) (/ (* (tan x) (tan x)) (+ (* (tan x) (tan x)) 1)))
44.0ms
(* (tan x) (tan x))
39.0ms
(* (tan x) (tan x))
26.0ms
(* (tan x) (tan x))

simplify1.9s

Counts
76 → 103
Calls

76 calls. Slowest were:

320.0ms
(- (/ 1 (- (* (* (tan x) (tan x)) (* (tan x) (tan x))) (* 1 1))) (/ (* (tan x) (tan x)) (- (* (* (tan x) (tan x)) (* (tan x) (tan x))) (* 1 1))))
297.0ms
(- (* 1 (+ (* (tan x) (tan x)) 1)) (* (+ (* (tan x) (tan x)) 1) (* (tan x) (tan x))))
271.0ms
(+ (* (* (tan x) (tan x)) (* (tan x) (tan x))) (- (* 1 1) (* (* (tan x) (tan x)) 1)))

prune1.1s

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 0.0b

localize15.0ms

Local error

Found 4 expressions with local error:

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

rewrite36.0ms

Algorithm
rewrite-expression-head
Counts
4 → 85
Calls

4 calls. Slowest were:

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

series186.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

119.0ms
(- (/ 1 (+ (/ (* (sin x) (sin x)) (* (cos x) (cos x))) 1)) (/ (* (tan x) (tan x)) (+ (* (tan x) (tan x)) 1)))
29.0ms
(* (tan x) (tan x))
26.0ms
(* (tan x) (tan x))
12.0ms
(* (cos x) (cos x))

simplify1.2s

Counts
64 → 97
Calls

64 calls. Slowest were:

179.0ms
(* (+ (/ (* (sin x) (sin x)) (* (cos x) (cos x))) 1) (+ (* (tan x) (tan x)) 1))
163.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))))
140.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.3s

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 0.0b

regimes321.0ms

Accuracy

0% (0.3b remaining)

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

bsearch5.0ms