After looking at numbers, we will continue with a few practical observations about functions. The Taylor series of a real or complex-valued function that is infinitely differentiable at a real or complex number
is the power series:
Using , we obtain the so-called Maclaurin series:
The series above are clearly “power series” since we could write them as:
and
respectively, using the definition for the Taylor series or
for the Maclaurin series.
The Taylor series of a polynomial is the polynomial itself.
Taylor and Maclaurin series can be used in a practical way to program functions in a calculating machine or computer. A function such as or
etc. has no meaning for a computer. For a computer,
and
are just symbols with no explicit algorithm defined to compute numerical results. Here are some Maclaurin series of important functions:
For programming the sine function we could use, for example, the series above as follows (in Python):
def sin(x):
epsilon = 1e-16
term = x
sine = x
sign = -1
n = 1
while abs(term) > epsilon:
term *= x * x / ((2 * n) * (2 * n + 1))
sine += sign * term
sign *= -1
n += 1
return sine
Leave a comment