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

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 flip3--0.4

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

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

Reproduce

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

Details

Time bar (total: 21.1s)Debug log

sample213.0ms

Algorithm
intervals

simplify77.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
76.0ms
(/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x))))

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

rewrite32.0ms

Algorithm
rewrite-expression-head
Rules
16×add-cube-cbrt
16×*-un-lft-identity
16×add-sqr-sqrt
14×pow1
10×add-exp-log
10×add-cbrt-cube
times-frac
tan-quot
associate-*l*
associate-*r*
add-log-exp
log1p-expm1-u
expm1-log1p-u
associate-/l*
associate-/r*
associate-/l/
flip--
cbrt-unprod
pow-prod-up
*-commutative
associate-/r/
associate-*r/
prod-exp
associate-*l/
pow-prod-down
flip3--
pow-plus
frac-times
pow2
div-inv
flip-+
div-exp
div-sub
flip3-+
frac-2neg
sub-neg
clear-num
cbrt-undiv
Counts
4 → 97
Calls
4 calls:
Slowest
11.0ms
(* (tan x) (tan x))
7.0ms
(/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x))))
7.0ms
(* (tan x) (tan x))
2.0ms
(- 1 (* (tan x) (tan x)))

series235.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
117.0ms
(/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x))))
57.0ms
(* (tan x) (tan x))
38.0ms
(* (tan x) (tan x))
24.0ms
(- 1 (* (tan x) (tan x)))

simplify2.3s

Counts
72 → 109
Calls
72 calls:
Slowest
562.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)))))
413.0ms
(+ (* 1 1) (- (* (* (tan x) (tan x)) (* (tan x) (tan x))) (* 1 (* (tan x) (tan x)))))
219.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))
199.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))
88.0ms
(- (+ (* 2/3 (pow x 4)) 1) (* 2 (pow x 2)))

prune977.0ms

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 0.0b

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

rewrite10.0ms

Algorithm
rewrite-expression-head
Rules
12×unpow-prod-down
add-cube-cbrt
add-exp-log
*-un-lft-identity
pow1
add-sqr-sqrt
add-log-exp
unpow2
log1p-expm1-u
pow-exp
add-cbrt-cube
pow-pow
pow-to-exp
expm1-log1p-u
Counts
4 → 64
Calls
4 calls:
Slowest
2.0ms
(pow (cos x) 2)
2.0ms
(pow (sin x) 2)
2.0ms
(pow (sin x) 2)
2.0ms
(pow (cos x) 2)

series69.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
20.0ms
(pow (cos x) 2)
19.0ms
(pow (cos x) 2)
16.0ms
(pow (sin x) 2)
15.0ms
(pow (sin x) 2)

simplify361.0ms

Counts
32 → 76
Calls
32 calls:
Slowest
105.0ms
(- (+ (pow x 2) (* 2/45 (pow x 6))) (* 1/3 (pow x 4)))
76.0ms
(- (+ (pow x 2) (* 2/45 (pow x 6))) (* 1/3 (pow x 4)))
57.0ms
(- (+ (* 1/3 (pow x 4)) 1) (pow x 2))
31.0ms
(- (+ (* 1/3 (pow x 4)) 1) (pow x 2))
12.0ms
(pow (* (cbrt (cos x)) (cbrt (cos x))) 2)

prune934.0ms

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 0.0b

localize59.0ms

Local error

Found 4 expressions with local error:

0.4b
(pow (* (tan x) (tan x)) 3)
0.3b
(* (* (tan x) (tan x)) (* (tan x) (tan x)))
0.2b
(* (tan x) (tan x))
0.2b
(* (tan x) (tan x))

rewrite63.0ms

