Average Error: 0.3 → 0.4
Time: 23.2s
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 + {\left(\tan x \cdot \tan x\right)}^{3}} \cdot (\left(\tan x \cdot \tan x\right) \cdot \left((\left(\tan x\right) \cdot \left(\tan x\right) + -1)_*\right) + 1)_*\]

Error

Bits error versus x

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}{(\left(\tan x\right) \cdot \left(\tan x\right) + 1)_*}\]
  3. Using strategy rm
  4. Applied fma-udef0.3

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

    \[\leadsto \frac{1 - \tan x \cdot \tan x}{\color{blue}{\frac{{\left(\tan x \cdot \tan x\right)}^{3} + {1}^{3}}{\left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right) + \left(1 \cdot 1 - \left(\tan x \cdot \tan x\right) \cdot 1\right)}}}\]
  7. Applied associate-/r/0.4

    \[\leadsto \color{blue}{\frac{1 - \tan x \cdot \tan x}{{\left(\tan x \cdot \tan x\right)}^{3} + {1}^{3}} \cdot \left(\left(\tan x \cdot \tan x\right) \cdot \left(\tan x \cdot \tan x\right) + \left(1 \cdot 1 - \left(\tan x \cdot \tan x\right) \cdot 1\right)\right)}\]
  8. Simplified0.4

    \[\leadsto \frac{1 - \tan x \cdot \tan x}{{\left(\tan x \cdot \tan x\right)}^{3} + {1}^{3}} \cdot \color{blue}{(\left(\tan x \cdot \tan x\right) \cdot \left((\left(\tan x\right) \cdot \left(\tan x\right) + -1)_*\right) + 1)_*}\]
  9. Final simplification0.4

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

Reproduce

herbie shell --seed 2018360 +o rules:numerics
(FPCore (x)
  :name "Trigonometry B"
  (/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x)))))

Details

Time bar (total: 12.5s)Debug log

start389.0ms

Algorithm
intervals

setup724.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.3b

localize44.0ms

Local error

Found 4 expressions with local error:

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

rewrite29.0ms

Algorithm
rewrite-expression-head
Counts
4 → 80
Calls

4 calls. Slowest were:

12.0ms
(* (tan x) (tan x))
10.0ms
(/ (- 1 (* (tan x) (tan x))) (fma (tan x) (tan x) 1))
3.0ms
(- 1 (* (tan x) (tan x)))

series312.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

127.0ms
(/ (- 1 (* (tan x) (tan x))) (fma (tan x) (tan x) 1))
67.0ms
(* (tan x) (tan x))
61.0ms
(- 1 (* (tan x) (tan x)))
57.0ms
(fma (tan x) (tan x) 1)

simplify1.5s

Counts
55 → 92
Calls

55 calls. Slowest were:

241.0ms
(/ (* (* (- 1 (* (tan x) (tan x))) (- 1 (* (tan x) (tan x)))) (- 1 (* (tan x) (tan x)))) (* (* (fma (tan x) (tan x) 1) (fma (tan x) (tan x) 1)) (fma (tan x) (tan x) 1)))
228.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))
194.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))

prune972.0ms

Pruning

12 alts after pruning (12 fresh and 0 done)

Merged error: 0.1b

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

rewrite38.0ms

Algorithm
rewrite-expression-head
Counts
4 → 97
Calls

4 calls. Slowest were:

16.0ms
(/ (- 1 (* (tan x) (tan x))) (+ (* (tan x) (tan x)) 1))
10.0ms
(* (tan x) (tan x))
8.0ms
(* (tan x) (tan x))

series188.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

81.0ms
(/ (- 1 (* (tan x) (tan x))) (+ (* (tan x) (tan x)) 1))
39.0ms
(- 1 (* (tan x) (tan x)))
38.0ms
(* (tan x) (tan x))
30.0ms
(* (tan x) (tan x))

simplify2.0s

Counts
72 → 109
Calls

72 calls. Slowest were:

523.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)))
208.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))
171.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))

prune1.2s

Pruning

12 alts after pruning (12 fresh and 0 done)

Merged error: 0.1b

localize8.0ms

Local error

Found 4 expressions with local error:

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

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
4 → 74
Calls

4 calls. Slowest were:

6.0ms
(* (tan x) (tan x))
4.0ms
(* (tan x) (tan x))
1.0ms
(- 1 (* (tan x) (tan x)))

series296.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

192.0ms
(log1p (/ (- 1 (* (tan x) (tan x))) (+ (* (tan x) (tan x)) 1)))
42.0ms
(* (tan x) (tan x))
35.0ms
(- 1 (* (tan x) (tan x)))
27.0ms
(* (tan x) (tan x))

simplify831.0ms

Counts
43 → 86
Calls

43 calls. Slowest were:

186.0ms
(log (- (+ (/ 1 (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1)) 1) (/ (pow (sin x) 2) (* (pow (cos x) 2) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1)))))
181.0ms
(log (- (+ (/ 1 (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1)) 1) (/ (pow (sin x) 2) (* (pow (cos x) 2) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1)))))
98.0ms
(- 1 (+ (pow x 2) (* 2/3 (pow x 4))))

prune1.2s

Pruning

12 alts after pruning (12 fresh and 0 done)

Merged error: 0.1b

localize23.0ms

Local error

Found 4 expressions with local error:

0.4b
(pow (* (tan x) (tan x)) 3)
0.3b
(fma (tan x) (tan x) -1)
0.2b
(* (tan x) (tan x))
0.2b
(* (tan x) (tan x))

rewrite16.0ms

Algorithm
rewrite-expression-head
Counts
4 → 86
Calls

4 calls. Slowest were:

8.0ms
(* (tan x) (tan x))
4.0ms
(* (tan x) (tan x))
3.0ms
(pow (* (tan x) (tan x)) 3)

series164.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

53.0ms
(fma (tan x) (tan x) -1)
48.0ms
(pow (* (tan x) (tan x)) 3)
36.0ms
(* (tan x) (tan x))
27.0ms
(* (tan x) (tan x))

simplify568.0ms

Counts
56 → 98
Calls

56 calls. Slowest were:

56.0ms
(- (/ (pow (sin x) 2) (pow (cos x) 2)) 1)
54.0ms
(pow (* (sin x) (tan x)) 3)
51.0ms
(- (+ (pow x 2) (* 2/3 (pow x 4))) 1)

prune1.6s

Pruning

13 alts after pruning (12 fresh and 1 done)

Merged error: 0.0b

regimes376.0ms

Accuracy

0% (0.3b remaining)

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

bsearch2.0ms