MathGroup Archive 1995

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Shortening Polynomials


 "Corcoran" == Stephen Corcoran <corcoran> writes:

    Corcoran> Dear Mathgroupers,

    Corcoran> Is there a neater way to collect powers up to order m after
    Corcoran> expanding a polynomial?

Define a function f by:

f[poly_, q_, m_] := Take[CoefficientList[poly, q], m+1] . (q^Range[0, m])

Then, for example,

In[10]:= poly = q^5 + q^7 + 8 q^2 + 9999 q^10;m = 5;

In[11]:= f[poly, q, m]

             2    5
Out[11]= 8 q  + q
_____________________________________________________________________________
 Levent Kitis           lk3a at cars.mech.virginia.edu    lk3a at kelvin.seas.virginia.edu
 University of Virginia  Department of Mechanical, Aerospace and Nuclear Engineering  
 ____________________________________________________________________________



  • Prev by Date: Orientation of tick labels
  • Next by Date: Re: Shortening Polynomials
  • Previous by thread: Shortening Polynomials
  • Next by thread: Re: Shortening Polynomials