MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   Horner's algorithm using matrices (https://www.labfans.com/bbs/showthread.php?t=22163)

poster 2019-11-26 21:01

Horner's algorithm using matrices
 
<p>I am working o this question but I am having some difficulties as this is my first year of doing any type of programming</p>

<p>Write a non-recursive function HornerSimple which evaluates a polynomial p(x) using the Horner algorithm. The function should return the value of the polynomial for a given x and coefficient list a. It should be passed the following two arguments in exactly this order, i.e. it should be called as HornerSimple(a,x):
a : The list a = [a0, a1, . . . , an] of integer coefficients. Note that Matlab starts counting at 1, i.e. a(1) stores a0, a(2) stores a1 and so on; a contains n + 1 entries.
x : The integer number or a square matrix with integer entries at which the polynomial is evaluated.</p>

<p>The function HornerSimple should also work in the special case when the list a=[] is empty. In this case it
should return a zero matrix of the same size as x (and the 1 × 1 matrix [0] if x is a number).</p>

<p>[This is my code so far but I get error when I test it and I do not know how to change it to make it correct<a href="https://i.stack.imgur.com/Q4Xa1.png" rel="nofollow noreferrer">1</a></p>



[url=https://stackoverflow.com/questions/59051497/horners-algorithm-using-matrices]More answer...[/url]


所有时间均为北京时间。现在的时间是 19:48

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.