Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Show how to evaluate the polynomial P(x) = 7x^25 -x^20 +4x^15 -x^10 +3x^5 using as few arithmetic operations as possible. How many multiplications and how

Show how to evaluate the polynomial P(x) = 7x^25 -x^20 +4x^15 -x^10 +3x^5 using as few arithmetic operations as possible. How many multiplications and how many additions are needed in your method?

Where indicated below, write a script that calls the function nest to help evaluate P(2), using the results to minimize the numbr of computations.

Matlab code:

format long e

%define any necessary variables before calling nest() below

%let d be the appropriate degree used in nest()

%let c be the vector of coefficients used in nest()

%let z be the value at which the polynomial in nest() is evaluated

%let ynest be the output of nest()

%let yfinal be the final value of P(-2) (not necessarily the output of nest())

%check by evaluating the poly. the "old fashioned way," i.e., using y = a_n*x^n + a_(n-1)*x^(n-1) +...+ a_1*x + a_0

%Let y be the value of this polynomial

%Program 0.1 Nested multiplication

%Evaluates polynomial from nested form using Horner's method

%Input: degree d of polynomial,

% array of d+1 coefficients (constant term first),

% x-coordinate x at which to evaluate, and

% array of d base points b, if needed

%Output: value y of polynomial at x

function y=nest(d,c,x,b)

if nargin<4, b=zeros(d,1); end

y=c(d+1);

for i=d:-1:1

y = y.*(x-b(i))+c(i);

end

end

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

How are target shareholders affected by a hostile takeover attempt?

Answered: 1 week ago

Question

=+2. Do they use a similar tone of voice and point of view?

Answered: 1 week ago

Question

=+ Are they breakable for any reason?

Answered: 1 week ago