Average Error: 0.3 → 0.4
Time: 17.8s
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}}}{\frac{\sqrt[3]{{\left(\sin x\right)}^{2} \cdot \left({\left(\sin x\right)}^{2} \cdot {\left(\sin x\right)}^{2}\right)}}{{\left(\cos x\right)}^{2}} + 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. 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}}\]
  3. Using strategy rm
  4. Applied add-cbrt-cube0.4

    \[\leadsto \frac{1 - \frac{{\left(\sin x\right)}^{2}}{{\left(\cos x\right)}^{2}}}{\frac{\color{blue}{\sqrt[3]{\left({\left(\sin x\right)}^{2} \cdot {\left(\sin x\right)}^{2}\right) \cdot {\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}}}{\frac{\sqrt[3]{{\left(\sin x\right)}^{2} \cdot \left({\left(\sin x\right)}^{2} \cdot {\left(\sin x\right)}^{2}\right)}}{{\left(\cos x\right)}^{2}} + 1}\]

Reproduce

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

Details

Time bar (total: 16.2s)Debug log

sample234.0ms

Algorithm
intervals

simplify52.0ms

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

prune10.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.3b

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

rewrite43.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
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 → 89
Calls
4 calls:
Slowest
9.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)))

series619.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
483.0ms
(/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x))))
56.0ms
(* (tan x) (tan x))
40.0ms
(* (tan x) (tan x))
39.0ms
(- 1 (* (tan x) (tan x)))

simplify2.0s

Counts
72 → 101
Calls
72 calls:
Slowest
494.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)))))
295.0ms
(+ (* 1 1) (- (* (* (tan x) (tan x)) (* (tan x) (tan x))) (* 1 (* (tan x) (tan x)))))
190.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))
163.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))
77.0ms
(- (pow 1 3) (pow (* (tan x) (tan x)) 3))

prune948.0ms

Pruning

11 alts after pruning (11 fresh and 0 done)

Merged error: 0.0b

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

rewrite5.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
pow-exp
add-cbrt-cube
pow-pow
pow-to-exp
Counts
4 → 56
Calls
4 calls:
Slowest
1.0ms
(pow (cos x) 2)
1.0ms
(pow (sin x) 2)
1.0ms
(pow (sin x) 2)
1.0ms
(pow (cos x) 2)

series71.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
22.0ms
(pow (sin x) 2)
19.0ms
(pow (sin x) 2)
18.0ms
(pow (cos x) 2)
12.0ms
(pow (cos x) 2)

simplify333.0ms

Counts
32 → 68
Calls
32 calls:
Slowest
59.0ms
(- (+ (pow x 2) (* 2/45 (pow x 6))) (* 1/3 (pow x 4)))
51.0ms
(- (+ (pow x 2) (* 2/45 (pow x 6))) (* 1/3 (pow x 4)))
50.0ms
(- (+ (* 1/3 (pow x 4)) 1) (pow x 2))
49.0ms
(- (+ (* 1/3 (pow x 4)) 1) (pow x 2))
16.0ms
(pow (* (cbrt (sin x)) (cbrt (sin x))) 2)

prune943.0ms

Pruning

12 alts after pruning (12 fresh and 0 done)

Merged error: 0.0b

localize36.0ms

Local error

Found 4 expressions with local error:

12.0b
(cbrt (* (* (pow (sin x) 2) (pow (sin x) 2)) (pow (sin x) 2)))
0.3b
(* (pow (sin x) 2) (pow (sin x) 2))
0.2b
(pow (cos x) 2)
0.2b
(pow (cos x) 2)

rewrite35.0ms

