Damned charming :)
- 62
- 0
Runge-kutta is generally used if you want many points on a curve, and you when have the rate of change initialy but not many inital values on the curve.Originally posted by recon
Excel does have a cosine function, and I generate the same graph as you (at least on a large scale)using that. As you say, computers calculate cos(x) indirectly, so how does Microsoft Excel go about doing that? Is it more accurate than our way of doing it? Does it use methods like the ones you said Chen would suggest using earlier, i.e. Range-Kutta? Is that how calculators generate cos(x) as well?
To find a single value of cos(x) a calculator would use taylor series.
cos(x) = 1 -x^2/2 + x^4/(4*3*2*1) -x^6/(6*5*4*3*2*1)+...
The +... means that the series goes on for ever however it can be shown it is enough to use the first few terms. I suppose your project how many of these terms you need. I doubt it is more than 6 in old calculators because they produced an error when you tried to take the cos of 10^20.
The basic idea about how this formula was found is easy understand in laymans terms, a formal proof is obviously more tricky.
It is reasonable to assume that cos(x) is can be represented by a polynomial with infinitely many terms.
So
cos(x) = a + bx + cx^2 + dx^3+ ...
now how would you find a? well sub in x=0 and you get
cos(0) = a + b*0 + c*0^2+...
so a = cos(0)=1
to find b differentiate both sides of the polynomial to get
-sin(x) = b + 2x+ 3dx^2+...
sub in x=0 and get
b= -sin(0) = 0
You can continue to keep finding the coefficents and come up with
cos(x) = 1 -x^2/2 + x^4/(4*3*2*1) -x^6/(6*5*4*3*2*1)+...