Scilab Home Page | Wiki | Bug Tracker | Forge | Mailing List Archives | Scilab Online Help | ATOMS
File : Details

# Evaluate polynomial

Evaluates a polynomial (either a poly or a vector) at a number
(1872 downloads for this version - 1872 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)
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.
Login with
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.