Algorithm
rewrite-expression-head
Rules
18×add-exp-log
12×unpow-prod-down
10×add-cube-cbrt
10×*-un-lft-identity
10×add-sqr-sqrt
prod-exp
pow-exp
pow-to-exp
associate-*l*
associate-*r*
add-cbrt-cube
pow1
add-log-exp
unpow2
pow-pow
cbrt-unprod
rem-cbrt-cube
pow-prod-up
*-commutative
pow-prod-down
pow3
pow1/3
pow2
cbrt-prod
Counts
4 → 73
Calls
4 calls:
Slowest
15.0ms
(* (pow (sin x) 2) (pow (sin x) 2))
14.0ms
(cbrt (* (* (pow (sin x) 2) (pow (sin x) 2)) (pow (sin x) 2)))
2.0ms
(pow (cos x) 2)
2.0ms
(pow (cos x) 2)

series89.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
35.0ms
(* (pow (sin x) 2) (pow (sin x) 2))
27.0ms
(cbrt (* (* (pow (sin x) 2) (pow (sin x) 2)) (pow (sin x) 2)))
16.0ms
(pow (cos x) 2)
12.0ms
(pow (cos x) 2)

simplify586.0ms

Counts
50 → 85
Calls
50 calls:
Slowest
80.0ms
(* (* (* (pow (sin x) 2) (pow (sin x) 2)) (pow (sin x) 2)) (* (* (pow (sin x) 2) (pow (sin x) 2)) (pow (sin x) 2)))
59.0ms
(- (+ (* 1/5 (pow x 8)) (pow x 4)) (* 2/3 (pow x 6)))
58.0ms
(- (+ (pow x 2) (* 2/45 (pow x 6))) (* 1/3 (pow x 4)))
50.0ms
(- (+ (* 1/3 (pow x 4)) 1) (pow x 2))
39.0ms
(- (+ (* 1/3 (pow x 4)) 1) (pow x 2))

prune1.3s

Pruning

12 alts after pruning (11 fresh and 1 done)

Merged error: 0.0b

localize20.0ms

Local error

Found 4 expressions with local error:

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

rewrite30.0ms

Algorithm
rewrite-expression-head
Rules
19×pow1
14×*-un-lft-identity
14×add-sqr-sqrt
12×tan-quot
10×add-cube-cbrt
10×add-exp-log
10×add-cbrt-cube
associate-*l*
associate-*r*
add-log-exp
div-inv
associate-/r/
distribute-rgt-out--
cbrt-unprod
pow-prod-up
*-commutative
associate-*r/
prod-exp
associate-*l/
pow-prod-down
pow-plus
frac-times
pow2
difference-of-squares
distribute-lft-out--
flip-+
flip3-+
sub-div
flip--
frac-sub
diff-log
flip3--
times-frac
sub-neg
Counts
4 → 91
Calls
4 calls:
Slowest
12.0ms
(- (/ 1 (+ 1 (* (tan x) (tan x)))) (/ (* (tan x) (tan x)) (+ 1 (* (tan x) (tan x)))))
8.0ms
(* (tan x) (tan x))
5.0ms
(* (tan x) (tan x))
4.0ms
(* (tan x) (tan x))

series212.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
110.0ms
(- (/ 1 (+ 1 (* (tan x) (tan x)))) (/ (* (tan x) (tan x)) (+ 1 (* (tan x) (tan x)))))
40.0ms
(* (tan x) (tan x))
36.0ms
(* (tan x) (tan x))
26.0ms
(* (tan x) (tan x))

simplify1.8s

Counts
76 → 103
Calls
76 calls:
Slowest
404.0ms
(- (* 1 (+ 1 (* (tan x) (tan x)))) (* (+ 1 (* (tan x) (tan x))) (* (tan x) (tan x))))
227.0ms
(+ (* 1 1) (- (* (* (tan x) (tan x)) (* (tan x) (tan x))) (* 1 (* (tan x) (tan x)))))
165.0ms
(* (+ 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x))))
154.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))))
116.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))))

prune905.0ms

Pruning

11 alts after pruning (10 fresh and 1 done)

Merged error: 0b

regimes387.0ms

Accuracy

0% (0.3b remaining)

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

bsearch4.0ms

end0.0ms

sample5.5s

Algorithm
intervals