Average Error: 0.3 → 0.4
Time: 22.4s
Precision: 64
Internal Precision: 128
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1}{\tan x \cdot \tan x + 1} - \frac{\tan x \cdot \tan x}{\tan x \cdot \tan x + 1}\]

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. Final simplification0.4

    \[\leadsto \frac{1}{\tan x \cdot \tan x + 1} - \frac{\tan x \cdot \tan x}{\tan x \cdot \tan x + 1}\]

Reproduce

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

Details

Time bar (total: 12.4s)Debug log

start616.0ms

Algorithm
intervals

setup149.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.3b

localize18.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.2b
(- 1 (* (tan x) (tan x)))

rewrite18.0ms

Algorithm
rewrite-expression-head
Counts
4 → 89
Calls

4 calls. Slowest were:

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

series186.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

62.0ms
(/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x))))
57.0ms
(* (tan x) (tan x))
40.0ms
(* (tan x) (tan x))
26.0ms
(- 1 (* (tan x) (tan x)))

simplify2.3s

Counts
72 → 101
Calls

72 calls. Slowest were:

439.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)))))
375.0ms
(/ (pow (sin x) 2) (pow (cos x) 2))
279.0ms
(/ (- 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.1b

localize12.0ms

Local error

Found 4 expressions with local error:

1.6b
(log (exp (* (tan x) (tan x))))
0.5b
(exp (* (tan x) (tan x)))
0.3b
(* (tan x) (tan x))
0.3b
(* (tan x) (tan x))

rewrite26.0ms

Algorithm
rewrite-expression-head
Counts
4 → 70
Calls

4 calls. Slowest were:

11.0ms
(* (tan x) (tan x))
7.0ms
(* (tan x) (tan x))
4.0ms
(exp (* (tan x) (tan x)))

series177.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

93.0ms
(exp (* (tan x) (tan x)))
32.0ms
(log (exp (* (tan x) (tan x))))
26.0ms
(* (tan x) (tan x))
26.0ms
(* (tan x) (tan x))

simplify257.0ms

Counts
51 → 82
Calls

51 calls. Slowest were:

28.0ms
(exp (/ (pow (sin x) 2) (pow (cos x) 2)))
26.0ms
(exp (/ (pow (sin x) 2) (pow (cos x) 2)))
22.0ms
(+ (pow x 2) (+ (* 7/6 (pow x 4)) 1))

prune1.1s

Pruning

11 alts after pruning (11 fresh and 0 done)

Merged error: 0.1b

localize14.0ms

Local error

Found 4 expressions with local error:

0.3b
(* (* (tan x) (tan x)) (* (tan x) (tan x)))
0.3b
(* (tan x) (tan x))
0.3b
(* (tan x) (tan x))
0.3b
(* (tan x) (tan x))

rewrite63.0ms

Algorithm
rewrite-expression-head
Counts
4 → 127
Calls

4 calls. Slowest were:

32.0ms
(* (* (tan x) (tan x)) (* (tan x) (tan x)))
11.0ms
(* (tan x) (tan x))
8.0ms
(* (tan x) (tan x))

series164.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

56.0ms
(* (* (tan x) (tan x)) (* (tan x) (tan x)))
43.0ms
(* (tan x) (tan x))
34.0ms
(* (tan x) (tan x))
31.0ms
(* (tan x) (tan x))

simplify1.0s

Counts
132 → 139
Calls

132 calls. Slowest were:

120.0ms
(* (* (* (* (tan x) (tan x)) (tan x)) (* (* (tan x) (tan x)) (tan x))) (* (* (* (tan x) (tan x)) (* (tan x) (tan x))) (* (tan x) (tan x))))
111.0ms
(* (* (* (* (tan x) (tan x)) (* (tan x) (tan x))) (* (tan x) (tan x))) (* (* (* (tan x) (tan x)) (* (tan x) (tan x))) (* (tan x) (tan x))))
108.0ms
(* (* (* (* (tan x) (tan x)) (tan x)) (* (* (tan x) (tan x)) (tan x))) (* (* (* (tan x) (tan x)) (tan x)) (* (* (tan x) (tan x)) (tan x))))

prune1.6s

Pruning

11 alts after pruning (11 fresh and 0 done)

Merged error: 0.0b

localize8.0ms

Local error

Found 4 expressions with local error:

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

rewrite32.0ms

Algorithm
rewrite-expression-head
Counts
4 → 91
Calls

4 calls. Slowest were:

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

series239.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

126.0ms
(- (/ 1 (+ 1 (* (tan x) (tan x)))) (/ (* (tan x) (tan x)) (+ 1 (* (tan x) (tan x)))))
44.0ms
(* (tan x) (tan x))
40.0ms
(* (tan x) (tan x))
28.0ms
(* (tan x) (tan x))

simplify1.7s

Counts
76 → 103
Calls

76 calls. Slowest were:

452.0ms
(- (* 1 (+ 1 (* (tan x) (tan x)))) (* (+ 1 (* (tan x) (tan x))) (* (tan x) (tan x))))
201.0ms
(+ (* 1 1) (- (* (* (tan x) (tan x)) (* (tan x) (tan x))) (* 1 (* (tan x) (tan x)))))
167.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

13 alts after pruning (12 fresh and 1 done)

Merged error: 0.0b

regimes256.0ms

Accuracy

0% (0.3b remaining)

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

bsearch2.0ms