Power Series
I began to write a simple calculator program about a week ago, and some of the features I wanted to include were trigonometric functions and exponents/ logarithms. I found a good place to start was with recursive functions and power series.
Geometric Series, Taylor and Maclaurin Series
The only two ways I know to write a function as a power series are by the manipulation of the geometric series, or by using a Maclaurin series. I usually don’t use Taylor series because it is simpler to center the series at zero if possible. By using a geometric series I was able to come up with a function for natural logarithms. The exponential, sine, cosine, and tangent functions are all calculated with a Maclaurin series.
Logarithms
The natural log function comes from the manipulation of the geometric series.
1/(1-x) = ∑x^n = 1 + x + x^2 + x^3 + ...
Start with the derivative of ln(x) which is 1/x. However we want a series in the form of 1/(1-x). So to do this just take derivative of ln(1-x). Integrating the series yields a power series with a radius of convergence of one.
ln(1-a) = (n=1->∞) ∑ a^n/n
At first glance this may appear to be unhelpful for the most part because you can’t compute the natural log of a number greater than one. There is a trick to this. First remember this relation ln(1/a) = ln(1) – ln(a) = -ln(a). So then for all numbers larger than one take the natural log of its reciprocal and then multiply the result by negative one to get the real answer. Also take notice of the fact the function is the ln(1-a), so set x = 1 – a, and find a. Then plug a into the series to find the ln(x). Logarithms can now be found by using natural logs. This is simple.
log(x)=y or a^y=x First take the natural log of both sides. ln(a^y) = ln(x) Then just rearrage the equation to solve for y. y*ln(a) = ln(x) y=ln(x)/ln(a)
Sine, Cosine, Tangent, and exponential functions
All of these functions are found with a Maclaurin series and they converge for all real numbers. Well of course tangent is undefined when cosine is zero. The sine and cosine series are as follows:
sin(x) = (n=0->∞) ∑[(-1)^n * x^(2*n+1) / (2*n+1)!] cos(x) = (n=0->∞) ∑[(-1)^n * x^(2*n)/(2*n)!]
To find the value of tangent of x divide sin(x) by cos(x) Remember though that asymptotes exist whereever cos(x) is equal to zero. The last series now is for exponential functions.
exp(x) = (n=0->∞) ∑[x^n/n!]
Update July 5, 2005
I created this pdf using texmacs to help understand geometric series, power series, and taylor/maclaurin series. I’m assuming that the person reading this document has some knowledge already of what a series is, and how to find where it converges/diverges.
October 2, 2008 at 12:08 AM
Great pdf, thank you so much for posting it!