??? 03/19/04 04:21 Read: times |
#67017 - Taylor series Responding to: ???'s previous message |
Hallo Jan,
I have compared your methode with standard Taylor series and found, that your methode is not as exact as Taylor series! sin(x) = x(1-x²/pi²)(1-x²/4pi²)(1-x²/9pi²) needs 4 multiplications, 3 divisions and 3 additions or subtractions. (Ok, division by '4' is trivial, very probably.) sin (x) = x - x^3 / 3! + x^5 / 5! - x^7 / 7! needs also 4 mulitplications, 3 divisions and 3 additions or subtractions. If you compare these two methods, then you get for x = 1.5 (single precision): Your methode: 1.064379 Taylor series: 0.9973912 Exact value: 0.997495 By the way: With the most methodes your approximation is the better the nearer x is to 0. So, for x = 0.3 e.g. approximation is far better than for x=1.5. For x = 0.3 you get: Your methode: 0.2962862 Taylor series: 0.2955202 Exact value: 0.2955202 Whether expansion series or other methode will satisfy you, highly depends on your demands, referring to precision, computing time and code space. So, it may be, that even a simpler Taylor series expansion, consisting of a smaller number of terms will do the job, if high precision is not the issue. Basics: Taylor series develops a function arround a certain choosen point, by the help of derivatives of function at that point. If that point is labeled 'a', then Taylor series becomes: f(x) = f(a) + (x-a) / 1! * f'(a) + (x-a)^2 / 2! * f''(a) + (x-a)^3 / 3! * f'''(a) + ... As you can see, 'a' needs not necessarily to be a=0. Sometimes it can be helpful to develop Taylor series expansion arround another point. But in any case: Your approximation is the better, the nearer x is to a. Kai |
Topic | Author | Date |
can\'t use sin(x) in math.h from µvision | 01/01/70 00:00 | |
RE: can\'t use sin(x) in math.h from µvision | 01/01/70 00:00 | |
RE: can\'t use sin(x) in math.h from µvision | 01/01/70 00:00 | |
RE: can\'t use sin(x) in math.h from µvision | 01/01/70 00:00 | |
Lookup table | 01/01/70 00:00 | |
RE: Lookup table | 01/01/70 00:00 | |
Taylor series | 01/01/70 00:00 | |
RE: can\'t use sin(x) in math.h from µvision | 01/01/70 00:00 | |
Very nice links! | 01/01/70 00:00 | |
RE: can\'t use sin(x) in math.h from µv | 01/01/70 00:00 | |
RE: can\'t use sin(x) in math.h from µv![]() | 01/01/70 00:00 |