The book has typos in the problems assignment concerning Taylor series. Here are corrections:
sin x = x - x^3/3! + x^5/5! - x^7/7! + ...
cos x = 1 - x^2/2! + x^4/4! - x^6/6! + ...
Notice that cos x is the derivative of sin x.
Although these approximations for sin x and cos x are true for all x, they are best "near 0," according to our calculus book. How near? Run some experiments and see what you think. Any good approximation for sin x and cos x should certainly yield sin^2(x) + cos^2(x) = 0, no? And you can certainly test nonzero values for x for which you already know the sine and cosine.
Take advantage of the periodicity of sin x, cos x: Use modular division and built-in constant Math.PI to translate any real x into a value near zero with the same sine and cosine. Although modular division in math is defined only for integers, in Java it works on reals, too.
What the CS book calls the Taylor series, our calculus book calls the Maclaurin series, a special case of Taylor for functions evaluated at zero. The general Taylor series is a more complicated expression. You get to study it in Calculus II.
Sunday, September 28, 2008
Subscribe to:
Post Comments (Atom)
2 comments:
you are so strong~~ :)
Taylor is really quite fundamental in calculus....
Post a Comment