Re: Beginner--[Please Help]How to get coefficient list issued from a Series Command
- To: mathgroup at smc.vnet.net
- Subject: [mg70186] Re: Beginner--[Please Help]How to get coefficient list issued from a Series Command
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Sat, 7 Oct 2006 07:06:55 -0400 (EDT)
- Organization: The University of Western Australia
- References: <eg2e8k$73m$1@smc.vnet.net> <eg4rm4$f9b$1@smc.vnet.net>
In article <eg4rm4$f9b$1 at smc.vnet.net>, albert <awnl at arcor.de> wrote:
> abdou.oumaima at hotmail.com wrote:
>
> > Greeting,
> >
> > I've a list issued from power series like : K={a1+b1 x +c1 x^2 , a2+b2 x
> > +c2 x^2, a3+b3 x +c3 x^2} I need te have a1, a2 and a3.
> > Then b1,b2 and b3.
> > And c1,c2 and c3.
>
> This gives all coefficients:
>
> In[7]:= coeffs = Map[CoefficientList[#,x]&,K]
> Out[7]=
> {{a1, b1, c1}, {a2, b2, c2}, {a3, b3, c3}}
>
> Transpose the resulting matrix to get the coefficients in the form you
> indicated:
>
> In[8]:= Transpose[coeffs]
> Out[8]=
> {{a1, a2, a3}, {b1, b2, b3}, {c1, c2, c3}}
> > I need to use all those coefficients in a Sum Command. How to do that
> > please?
>
> I don't understand what you want to do, if you want to add all coefficients
> for the same power of x you could do:
>
> In[9]:= Map[Total,Transpose[coeffs]]
> Out[9]=
> {a1 + a2 + a3, b1 + b2 + b3, c1 + c2 + c3}
There is no need to use Map or Transpose. Just use CoefficientList:
k = {a1 + b1 x + c1 x^2, a2 + b2 x + c2 x^2, a3 + b3 x + c3 x^2};
CoefficientList[k, x]
{{a1, b1, c1}, {a2, b2, c2}, {a3, b3, c3}}
Total[%]
{a1 + a2 + a3, b1 + b2 + b3, c1 + c2 + c3}
Cheers,
Paul
_______________________________________________________________________
Paul Abbott Phone: 61 8 6488 2734
School of Physics, M013 Fax: +61 8 6488 1014
The University of Western Australia (CRICOS Provider No 00126G)
AUSTRALIA http://physics.uwa.edu.au/~paul