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

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 add-log-exp0.4

    \[\leadsto \color{blue}{\log \left(e^{\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}}\right)}\]
  4. Taylor expanded around -inf 0.4

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

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

Reproduce

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

Details

Time bar (total: 36.5s)Debug log

sample272.0ms

Algorithm
intervals

simplify61.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune25.0ms

Pruning

2 alts after pruning (2 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)))

rewrite33.0ms

Algorithm
rewrite-expression-head
Counts
4 → 97
Calls

4 calls. Slowest were:

11.0ms
(* (tan x) (tan x))
8.0ms
(/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x))))
8.0ms
(* (tan x) (tan x))

series183.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

76.0ms
(/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x))))
55.0ms
(* (tan x) (tan x))
27.0ms
(* (tan x) (tan x))
24.0ms
(- 1 (* (tan x) (tan x)))

simplify2.4s

Counts
72 → 109
Calls

72 calls. Slowest were:

553.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)))))
527.0ms
(+ (* 1 1) (- (* (* (tan x) (tan x)) (* (tan x) (tan x))) (* 1 (* (tan x) (tan x)))))
222.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))

prune984.0ms

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 0.0b

localize12.0ms

Local error

Found 4 expressions with local error:

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

rewrite18.0ms

Algorithm
rewrite-expression-head
Counts
4 → 127
Calls

4 calls. Slowest were:

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

series300.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

161.0ms
(- (/ 1 (fma (tan x) (tan x) 1)) (/ (* (tan x) (tan x)) (+ 1 (* (tan x) (tan x)))))
48.0ms
(/ 1 (fma (tan x) (tan x) 1))
46.0ms
(* (tan x) (tan x))
45.0ms
(* (tan x) (tan x))

simplify14.2s

Counts
129 → 139
Calls

129 calls. Slowest were:

921.0ms
(- (* 1 (+ 1 (* (tan x) (tan x)))) (* (fma (tan x) (tan x) 1) (* (tan x) (tan x))))
521.0ms
(fma 1 (/ 1 (fma (tan x) (tan x) 1)) (- (* (+ (* 1 1) (- (* (* (tan x) (tan x)) (* (tan x) (tan x))) (* 1 (* (tan x) (tan x))))) (/ (* (tan x) (tan x)) (+ (pow 1 3) (pow (* (tan x) (tan x)) 3))))))
521.0ms
(fma 1 (/ 1 (fma (tan x) (tan x) 1)) (- (* (+ (* 1 1) (- (* (* (tan x) (tan x)) (* (tan x) (tan x))) (* 1 (* (tan x) (tan x))))) (/ (* (tan x) (tan x)) (+ (pow 1 3) (pow (* (tan x) (tan x)) 3))))))

prune1.4s

Pruning

12 alts after pruning (12 fresh and 0 done)

Merged error: 0.0b

localize11.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 (+ 1 (* (tan x) (tan x)))))
0.1b
(/ 1 (+ 1 (* (tan x) (tan x))))

rewrite29.0ms

Algorithm
rewrite-expression-head
Counts
4 → 99
Calls

4 calls. Slowest were:

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

series213.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

68.0ms
(* (- 1 (* (tan x) (tan x))) (/ 1 (+ 1 (* (tan x) (tan x)))))
58.0ms
(/ 1 (+ 1 (* (tan x) (tan x))))
46.0ms
(* (tan x) (tan x))
40.0ms
(* (tan x) (tan x))

simplify4.0s

Counts
68 → 111
Calls

68 calls. Slowest were:

508.0ms
(+ (* 1 1) (- (* (* (tan x) (tan x)) (* (tan x) (tan x))) (* 1 (* (tan x) (tan x)))))
502.0ms
(* (+ (* 1 1) (+ (* (* (tan x) (tan x)) (* (tan x) (tan x))) (* 1 (* (tan x) (tan x))))) (+ 1 (* (tan x) (tan x))))
413.0ms
(+ (* 1 1) (- (* (* (tan x) (tan x)) (* (tan x) (tan x))) (* 1 (* (tan x) (tan x)))))

prune734.0ms

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 0.0b

localize7.0ms

Local error

Found 4 expressions with local error:

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

rewrite30.0ms

Algorithm
rewrite-expression-head
Counts
4 → 114
Calls

4 calls. Slowest were:

7.0ms
(log (exp (/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x))))))
7.0ms
(* (tan x) (tan x))
7.0ms
(/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x))))

series198.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

86.0ms
(/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x))))
58.0ms
(log (exp (/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x))))))
28.0ms
(* (tan x) (tan x))
27.0ms
(* (tan x) (tan x))

simplify3.7s

Counts
92 → 126
Calls

92 calls. Slowest were:

913.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)))))
451.0ms
(+ (* 1 1) (- (* (* (tan x) (tan x)) (* (tan x) (tan x))) (* 1 (* (tan x) (tan x)))))
390.0ms
(+ (* 1 1) (- (* (* (tan x) (tan x)) (* (tan x) (tan x))) (* 1 (* (tan x) (tan x)))))

prune1.4s

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 0.0b

regimes391.0ms

Accuracy

0% (0.3b remaining)

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

bsearch1.0ms

end0.0ms

sample5.8s

Algorithm
intervals