Home | 18.013A | Chapter 2 | Section 2.3 | | Tools Glossary Index Up Previous Next

Exercise 2.12

Set up a spreadsheet to compute the sin ⁡ x for any inputted x . How many terms in the sin ⁡ x power series expansion do you need to evaluate sin ⁡ .5 to 8 decimal places?

Solution:

The power series expansion of sin ⁡ x consists of the odd power terms in the expansion of exp ⁡ x , with alternating signs,

sin ⁡ x = x − x 3 3 ! + x 5 5 ! − ⋯

We can set up a spreadsheet to compute it in many ways, and here is one.

We will do almost the same thing as done for exp ⁡ x in column A we will put j ; and j will start at 1 and go up by 2 in each successive row. We will put x in the first row of column B and − x 2 in successive rows, and multiply previous C entry by entry in B and divide by entry in A and by entry in A, minus 1.

We will get the following formulae in the spreadsheet

x | 0.5 | sin ⁡ x |
1 | =B1 | =A2*B2 | =D1+C2
=A2+2 | =-B2*B2 | =C2*B3/A3/(A3-1) | =D2+C3
=A3+2 | =B3 | =C3*B4/A4/(A4-1) | =D3+C4
=A4+2 | =B4 | =C4*B5/A5/(A5-1) | =D4+C5
=A5+2 | =B5 | =C5*B6/A6/(A6-1) | =D5+C6
=A6+2 | =B6 | =C6*B7/A7/(A7-1) | =D6+C7
=A7+2 | =B7 | =C7*B8/A8/(A8-1) | =D7+C8
=A8+2 | =B8 | =C8*B9/A9/(A9-1) | =D8+C9
=A9+2 | =B9 | =C9*B10/A10/(A10-1) | =D9+C10
=A10+2 | =B10 | =C10*B11/A11/(A11-1) | =D10+C11
=A11+2 | =B11 | =C11*B12/A12/(A12-1) | =D11+C12
=A12+2 | =B12 | =C12*B13/A13/(A13-1) | =D12+C13
=A13+2 | =B13 | =C13*B14/A14/(A14-1) | =D13+C14
=A14+2 | =B14 | =C14*B15/A15/(A15-1) | =D14+C15
=A15+2 | =B15 | =C15*B16/A16/(A16-1) | =D15+C16
=A16+2 | =B16 | =C16*B17/A17/(A17-1) | =D16+C17
=A17+2 | =B17 | =C17*B18/A18/(A18-1) | =D17+C18
=A18+2 | =B18 | =C18*B19/A19/(A19-1) | =D18+C19
=A19+2 | =B19 | =C19*B20/A20/(A20-1) | =D19+C20
=A20+2 | =B20 | =C20*B21/A21/(A21-1) | =D20+C21
=A21+2 | =B21 | =C21*B22/A22/(A22-1) | =D21+C22

The numerical results will be

x | 0.5 | sin ⁡ x |
1 | 0.5 | 0.5 | 0.5
3 | -0.25 | -0.0208333 | 0.479166667
5 | -0.25 | 0.0002604 | 0.479427083
7 | -0.25 | -1.55E-06 | 0.479425533
9 | -0.25 | 5.382E-09 | 0.479425539
11 | -0.25 | -1.223E-11 | 0.479425539
13 | -0.25 | 1.96E-14 | 0.479425539
15 | -0.25 | -2.334E-17 | 0.479425539
17 | -0.25 | 2.145E-20 | 0.479425539
19 | -0.25 | -1.568E-23 | 0.479425539

You can see that the first 4 terms by themselves give sin ⁡ .5 correctly to 8 decimal places.

Up Previous Next