This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Topic: Recursive and difference functions Due: Thurs. Feb. 18 by the beginning of class (please email your code to firstname.lastname@example.org ) Assignment 1. Write a recursive function to compute and return the value of the factorial of a number n : n ! =n(n-1)(n-2)(n-4) and 0!! = 1. 2. Write a function to compute the Taylor series expansion of the sin(x) function to an arbitrary order N. The expansion is sin( x ) x x 3 3! + x 5 5! x 7 7! + ... x N N ! . Pick a value for x and compute the difference between sin( x ) and the expansion for a range of N values (say 3, 7, 11, 21). Make a plot of the error (difference) vs value of N. Make a second plot of the sin( x ) and each of the expansion over the domain x = [- , ]....
View Full Document
This note was uploaded on 10/05/2010 for the course PHYS phy503 taught by Professor Gladden during the Spring '09 term at Ole Miss.
- Spring '09