Taylor Series

Overview


The Taylor series of a function f is a polynomial that converges to the function under certain conditions.
{% Taylor \, Polynomial \, of \, f(x) = \sum_{k} \frac{f^{(k)}(a)}{k!} (x-a)^k %}
A Taylor polynomial of order n is the first n terms in the Taylor polynomial given above. It assumes that the first n derivatives of the function exists at the given point.

Taylor API


Taylor API- provides an API to calculate a Taylor approximation. The extrapolate function takes a variable number of parameters. The first parameter is the diff of the x value at the approximation pont and the x value at the base point. The followoing parameters give the values of the function at the base point and its derivatives.

The following shows approximating a function f, at the point x=1. The value of the function at x=0 is 0. The first derivative at x=0 is 0, and the second derivative at x=0 is 2. That is, the first parameter, the diff, is 1-0 = 1. The next three parameters are 0,0,2.


let ty = await import('/lib/approximation/taylor/v1.0.0/taylor.mjs');

let value = ty.extrapolate(1, 0, 0, 2);
					
Try it!

Taylor Example


In the following example, we examine the taylor series of the sine function. The slider lets you select the number of derivatives to use in the taylor approximation. (between 0 and 20)

copy

Topics


Contents