Re: Re: POLEZERO plots
- To: mathgroup at smc.vnet.net
- Subject: [mg19168] Re: [mg19069] Re: POLEZERO plots
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Thu, 5 Aug 1999 23:59:10 -0400
- References: <7o5ilf$rmr@smc.vnet.net> <199908050534.BAA03328@smc.vnet.net.>
- Sender: owner-wri-mathgroup at wolfram.com
"P.J. Hinton" wrote: > > On 2 Aug 1999, John Cogill wrote: > ... > > My Mathematica 4 complains "ivar .. " until I change the zeros to ones > > in both cases. > > > > I feel I must be missing something. > > The problem is with the author's use of the Coefficient[] function, with > which the "ivar" tag is associated. Mathematica does not allow you to > invoke Coefficient[] with an integer (1). > > If you rewrite the assignments for ncoeff and dcoeff so that they use > CoefficientList[] > > OLD: > > ncoeff = Table[ > Re[Coefficient[numerator,z^k]],{k,0,Length[zeros]}]; > > NEW: > > ncoeff = Map[Re, CoefficientList[numerator,z]]; > ... > > The code works fine. > ... > P.J. Hinton > Mathematica Programming Group paulh at wolfram.com > Wolfram Research, Inc. As noted, CoefficientList is nowadays preferable to use in the situation indicated above. All the same I thought I'd indicate how to make Coefficient work because there are other situations in which CoefficientList is too expensive or not usable. For example, suppose you want a bunch of coefficients including that for the zeroeth order term, and the expression will not allow for use of CoefficientList because it is not a polynomial in the given variable. Or maybe you don't want all the coefficients of a large polynomial, so CoefficientList would be too slow. In such cases you might use the three-argument form of Coefficient, which does not have a problem with an exponent of zero. In[12]:= ee = 1+2*x+3*x^2; In[13]:= Table[Coefficient[ee, x, k], {k, 0, 2}] Out[13]= {1, 2, 3} Daniel Lichtblau Wolfram Research
- References:
- Re: POLEZERO plots
- From: "P.J. Hinton" <paulh@wolfram.com>
- Re: POLEZERO plots