Internet PLC Forum

General => Technical support => Topic started by: shenzhuo on May 26, 2004, 05:02:32 AM

Title: How to express the fuction such as sin/cos
Post by: shenzhuo on May 26, 2004, 05:02:32 AM
How to express the fuction such as sin/cos in TBASIC programming? ??? :'(

Title: Re:How to express the fuction such as sin/cos
Post by: Joel Moore on May 26, 2004, 03:34:25 PM
There's nothing built-in but you could use lookup tables.  Some Google searching (try "integer sine cosine") and/or some old computer science textbooks might lead you down the right path.

Here's a newsgroup thread that discusses using lookup tables for this purpose. (http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&c2coff=1&safe=off&threadm=HEBRAIS.90Nov23024202%40olivier.IRO.UMontreal.CA&rnum=9&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DISO-8859-1%26safe%3Doff%26c2coff%3D1%26q%3Dsine%2Bcosine%2Binteger%26btnG%3DSearch)

People have also mentioned using Taylor Series calculations to generate sine and cosine values but the formula looks pretty complex.
Title: Re:How to express the fuction such as sin/cos
Post by: raan on June 17, 2004, 11:38:43 AM
Re:Taylor series
While it is true that the formulation of the taylor series appears complex you don't really need   but a few of the terms to achieve good accuracy  particularily if you are computing over a small interval. You just need to test it out to find how many terms you need to achieve the desired accuracy.