home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / misc / icalc.lha / ICalc / Scripts / poly.ic < prev    next >
Encoding:
Text File  |  1992-08-03  |  359 b   |  17 lines

  1. # This routine evaluates polynomials p of degree m.
  2. # Coefficients of polynomial are stored in an array of size m+1, say c, s.t.
  3. #
  4. #    p(x) = c[1] + c[2]*x + c[3]*x^2 + ... + c[m+1]*x^m
  5. #
  6. # nb: routines assume array base is 1
  7. # mws, February 1992
  8.  
  9. func epoly(@c, x) = {
  10.     local n,j,ss
  11.     n = sizeof(c)
  12.  
  13.     ss = c[n]
  14.     for (j = n-1; j >= 1; j -= 1)
  15.         ss = ss*x+c[j]
  16. }
  17.