About
Taylor approximations
At the left side of the window one of eight different base functions y = f(x) can be selected by radio buttons. A suitable x range 0 < x < 2a is attributed to each of them.
- sin(x)
- [sin(x)]^{2}
- sin(x^{2})
- Power function pow (x,7) = x^{7}
- Gaussian: exp(-(x-a)^{2})
- sin(x-a)/(x-a))
- [sin(x-a)/(x-a)]^{2 }
- e^{x }- 2
When opening the simulation, the Gaussian function will be activated and is drawn as a blue curve. The quadratic Taylor approximation around the origin is shown in magenta.
At the top of the window there are 9 radio buttons to select a Taylor approximation (expansion) around a model point x_{o}, of index 0 (constant value y_{0}) to 9 (considering up to the 9th derivative in x_{0,} y_{0} ). The selected approximations is drawn in the color of the radio buttons .
The model point x0, y0 is shown as a red dot. It can be drawn with the mouse to calculate the expansion around an arbitrary model point.
Reset Dot returns the model point to its default position.
The first number field at the left shows the value of the function y_{0} in the model point x_{0}, y_{0}.
The other number fields show the factors of the power functions ( x-x_{0 }) ^{n} in the Taylor series, as
f5 = y^{(5)}/5!
Very small numbers at high index may indicate numerical artifacts.
Taylor series
This simulation calculates the Taylor series of a function
y = f(x)
in the vicinity of a model point x_{0,} y_{0}_{ }
y = f(x_{0}) + f ´(x_{0})(x - x_{0})/1! + f´´(x0)(x - x_{0})^{2}/2!+... + f^{(n)}(x_{0})(x - x_{0})^{n}/n!...
n! = 1∙2∙3∙4...∙ n: n faculty
The first member of the series is an approximation within the interval by the value in the model point: y ≈ f(x_{0}). This is commonly called the zeroth approximation.
The first approximation considers the first derivative, and is the tangent to the curve at the model point. It is also called the linear approximation and is already quite useful for small intervals.
y ≈ f(x_{0}) + f ´(x_{0})(x - x_{0})/1! = f(x_{0}) + f´(x_{0})(x - x_{0})
The second or quadratic approximation adds a parabola of second order, considering also the curvature in the model point.
y ≈ f(x_{0}) + f ´(x_{0})(x - x_{0})/1! + f´´(x0)(x - x_{0})^{2}/2
(One should realize that the resulting polynom of second order is not identical to the parabola used in the Kepler algorithm of integration: The Kepler parabola cuts the curve in three points, while the Taylor polynom touches it in one. Both approximations converge with decreasing interval width of integration).
The higher order approximations are polynomials of increasing order, which approach the function well over wider and wider intervals (for "well behaved" functions, which our examples are).
For the example of a 7th power parabola the 7th Taylor approximation is identical to the function itself, as all higher derivatives are 0. (the very small deviations from 0 seen in the number fields for f8 and f9 are residual calculation errors).
(x - 0)^{7 }= y0 + f1(x - x0) + f2 (x - x0)^{2 }+ f3(x - x0)^{3 }+ f4(x - x0)^{4 }+ f5(x - x0)^{5}
+ f6(x - x0)^{6 }+ f7(x - x0)^{7}
The identity demonstrates that the original parabola x^{7}can be interpreted as a Taylor expansion around x = 0. Indeed, as one draws the dot to x = 0, all factors in the number fields become zero except f7, which will be 1.
Calculation of the derivatives
With h − the difference between consecutive x values − sufficiently small, the first derivative (differential quotient) is approximated by the difference quotient:
y^{(1)}(x) = (1/2h) [y(x+h) - y(x-h)]
The second derivative is approximated as the difference quotient of the first difference quotient:
y^{(2)}(x)= (1/2h) [y^{(1)}(x+h) - y^{(1)}(x-h)] = (1/2h)^{2 }[y(x+2h) - 2y(x) + y(x-1h)]
This algorithm can be continued, leading to the code lines shown below for the base function a[0] and its derivatives up to the 9th order a[9].
For the predefined functions most approximations do not differ visibly from the analytical derivatives, with the interval h being 1/1000 of the total range.
For still higher derivatives the limits of the accuracy of the approximation and also of the computing accuracy are stressed, and noise appears.
Code for calculating the derivatives: With s = 1/(2h)
a0=y0;
a1[j]=Math.pow(s,1)*(y2[1][j]-y1[1][j]);
a2[j]=Math.pow(s,2)*(y2[2][j]-2*y2[0][j]+y1[2][j]);
a3[j]=Math.pow(s,3)*(y2[3][j]-3*y2[1][j]+3*y1[1][j]-y1[3][j]);
a4[j]=Math.pow(s,4)*(y2[4][j]-4*y2[2][j]+6*y2[0][j]-4*y1[2][j]+y1[4][j]);
a5[j]=Math.pow(s,5)*(y2[5][j]-5*y2[3][j]+10*y2[1][j]-10*y1[1][j]+5*y1[3][j]-y1[5][j]);
a6[j]=Math.pow(s,6)*(y2[6][j]-6*y2[4][j]+15*y2[2][j]-20*y2[0][j]+15*y1[2][j]-6*y1[4][j]+y1[6][j]);
a7[j]=Math.pow(s,7)*(y2[7][j]-7*y2[5][j]+21*y2[3][j]-35*y2[1][j]+35*y1[1][j]-21*y1[3][j]+7*y1[5][j]-y1[7][j]);
a8[j]=Math.pow(s,8)*(y2[8][j]-8*y2[6][j]+28*y2[4][j]-56*y2[2][j]+70*y2[0][j]-56*y1[2][j]+28*y1[4][j]-8*y1[6][j]+y1[8][j]);
a9[j]=Math.pow(s,9)*(y2[9][j]-9*y2[7][j]+36*y2[5][j]-84*y2[3][j]+126*y2[1][j]-126*y1[1][j]+84*y1[3][j]-36*y1[5][j]+9*y1[7][j]-y1[9][j]);
Code for calculating the Taylor approximations
T0[j]=a0;
T1[j]=T0[j]+Math.pow(x-x0,1)*a1/(1);
T2[j]=T1[j]+Math.pow(x-x0,2)*a2/(1*2);
T3[j]=T2[j]+Math.pow(x-x0,3)*a3/(1*2*3);
T4[j]=T3[j]+Math.pow(x-x0,4)*a4/(1*2*3*4);
T5[j]=T4[j]+Math.pow(x-x0,5)*a5/(1*2*3*4*5);
T6[j]=T5[j]+Math.pow(x-x0,6)*a6/(1*2*3*4*5*6);
T7[j]=T6[j]+Math.pow(x-x0,7)*a7/(1*2*3*4*5*6*7);
T8[j]=T7[j]+Math.pow(x-x0,8)*a8/(1*2*3*4*5*6*7*8);
T9[j]=T8[j]+Math.pow(x-x0,9)*a9/(1*2*3*4*5*6*7*8*9);
The integers in the formulas of the derivatives follow simple generation rules; thus the series can be easily generated or continued.
E1:
- The zero order approximation assumes that the value in the model point is true for the whole interval.
- The first order considers the local steepness of the function curve.
- The second derivative considers the local change in steepness = curvature.
- The third derivative considers the local change in curvature = ?
- The fourth derivative considers the local change in the change of curvature = ??
- ...and so on.
Try to understand what the higher derivatives mean, as applied to the Taylor approximation of a function.
E2: Do that for the sine function. Why does the 4th approximation not look like the base function itself? (the 4th derivative alone is identical to it).
E3: Go through the approximations of the power function: What type of polynom is each one? (Write them down, using the factors in the number fields). Check that 7th to 9th are identical (tiny differences recognizable are calculation errors). Compare the 7th order polynoms around different model points and argue their identity. Look at the one for x_{0} = 0.
E4: Experiment with all base functions. Consider why and when a linear approximation, which is easy to handle analytically, is good enough. Take a look at the sequence factors.
This simulation was created in May 2010 by Dieter Roess
This simulation is part of
“Learning and Teaching Mathematics using Simulations
– Plus 2000 Examples from Physics”
ISBN 978-3-11-025005-3, Walter de Gruyter GmbH & Co. KG
For Teachers
Translations
Code | Language | Translator | Run | |
---|---|---|---|---|
Software Requirements
Android | iOS | Windows | MacOS | |
with best with | Chrome | Chrome | Chrome | Chrome |
support full-screen? | Yes. Chrome/Opera No. Firefox/ Samsung Internet | Not yet | Yes | Yes |
cannot work on | some mobile browser that don't understand JavaScript such as..... | cannot work on Internet Explorer 9 and below |
Credits
Dieter Roess - WEH- Foundation; Tan Wei Chiong; Loo Kang Wee
end faq
Sample Learning Goals
[text]
For Teachers
The Taylor Series is a generalised polynomial approximation to a function, centered around x = a, for any real number a.
In this simulation, you can choose a function to approximate with the Taylor Series from the combo box provided. However, this is technically not a series, as the terms do not go indefinitely.
Beside the combo box for selecting the function, there is a set of 10 checkboxes, each of them corresponding to a certain degree of approximation. The degree of the polynomial approximation is shown by the number beside the checkbox. When each box is checked, the graph of the polynomial corresponding to the degree denoted by the checkbox is made visible; unchecking it will make it invisible.
The available functions are as follows:
- Gaussian: y = e^-(x^2)
- y = sin(x)
- y = sin(x)^2
- y = sin(x)/x
- sin(x)/x Quadratic: y = [sin(x)/x]^2
- y = x^7
- y = e^x
At the top of the simulation, the full 9th degree polynomial approximation for the function at the point denoted by the square in the graph is shown, and will automatically change when the point is moved. Likewise, the graphs of the different polynomial approximations will also adjust accordingly.
Research
[text]
Video
[text]
Version:
- http://weelookang.blogspot.sg/2016/02/vector-addition-b-c-model-with.html improved version with joseph chua's inputs
- http://weelookang.blogspot.sg/2014/10/vector-addition-model.html original simulation by lookang
Other Resources
[text]