Connect with random people instantly. Find them in the world’s largest group chat. The “Omegle” for people who don’t want to get creepy messages from old people and weird strangers! Free private chat forever, and meet people along the way. Zonish is also great for you to contact your friends anonymously. Zonish.com is also the best way to contact your friends anonymously, without your parents finding out! Our site is pretty much a way for you to launder your chats. Statistically, the chance of someone finding your chat is impossible, unless they are with you in real life, looking at your computer or device. We hope to make the internet a safer and more secure place for everyone to chat on, without the risks of being spied on, by anyone untrustworthy. Talking to strangers online can be sketchy, so if you are ever talking to someone you don’t feel comfortable with, please just leave the chat. If you are reading this, please let us know if you have any ideas, questions, or concerns for our website here: [email protected] Thanks for reading and enjoy chatting!

A Gentle Introduction to Taylor Series

A Gentle Introduction to Taylor Series

Taylor series expansion is an awesome concept, not only the world of mathematics, but also in optimization theory, function approximation and machine learning. It is widely applied in numerical computations when estimates of a function’s values at different points are required.

In this tutorial, you will discover Taylor series and how to approximate the values of a function around different points using its Taylor series expansion.

After completing this tutorial, you will know:

  • Taylor series expansion of a function
  • How to approximate functions using Taylor series expansion

Let’s get started.

A Gentle Introduction To Taylor Series. Photo by Muhammad Khubaib Sarfraz, some rights reserved.

A Gentle Introduction To Taylor Series. Photo by Muhammad Khubaib Sarfraz, some rights reserved.

Tutorial Overview

This tutorial is divided into 3 parts; they are:

  1. Power series and Taylor series
  2. Taylor polynomials
  3. Function approximation using Taylor polynomials

What Is A Power Series?

The following is a power series about the center x=a and constant coefficients c_0, c_1, etc.

What Is A Taylor Series?

It is an amazing fact that functions which are infinitely differentiable can generate a power series called the Taylor series. Suppose we have a function f(x) and f(x) has derivatives of all orders on a given interval, then the Taylor series generated by f(x) at x=a is given by:

The second line of the above expression gives the value of the kth coefficient.

If we set a=0, then we have an expansion called the Maclaurin series expansion of f(x).

Examples Of Taylor Series Expansion

Taylor series generated by f(x) = 1/x can be found by first differentiating the function and finding a general expression for the kth derivative. 

The Taylor series about various points can now be found. For example:

 

Taylor Polynomial

A Taylor polynomial of order k, generated by f(x) at x=a is given by:

For the example of f(x)=1/x, the Taylor polynomial of order 2 is given by:

Approximation via Taylor Polynomials

We can approximate the value of a function at a point x=a using Taylor polynomials. The higher the order of the polynomial, the more the terms in the polynomial and the closer the approximation is to the actual value of the function at that point.

In the graph below, the function 1/x is plotted around the point x=1 (left) and x=3 (right). The line in green is the actual function f(x)= 1/x. The pink line represents the approximation via an order 2 polynomial.

The actual function (green) and its approximation (pink)

The actual function (green) and its approximation (pink)

More Examples of Taylor Series

Let’s look at the function g(x) = e^x.  Noting the fact that the kth order derivative of g(x) is also g(x), the expansion of g(x) about x=a, is given by:

Hence, around x=0, the series expansion of g(x) is given by (obtained by setting a=0):

The polynomial of order k generated for the function e^x around the point x=0 is given by:

The plots below show polynomials of different orders that estimate the value of e^x around x=0. We can see that as we move away from zero, we need more terms to approximate e^x more accurately. The green line representing the actual function is hiding behind the blue line of the approximating polynomial of order 7.

Polynomials of varying degrees that approximate e^x

Taylor Series In Machine Learning

A popular method in machine learning for finding the optimal points of a function is the Newton’s method. Newton’s method uses the second order polynomials to approximate a function’s value at a point. Such methods that use second order derivatives are called second order optimization algorithms. 

Extensions

This section lists some ideas for extending the tutorial that you may wish to explore.

  • Newton’s method
  • Second order optimization algorithms

If you explore any of these extensions, I’d love to know. Post your findings in the comments below.

Further Reading

This section provides more resources on the topic if you are looking to go deeper.

Tutorials

Resources

Books

Summary

In this tutorial, you discovered what is Taylor series expansion of a function about a point. Specifically, you learned:

  • Power series and Taylor series
  • Taylor polynomials
  • How to approximate functions around a value using Taylor polynomials

Do you have any questions?

Ask your questions in the comments below and I will do my best to answer

The post A Gentle Introduction to Taylor Series appeared first on Machine Learning Mastery.