Re: List Manipulation
- To: mathgroup at smc.vnet.net
- Subject: [mg72411] Re: [mg72407] List Manipulation
- From: "Adriano Pascoletti" <pascolet at dimi.uniud.it>
- Date: Wed, 27 Dec 2006 05:02:58 -0500 (EST)
Stratocaster wrote ..
> I'm not sure if the following is possible or whether it exists somewhere
> between the realms of fantasy and science fiction. I have been unable
> to do
> it.
>
> Given a list, set, vector (whatever you want to call it) consisting of
> functions of the same variable, i.e.
>
> list = {a1+b1*k, a2+b2*k, a3+b3*k...}
>
> Assuming they are all linear (of the form a+b*k) is there away to isolate
> the a_i and b_i values? Essentially I would like to get a list "A"
> consisting of all the intercept values, and a list "B" consisting of all
> the
> slope values.
>
> Is this possible? What kind of operations do I need to use to accomplish
> this (if indeed it is possible)?
>
> Thanks for any insights.
In[1]:=
list = {a1+b1*k, a2+b2*k, a3+b3*k,a4+b4*k};
In[2]:=
A=list/.k\[Rule]0
Out[2]=
{a1,a2,a3,a4}
In[3]:=
B=(list/.k\[Rule]1) -A
Out[3]=
{b1,b2,b3,b4}
Adriano Pascoletti