Mercurial > hg > octave-nkf
view examples/@polynomial/polynomial.m @ 10480:19e1e4470e01
remove old sparse assembly ctors
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 31 Mar 2010 10:24:57 +0200 |
parents | 567e3e4ab74d |
children | 050bc580cb60 |
line wrap: on
line source
## -*- texinfo -*- ## @deftypefn {Function File} {} polynomial () ## @deftypefnx {Function File} {} polynomial (@var{a}) ## Creates a polynomial object representing the polynomial ## ## @example ## a0 + a1 * x + a2 * x^2 + @dots{} + an * x^n ## @end example ## ## from a vector of coefficients [a0 a1 a2 ... an]. ## @end deftypefn function p = polynomial (a) if (nargin == 0) p.poly = [0]; p = class (p, "polynomial"); elseif (nargin == 1) if (strcmp (class (a), "polynomial")) p = a; elseif (isvector (a) && isreal (a)) p.poly = a(:).'; p = class (p, "polynomial"); else error ("polynomial: expecting real vector"); endif else print_usage (); endif endfunction