TAYLOR SERIES
This paper was inspired by the question: "How do you find the numerical value of sin(32) from first principles?"
One answer is "One uses the Taylor Series."
It isn't a good answer beacause that's hardly "from first principles". But on the other hand, it's a better answer than nothing.
This paper attempts to demonstrate the application of the Taylor Series to calculate sin(32).
It is assumed that the reader is able to determine the numerical value of the first, second, third, etc. derivatives of f(x). For example, the reader must understand how the following tables were constructed:
f(x) = x^3/5
|
x |
f(x) |
f'(x) |
f''(x) |
f'''(x) |
|
-2.0000 |
-1.6000 |
2.4000 |
-2.4000 |
1.2000 |
|
-1.6000 |
-0.8192 |
1.5360 |
-1.9200 |
1.2000 |
|
-1.2000 |
-0.3456 |
0.8640 |
-1.4400 |
1.2000 |
|
-0.8000 |
-0.1024 |
0.3840 |
-0.9600 |
1.2000 |
|
-0.4000 |
-0.0128 |
0.0960 |
-0.4800 |
1.2000 |
f(x) = sin(x)
|
x(deg) |
x(rad) |
f(x) |
f'(x) |
f'' (x) |
|
0 |
0 = 0.0000 |
0.0000 |
1.0000 |
0.0000 |
|
30 |
pi/6 = 0.5236 |
0.5000 |
0.0150 |
0.000 |
|
45 |
pi/4 = 0.7854 |
0.7071 |
-0.7071 |
-0.7071 |
|
60 |
pi/3 = 0.8660 |
0.8660 |
0.0087 |
0.0000 |
|
90 |
pi/2 = 1.5708 |
1.0000 |
0.0000 |
-1.0000 |
This topic was covered in my article on Numerical Calculus.
The Taylor Series May be used to find the numerical values of functions.
Here it is:
f(x) = f(c) +
(d1f(c)*(x - c)^1)/1!
+ (d2f(c)*(x - c)^2)/2!
+ (d3f(c)*(x - c)^3)/3! + etc.
where d1f(x) denotes the derivative of f(x) and d2f(x) denotes the second derivative of f(x) and so on,
and c is "a slightly different value from x".
An unimpressive example:
f(x) = 2*x^3 - 5*x^2 + 3*x - 7
Suppose we know that:
f(2) =
2*(2)^3 - 5*(2)^2 + 3*2 - 7
= 2*8 - 5*4 + 6 - 7
= 16 - 20 + 6 - 7
= -5
and we needed to know what the value of f(2.3) is.
The easy to find the answer:
f(2.3) =
2*(2.3)^3 - 5*(2.3)^2 + 3*2.3 - 7
= 2*12.167 - 5*5.29 + 6.9 - 7
= 24.334 - 26.45 + 6.9 - 7
= -2.216
But why do things the easy way when we can use the Taylor Series to do things the hard way?
The Taylor expansion:
(1) f(x) =
f(c) + (d1f(c)*(x - c)^1)/1!
+ (d2f(c)*(x - c)^2)/n!
+ (d3f(c)*(x - c)^3)/3!
+ etc.
is used to evaluate
f(x) = 2*x^3 - 5*x^2 + 3*x - 7
for
f(2.3) = ?
where we know that
f(2) = -5
In this example:
x = 2
and
c = 2.3
and
d1f(2) =
6*(2)^2 - 10*2 + 3
= 24 - 20 + 3
= 7
also
d2f(2) = 12*2
- 10 = 24 - 10
= 14
and, finally
d3(2) = 12
The rest are:
d4(2) = 0
d5(2) = 0 etc.
Therefore:
f(2.3) = -5 +
(7*(0.3)^1)/1
+ (14*(0.3)^2)/2
+ (12*(0.3)^3)/(3*2)
+ (0 *(0.3)^4)/(4*3*2)
= -5 + (7*0.3)/1
+ (14*0.09)/2
+ (12*0.027)/6
+ (0 *0.064)/24
= -5 + 2.1/1
+ 1.260/2
+ 0.324/6
+ 0/24
= -5 + 2.1 + 0.63 + 0.054 + 0
= -2.216
It worked out perfectly!
Now let us apply the
same approach to find sin(32)
f(x) = sin(x)
We know that
f(30) = 0.5
So
f(32) = f(30)
+ d1f(30) * (32 - 30)^1/1!
+ (d2f(30)*(32 - 30)/2!
+ (d3f(30) * (32 - 30)/3!
etc
= 0.5 + 0.0150 * (32 - 30)^2/2!
+ 0 * (32 -30)^3/3!
....
= 0.5 + 0.0150 * 2 + 0
.....
= 0.5 + 0.30
= 0.53
So there! :-)