Question: 1 ) Write a program that repeatedly evaluates a n - th order polynomial p ( x ) = a 0 + a 1 *

1) Write a program that repeatedly evaluates a n-th order polynomial p(x)= a0+ a1*x + a2*x^2+...+ an*x^n where n <=10 The program inputs n, ai, and x from the keyboard and then prints out the corresponding value of p to the screen. The program continues to input new values of n, ai, x and evaluates p until a negative value for n is input, at which point the program stops.
2)Write a program that calculates exp(x) using the Taylor series approximation exp_approx =1+ x + x^2/2!+ x^3/3!+... where x and error are input from the keyboard and a sufficient number of series terms are used such that abs( exp_approx - exp(x))< error. Hint: Use *= in a loop to calculate x^i and i! and print them out to the screen to verify that your loop is correct before calculating the series approximation.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!