Evaluates a polynomial (either a poly or a vector) at a number //------------------------------------------------------------ // Function: evalpoly - evalutes a polynomial at a given value // // Input: p - a polynomial or a vector with coeff (a0, a1, a2,..) // x - a number // Output: r - the value of the polynomial evaluated at x //------------------------------------------------------------

Scilab script

Upload date : 2011-03-20 21:08:04 MD5 : 55d352fd93070d0380d3efdc83237052 SHA1 : 646cd1bb8db729e30d3e79afc09af27aebe4576d Downloads : 774

Hi David, Did you compare evalpoly() to the existing horner() embedded function? Regards Samuel

1. The Horner function was hard enough to find because of its bizarrely cryptic name 2. I didn't like the coding in the horner function, I wanted a function that did exactly what I needed. 3. What does the file exchange have to do with current Scilab functions - nothing.

Hi; I see a little wrong in your coding. In line 25, the variable "p" must be substituted with "C" and then move this expression after the last END. Correct: [...] // n = size(p,"*") // remove from here C = p; end n = size(C,"*") // add to this line v = C.*x^(0:(n-1)) [...] Thanks, Mehran