Algorithm
rewrite-expression-head
Rules
77×pow1
44×tan-quot
26×pow-prod-up
23×add-exp-log
23×add-cbrt-cube
21×pow-prod-down
20×frac-times
15×pow-plus
14×associate-*r/
14×associate-*l/
12×pow2
11×cbrt-unprod
11×prod-exp
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
associate-*l*
associate-*r*
pow-pow
add-log-exp
log1p-expm1-u
expm1-log1p-u
*-commutative
cube-div
rem-cube-cbrt
pow-exp
cube-prod
unpow3
unpow-prod-down
pow-to-exp
cube-mult
Counts
4 → 136
Calls
4 calls:
Slowest
42.0ms
(* (* (tan x) (tan x)) (* (tan x) (tan x)))
7.0ms
(pow (* (tan x) (tan x)) 3)
7.0ms
(* (tan x) (tan x))
4.0ms
(* (tan x) (tan x))

series176.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
56.0ms
(* (* (tan x) (tan x)) (* (tan x) (tan x)))
56.0ms
(pow (* (tan x) (tan x)) 3)
38.0ms
(* (tan x) (tan x))
27.0ms
(* (tan x) (tan x))

simplify1.1s

Counts
131 → 148
Calls
131 calls:
Slowest
117.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))))
96.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))))
84.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))))
78.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))))
35.0ms
(* (* (* (tan x) (tan x)) (tan x)) (* (* (tan x) (tan x)) (tan x)))

prune2.3s

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 0.0b

localize11.0ms

Local error

Found 4 expressions with local error:

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

rewrite19.0ms

Algorithm
rewrite-expression-head
Rules
17×pow1
13×add-exp-log
12×associate-*r*
11×add-cube-cbrt
11×*-un-lft-identity
11×add-sqr-sqrt
10×add-cbrt-cube
associate-*l*
tan-quot
add-log-exp
log1p-expm1-u
associate-/r/
prod-exp
associate-*l/
frac-times
expm1-log1p-u
cbrt-unprod
*-commutative
associate-*r/
pow-prod-down
associate-/r*
flip--
div-inv
flip-+
pow-prod-up
flip3--
pow-plus
flip3-+
rec-exp
pow2
inv-pow
pow-flip
un-div-inv
frac-2neg
clear-num
Counts
4 → 99
Calls
4 calls:
Slowest
7.0ms
(* (tan x) (tan x))
5.0ms
(* (- 1 (* (tan x) (tan x))) (/ 1 (+ 1 (* (tan x) (tan x)))))
4.0ms
(* (tan x) (tan x))
1.0ms
(/ 1 (+ 1 (* (tan x) (tan x))))

series202.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
86.0ms
(* (- 1 (* (tan x) (tan x))) (/ 1 (+ 1 (* (tan x) (tan x)))))
45.0ms
(/ 1 (+ 1 (* (tan x) (tan x))))
41.0ms
(* (tan x) (tan x))
30.0ms
(* (tan x) (tan x))

simplify4.1s

Counts
68 → 111
Calls
68 calls:
Slowest
500.0ms
(+ (* 1 1) (- (* (* (tan x) (tan x)) (* (tan x) (tan x))) (* 1 (* (tan x) (tan x)))))
499.0ms
(* (+ (* 1 1) (+ (* (* (tan x) (tan x)) (* (tan x) (tan x))) (* 1 (* (tan x) (tan x))))) (+ 1 (* (tan x) (tan x))))
472.0ms
(+ (* 1 1) (- (* (* (tan x) (tan x)) (* (tan x) (tan x))) (* 1 (* (tan x) (tan x)))))
357.0ms
(* (- (pow 1 3) (pow (* (tan x) (tan x)) 3)) 1)
342.0ms
(* (- (pow 1 3) (pow (* (tan x) (tan x)) 3)) (/ 1 (+ 1 (* (tan x) (tan x)))))

prune1.2s

Pruning

10 alts after pruning (8 fresh and 2 done)

Merged error: 0.0b

regimes217.0ms

Accuracy

0% (0.3b remaining)

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

bsearch3.0ms

end0.0ms

sample6.4s

Algorithm
intervals