Question

Horner: Given the coefficients of a polynomial a0, a1, . . . , an, and a...

Horner: Given the coefficients of a polynomial a0, a1, . . . , an, and a real number x0, find P(x0), P′ (x0), P′′(x0), P(3)(x0), . . . , P(n) (x0) Sample input representing P(x) = 2 + 3x−x 2 + 2x 3 , x0 = 3.5:

3

2

3

-1

2

3.5

the first number is the degree of the polynomial (n), the coefficients are in order a0, a1, . . . , an, the last number is x0.

Note: dont use polyder and input read from txt file.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

ANSWER :

clc%clears screen
clear all%clears history
close all%closes all files
format long
func(3,[2,3,-1,2],3.5)


function func(n,C,x0)
C=C(end:-1:1);
for i=0:n
s=0;
for j=1:length(C)
s=s*x0+C(j);
end
fprintf('P%d(x0)=%f\n',i,s);
C=polyder(C);
end
end

Add a comment
Know the answer?
Add Answer to:
Horner: Given the coefficients of a polynomial a0, a1, . . . , an, and a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT