Taylor Series

What is Taylor Series???

Taylor Series in simple terms, is a way of finding the value of a function at any point. To calculate and formulate the answer, all we need is the function value at a single point and the values of all its derivatives at that point. The general expression for Taylor Series is expressed as follows.
$$f(x) = \sum_{k = 0}^{\infty}\frac{1}{k!}(x - a)^kf^k(a)$$ Note that we need to know what the function values are at $f(a)$, $f'(a)$, $f''(a)$, ...

The above expression is the series representation of infinite terms. There is an alternative way of expressing the Taylor Series in finite terms. It is as follows $$f(x) = \sum_{k = 0}^{n}\frac{1}{k!}(x - a)^kf^k(a) + \frac{1}{(n+1)!}(x-a)^{(n+1)}f^{(n+1)}(\sigma)$$ The last term is known as the error term and $\sigma \in [x, a]$

Use in exercises

Let's look at how this works when we have the required stuff to calculate the value of a function at any point. Let's say we have a function given to us in a form of a differential equation. The function is $\frac{df(x)}{dx} = 2(f(x))^3 + 1$. And they have given the value of this function at $f(0) = 2$. Note that that is all we need to calculate the function value at any point. Let's try to find $f(0.5)$ from a second order polynomial.

We can write the third order polynomial as follows $$f(x) = \sum_{k = 0}^{1}\frac{1}{k!}(x - a)^kf^k(a) + \frac{1}{(2)!}(x-a)^{(2)}f^{(2)}(\sigma)$$ Comparing the known values, we know that $a = 0$. Now let's try to derive the derivatives at point $0$. \begin{align} f(0) &\ {= 2}\\ f'(0) &\ {= \frac{df(0)}{dx}}\\ &\ {= 2(2)^3 + 1}\\ &\ {= 17}\\ f''(0)&\ {= \frac{d^2f(0)}{dx^2}}\\ &\ {= 2\times3(f(0))^2\times f'(0)}\\ &\ {= 2\times3(2)^2\times 17}\\ &\ {= 408}\\ \end{align} Now the Taylor Series expansion is as follows $$f(x) = f(0) + (x-0)f'(0) + \frac{1}{2}(x-0)^2f''(0)$$ Substituting known values and simplifying $$f(x) = 2 + (x)(17) + \frac{1}{2}(x)^2(408)$$ This yields $f(x) = 204x^2 + 17x + 2$

So $f(0.5)$ will be 61.5


Popular posts from this blog

Python Laboratory Excersices


Find Maximum Number in a Nested List Recursively