Scilab Home Page | Wiki | Bug Tracker | Forge | Mailing List Archives | Scilab Online Help | ATOMS
File : Details
Please login or create an account
Dear visitors/customers, we are migrating most of Scilab services into a new data center.
Note that login/registration will not be available for the moment.

Evaluate polynomial

Evaluates a polynomial (either a poly or a vector) at a number
(787 downloads for this version - 787 downloads for all versions)
Details
Version
1.0
Author
david adams
Maintainer
David Adams
Category
License
Supported Scilab Version
5.3
Creation Date
March 20, 2011
Description
            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
//------------------------------------------------------------

            
Files (1)
[800 bytes]
Miscellaneous file
Scilab script
News (0)
Comments (3)     Leave a comment 
Comment from Samuel Gougeon -- March 22, 2011, 09:36:50 PM    
Hi David,
Did you compare evalpoly() to the existing horner() embedded function?
Regards
Samuel
Comment from David Adams -- March 22, 2011, 09:39:51 PM    
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.
Comment from A. Khorshidi -- July 10, 2013, 12:17:08 PM    
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
Leave a comment
You must register and log in before leaving a comment.
Email notifications
Send me email when this toolbox has changes, new files or a new release.
You must register and log in before setting up notifications.