Simple Series to calculate tan(x)
|
09-07-2016, 05:59 PM
(This post was last modified: 09-12-2016 01:36 PM by Namir.)
Post: #1
|
|||
|
|||
Simple Series to calculate tan(x)
I found a simple series to calculate tan(x):
tan(pi*x/2) = 4*x/pi * Sum(1/[(2k-1)^2 - x^2] for k=1 to infinity Or, tan(pi*x/2) = 4*x/pi * Sum(1/[(k^2 - x^2] for k=1,3,5,7,... infinity The number of iterations depend on the tolerance used for the term 1/[(2k-1)^2 - x^2] using the first equation, and 1/[(k^2 - x^2] using the second equation. I found an approximate relation between the number of required iterations, Iters, and the tolerance, Tol: Iters = 0.5/Sqrt(Tol) Calculating tan(x) to very good accuracy requires a lot of iterations! The somewhat good news is that each iteration does not involve a lot of calculations. Here is an Excel VBA implementation of the above equation: Code: Public Function MyTan(ByVal X As Double) As Double |
|||
« Next Oldest | Next Newest »
|
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
RE: Simple Series to calculate tan(x) - Willy R. Kunz - 09-12-2016, 10:09 AM
RE: Simple Series to calculate tan(x) - Dieter - 09-12-2016, 08:28 PM
RE: Simple Series to calculate tan(x) - Namir - 09-12-2016, 11:42 PM
RE: Simple Series to calculate tan(x) - Namir - 09-07-2016, 09:02 PM
RE: Simple Series to calculate tan(x) - Namir - 09-12-2016, 12:17 PM
|
User(s) browsing this thread: 1 Guest(s)