Polynomial

The built-in function poly is a polynomial, which has a public parameter coeff. The default value of coeff is , so that poly(x) = 1 regardless of x. To make a nontrivial polynomial, one needs to reset the value of poly.coeff
>> global.poly.coeff = [1, 2, -2];
or spawn a new function like this
>> p = poly;  // making a copy of poly
>> p.coeff = [1, 2, -1];
or
>> p = poly[[1, 2, -2]];
Now p is a polynomial . p can be called like a normal function
>> p = poly[[1, 2, -2]];
>> p(100)
   -9799



oz 2009-12-22