Post Reply 
Simple Series to calculate tan(x)
09-07-2016, 07:10 PM (This post was last modified: 09-07-2016 07:11 PM by Dieter.)
Post: #2
RE: Simple Series to calculate tan(x)
(09-07-2016 05:59 PM)Namir Wrote:  I found a simple series to calculate tan(x):

Code:
...
  K = 0
  Do
    K = K + 1
    Term = 1 / ((2 * K - 1) ^ 2 - X2)
    Sum = Sum + Term
  Loop Until Abs(Term) < TOLER
...

This should run faster as is uses less arithmetics and avoids a power function:

Code:
...
  K = 1
  Do
    Term = 1 / (K * K - X2)
    Sum = Sum + Term
    K = K + 2
  Loop Until Abs(Term) < TOLER
...

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Simple Series to calculate tan(x) - Namir - 09-07-2016, 05:59 PM
RE: Simple Series to calculate tan(x) - Dieter - 09-07-2016 07:10 PM



User(s) browsing this thread: 1 Guest(s)