[Date Index]
[Thread Index]
[Author Index]
Re: Converting set of equations to matrix
*To*: mathgroup at smc.vnet.net
*Subject*: [mg26728] Re: Converting set of equations to matrix
*From*: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
*Date*: Fri, 19 Jan 2001 02:14:06 -0500 (EST)
*Organization*: Universitaet Leipzig
*References*: <9462b7$gc8@smc.vnet.net>
*Sender*: owner-wri-mathgroup at wolfram.com
Hi,
a) your equations will never yield the matrix you give
b)
In[]:=eqn = {3 a[0, 0] + 2 a[0, 2] + 4 a[2, 0] == 0,
-1 a[0, 0] + 0.3 a[2, 0] == 0,
4 a[0, 2] - 1 a[2, 0] == 0}
In[]:=Outer[D, First /@ eqn, {a[0, 0], a[0, 2], a[2, 0]}]
gives the matrix. It may be useful for general equations to use
Outer[D, First /@ (eqn /. q_==r_ :> q-r==0), {a[0, 0], a[0, 2], a[2,
0]}]
Regards
Jens
Helge Kreutzmann wrote:
>
> Hello !
> I have a set of equations I create following some rules, like
>
> 3 a[0,0] + 2 a[0,2] + 4 a[2,0] = 0
> -1 a[0,0] + 0.3 a[2,0] = 0
> 4 a[0,2] - 1 a[0,2] = 0
>
> The numbers of coefficients (the a[i,j]) is different in each run
> but fixed. For further calculations I would like to transform the
> above equations into the matrix
> {{3,2,4 },{-1,0,0.3},{0,4,-1}}
>
> Currently I have a list (called coeffli) where I can get the equations
> from. The existing coefficients are stored in a second list (klist).
> I also have a list where the values i,j are stored (cplist).
>
> The above list I would create by
> For[i = 1, i <= Length[kflist], i++,
> Print[Collect[coeffli[[cplist[[i]][[1]]]][[cplist[[i]][[2]]]], klist]]]
>
> I can create a list of the equations but I do not know how to tear
> apart the sum into matrix elements.
>
> Thanks
>
> Helge
Prev by Date:
**Re: Converting set of equations to matrix**
Next by Date:
**Re: Multiple choice question**
Previous by thread:
**Re: Converting set of equations to matrix**
Next by thread:
**Re: Converting set of equations to matrix**
| |