Satimage Previous | Next
Working with polynomials
Home Documentation Smile Computing Smile's maths Working with polynomials  

The polynomial class is for working with polynomials. A polynomial works mostly like an array of real. To convert a list of real numbers or an array of real into a polynomial, use as polynomial. To convert a polynomial into an array of real, use as array of real.
Furthermore, as string converts a polynomial into an expression suitable where a formula is expected such as with the curves or with the evalformula command.

  • evalpolynomial evaluates a polynomial for a given value of the variable.
  • addlist, sublist, multlist et divlist perform additions, subtractions, products, and (Euclidean) divisions on polynomials.
  • composepolynomial given P and Q, returns R given by R(X) = P( Q(X) ).

set p to {1, 2, 3} as polynomial
set q to {0, 1, 1} as polynomial
set r1 to addlist p with q
r1 as string
  --  "1+3*x+4*x^2"
set r2 to composepolynomial r1 with q
set x1 to evalpolynomial r1 at (evalpolynomial q at 3.14)
  --  715.95720064
set x2 to evalpolynomial r2 at 3.14
  --  715.95720064


Import script
Version française
Copyright ©2008 Paris, Satimage