
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

Polynomials
Consider the nth-order polynomial
Pn(x) = a 0 + a 1 x + a 2 x^2 + ... + anxn
C Write a FORTRAN 90 MODULE containing a single FUNCTION subpro- gram that returns the value of Pn(x) given the arguments n, x and ~a, where ~a is an n + 1 vector containing the coefficients ai. Use Horner’s algorithm (that is, Alg. 1.1, for evaluating polynomials in nested form). Compile.
C Write a main program that uses your function subprogram above to Evaluate P 4 (x) for the 4th-order polynomial P 4 (x) = 4 + 3 x + x^3 − 2 x^4. “Hardwire” n = 4 and specify the coefficients in the main program by the use of an array constant. Read in the value of x. Compile and run your main program for the values x = 1 ., x = 0 ., and x = 2 ..
B Download poly5.mw (a Maple worksheet) from Blackboard (ASSIGNMENTS) to your Desktop. Run the Maple worksheet, which will build up the Taylor polynomial expansion of exp(x) (about a = 0) one term at a time. What is the 5th-order Taylor polynomial approximation of exp(x)? Comment on the qualitative (graphical) behavior of the approximations as the order of the Taylor polynomial increases.
A Recall from early in the semester that converting integers from base b to base 10 is equivalent to evaluating a polynomial. For example, ( 3754 ) 8 = 4 + 5 ( 8 ) + 7 ( 8 )^2 + 3 ( 8 )^3. Modify your MODULE by changing the REAL declarations to INTEGER, recompile, and then modify your main program above to perform base b to base 10 integer conversions. Assign INTE- GER coefficients ai by a decrementing READ loop; that is, read n, followed by the n + 1 coefficients, one at a time and in reverse order (highest order first). Also read the base b. Compile and run your program to evaluate ( 1100011101 ) 2.
A+ Modify the Maple worksheet above to compute the 6th-order Taylor poly- nomial approximation of exp(x).