So it comes to getting a formula that fits cos(x) with accuracy over this restricted range. One example is from Abramowitz and Stegun. They give a five term polynomial approximation accurate to 2E(-9) in the restricted range. Probably a least-squares fit of tabulated values of cos(x). Of course, much higher accuracy is easy to obtain with more terms. Hope this helps, and this is great example that contrasts analysis and numerical methods.
@Mathview i am really grateful for your answers. i really do not understand everything the only thing i understand is that taylor series is a sum of functions and this sum is infinite. my question is if i want to find the sin 60 for example how do i know at what point to stop since taylor series goes on to infinity
@princeobi007 Ah, ok. So we can use the Remainder term to answer your question.
Using the Legendre form of the remainder we have abs(sin(pi/3) - S(n, pi/3))) < abs(R(n+1)) where S(n) is the sum of the first n-terms of the Taylor Series evaluated at x=pi/3=60deg. Now we estimate abs(R(n+1)) as less than or equal to (pi/3)^(n+1) / (n+1)!. This ratio is an upper bound for the "error" for the n-term expansion. For large n, the (n+1)! term gets very large compared to the n+1 power of pi/3.
hi am trying to integrate taylor series in to my c++ program so that my program will be able to find the sine and cosine of angles but i don't really understand the explanation you just gave . Could you help me out??
@princeobi007 Good question. Ok, this video on the Taylor Theorem shows how to get the Taylor expansion of analytic functions like cos(x). If we want write a program to efficiently get a numerical value, the Taylor expansion is usually not very useful. Other methods are needed. A nice thing about cos(x) is that it is periodic, if you know its values for 0<x<pi/2 then you can get them for any x. So it comes to getting a formula that fits cos(x) with accuracy over this restricted range.
So it comes to getting a formula that fits cos(x) with accuracy over this restricted range. One example is from Abramowitz and Stegun. They give a five term polynomial approximation accurate to 2E(-9) in the restricted range. Probably a least-squares fit of tabulated values of cos(x). Of course, much higher accuracy is easy to obtain with more terms. Hope this helps, and this is great example that contrasts analysis and numerical methods.
Mathview 1 year ago
@Mathview i am really grateful for your answers. i really do not understand everything the only thing i understand is that taylor series is a sum of functions and this sum is infinite. my question is if i want to find the sin 60 for example how do i know at what point to stop since taylor series goes on to infinity
princeobi007 1 year ago
@princeobi007 Ah, ok. So we can use the Remainder term to answer your question.
Using the Legendre form of the remainder we have abs(sin(pi/3) - S(n, pi/3))) < abs(R(n+1)) where S(n) is the sum of the first n-terms of the Taylor Series evaluated at x=pi/3=60deg. Now we estimate abs(R(n+1)) as less than or equal to (pi/3)^(n+1) / (n+1)!. This ratio is an upper bound for the "error" for the n-term expansion. For large n, the (n+1)! term gets very large compared to the n+1 power of pi/3.
Mathview 1 year ago
Comment removed
princeobi007 1 year ago
hi am trying to integrate taylor series in to my c++ program so that my program will be able to find the sine and cosine of angles but i don't really understand the explanation you just gave . Could you help me out??
princeobi007 1 year ago
@princeobi007 Good question. Ok, this video on the Taylor Theorem shows how to get the Taylor expansion of analytic functions like cos(x). If we want write a program to efficiently get a numerical value, the Taylor expansion is usually not very useful. Other methods are needed. A nice thing about cos(x) is that it is periodic, if you know its values for 0<x<pi/2 then you can get them for any x. So it comes to getting a formula that fits cos(x) with accuracy over this restricted range.
Mathview 1 year ago