Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MatLab: Help needed writing about a MatLab program. Evaluating a polynomial can

ID: 3768407 • Letter: M

Question

MatLab: Help needed writing about a MatLab program.

Evaluating a polynomial can be an "expensive" thing for a computer. The "cheapest" way to evaluate a polynomial is to use a recursive algorithm. For example if p_4(x) = 3 - 2x + x^2 - 5x^3 + x^4, begin by rewriting it in a modified expanded form as follows: p_4(x) = 3 + x(-2 + x(1 + x(-5 + x))) Then p_4(x) = 3 + xp_3(x), where p_3(x) = -2 + xp_2(x), p_2(x) = 1 + xp_1(x), and p_1(x) = -5 + x. To evaluate P_4(2) we calculate as follows: Write a recursive program to calculate the value of any polynomial function given a list of its coefficients (in ascending order) and a value of x.

Explanation / Answer

I calculated the value of any polynomial function using recusive algorithm based on Horner rule for polynomial. Here is the given below its input and output respectively.

Output