Assignment #2 - 92A
Assignment #2 - 92A
Assignment 2 Weight 25
============ Due: Jan 30
TA: Rekletis
E-Mail your solution to HQAB
The square of the sine function can be represented by the following:
2 2 3 4 5 6
SIN X = X - 2 x + 2 X - ...
--- ---
4! 6!
In the general case:
00
----- (n+1) (2n-1) 2n
\ (-1) 2 x
/ ------------------------
----- (2n)! I.E. FACTORIAL(2n)
n=1
That is the sum with n going from 1 to infinity of the terms above.
Write a FORTRAN program to evaluate this series for an input value of x.
Printing the results after 2, 4, 6, 8, 10, 12 and 14 terms and
comparing the true solution (using the built-in function SIN(x)).
The output should have following form:
comparision of values SINE squared
value is X=...
NUMBER of SERIES INTRINSIC ABSOLUTE
TERMS SUMMATION FUNCTION DIFFERENCE
2 ... ... ...
4 ... ... ...
6 ... ... ...
8 ... ... ...
10 ... ... ...
12 ... ... ...
14 ... ... ...
Repeat this table for three different values of X.