Average Error: 0.3 → 1.0
Time: 1.1m
Precision: 64
Internal Precision: 128
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1}{(\left(\tan x\right) \cdot \left(\tan x\right) + 1)_*} - \frac{\log \left(e^{\tan x \cdot \tan x}\right)}{(\left(\tan x\right) \cdot \left(\tan x\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 add-log-exp0.9

    \[\leadsto \frac{1 - \color{blue}{\log \left(e^{\tan x \cdot \tan x}\right)}}{(\left(\tan x\right) \cdot \left(\tan x\right) + 1)_*}\]
  5. Using strategy rm
  6. Applied div-sub1.0

    \[\leadsto \color{blue}{\frac{1}{(\left(\tan x\right) \cdot \left(\tan x\right) + 1)_*} - \frac{\log \left(e^{\tan x \cdot \tan x}\right)}{(\left(\tan x\right) \cdot \left(\tan x\right) + 1)_*}}\]
  7. Final simplification1.0

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

Reproduce

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

Details

Time bar (total: 54.1s)Debug log

start556.0ms

Algorithm
intervals

setup72.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.3b

localize19.0ms

Local error

Found 4 expressions with local error:

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

rewrite15.0ms

Algorithm
rewrite-expression-head
Counts
4 → 80
Calls

4 calls. Slowest were:

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

series198.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

80.0ms
(/ (- 1 (* (tan x) (tan x))) (fma (tan x) (tan x) 1))
49.0ms
(* (tan x) (tan x))
40.0ms
(fma (tan x) (tan x) 1)
28.0ms
(- 1 (* (tan x) (tan x)))

simplify1.5s

Counts
55 → 92
Calls

55 calls. Slowest were:

255.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))
235.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)))
195.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.2b
(/ (- 1 (log (exp (* (tan x) (tan x))))) (fma (tan x) (tan x) 1))

rewrite32.0ms

Algorithm
rewrite-expression-head
Counts
4 → 85
Calls

4 calls. Slowest were:

12.0ms
(/ (- 1 (log (exp (* (tan x) (tan x))))) (fma (tan x) (tan x) 1))
11.0ms
(* (tan x) (tan x))
6.0ms
(exp (* (tan x) (tan x)))

series240.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

114.0ms
(/ (- 1 (log (exp (* (tan x) (tan x))))) (fma (tan x) (tan x) 1))
70.0ms
(exp (* (tan x) (tan x)))
30.0ms
(* (tan x) (tan x))
26.0ms
(log (exp (* (tan x) (tan x))))

simplify1.9s

Counts
64 → 97
Calls

64 calls. Slowest were:

207.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))
200.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))
197.0ms
(- (pow 1 3) (pow (log (exp (* (tan x) (tan x)))) 3))

prune1.3s

Pruning

12 alts after pruning (12 fresh and 0 done)

Merged error: 0.0b

localize22.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.5b
(pow (tan x) 4)
0.3b
(* (fma (tan x) (tan x) 1) (+ 1 (log (exp (* (tan x) (tan x))))))

rewrite13.0ms

Algorithm
rewrite-expression-head
Counts
4 → 66
Calls

4 calls. Slowest were:

5.0ms
(* (fma (tan x) (tan x) 1) (+ 1 (log (exp (* (tan x) (tan x))))))
4.0ms
(exp (* (tan x) (tan x)))
3.0ms
(log (exp (* (tan x) (tan x))))

series277.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

99.0ms
(* (fma (tan x) (tan x) 1) (+ 1 (log (exp (* (tan x) (tan x))))))
89.0ms
(exp (* (tan x) (tan x)))
55.0ms
(pow (tan x) 4)
33.0ms
(log (exp (* (tan x) (tan x))))

simplify1.7s

Counts
38 → 78
Calls

38 calls. Slowest were:

380.0ms
(* (* (* (fma (tan x) (tan x) 1) (fma (tan x) (tan x) 1)) (fma (tan x) (tan x) 1)) (* (* (+ 1 (log (exp (* (tan x) (tan x))))) (+ 1 (log (exp (* (tan x) (tan x)))))) (+ 1 (log (exp (* (tan x) (tan x)))))))
356.0ms
(+ (* 1 1) (- (* (log (exp (* (tan x) (tan x)))) (log (exp (* (tan x) (tan x))))) (* 1 (log (exp (* (tan x) (tan x)))))))
236.0ms
(pow (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1) 2)

prune1.4s

Pruning

11 alts after pruning (11 fresh and 0 done)

Merged error: 0.0b

localize18.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.4b
(- (/ 1 (fma (tan x) (tan x) 1)) (/ (log (exp (* (tan x) (tan x)))) (fma (tan x) (tan x) 1)))
0.3b
(* (tan x) (tan x))

rewrite36.0ms

Algorithm
rewrite-expression-head
Counts
4 → 167
Calls

4 calls. Slowest were:

14.0ms
(- (/ 1 (fma (tan x) (tan x) 1)) (/ (log (exp (* (tan x) (tan x)))) (fma (tan x) (tan x) 1)))
7.0ms
(exp (* (tan x) (tan x)))
6.0ms
(log (exp (* (tan x) (tan x))))

series331.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

166.0ms
(- (/ 1 (fma (tan x) (tan x) 1)) (/ (log (exp (* (tan x) (tan x)))) (fma (tan x) (tan x) 1)))
93.0ms
(exp (* (tan x) (tan x)))
37.0ms
(log (exp (* (tan x) (tan x))))
35.0ms
(* (tan x) (tan x))

simplify41.0s

Counts
229 → 179
Calls

229 calls. Slowest were:

661.0ms
(fma (- (/ (log (exp (* (tan x) (tan x)))) (fma (tan x) (tan x) 1))) (/ 1 1) (* (/ (log (exp (* (tan x) (tan x)))) (fma (tan x) (tan x) 1)) (/ 1 1)))
647.0ms
(- (* 1 (fma (tan x) (tan x) 1)) (* (fma (tan x) (tan x) 1) (log (exp (* (tan x) (tan x))))))
600.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))))

prune2.2s

Pruning

11 alts after pruning (10 fresh and 1 done)

Merged error: 0.0b

regimes214.0ms

Accuracy

0% (0.9b remaining)

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

bsearch3.0ms