Re: Displaying Solution in Matrix Form
- To: mathgroup at smc.vnet.net
- Subject: [mg61406] Re: Displaying Solution in Matrix Form
- From: "mathematica newbie" <sheeba.arnold at gmail.com>
- Date: Tue, 18 Oct 2005 02:44:54 -0400 (EDT)
- References: <diskq0$m9f$1@smc.vnet.net><divgkj$g2d$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Thank you very much for the reply! I'm still confused as to how this works if i and j are suffixes. i.e., The equations are of the form fi,j (i and j are written as subscripts of f) Steve Luttrell wrote: > This does what you want (using a randomly generated example): > > variables=Flatten[Table[f[i,j],{i,3},{j,4}]]; > matrix=Table[Random[Real,{-1,1}],{12},{12}]; > vector=Table[Random[Real,{-1,1}],{12}]; > equations=MapThread[#1==#2&,{matrix.variables,vector}] > solution=NSolve[equations,variables] > Partition[variables,4]//TableForm > Partition[variables/.solution[[1]],4]//TableForm > > The solution is in the form of a set of replacement rules for the variables. > You use the variables /.solution construct to apply these rules to the > variables, and then use Partition to split the vector of solutions into a > matrix, which you then display using TableForm (you could use MatrixForm if > you want brackets drawn round the table). > > Steve Luttrell > > "mathematica newbie" <sheeba.arnold at gmail.com> wrote in message > news:diskq0$m9f$1 at smc.vnet.net... > > Hi, > > > > I have the 12 linear algebraic equations. > > The solutions are denoted by Fi, j's. > > F1,1 , F1,2, F1,3, F1,4, > > F2,1, F2,2 etc......through F3,4 > > > > I have solved the equations with the NSolve command. > > > > How can I display this result as a 3x4 matrix, using the solution to > > assign values to the 12 Fi, j's. > > > > This must be done in a nested > > input that includes the function that solves the equations. > > > > I'm a mathematica newbie and any help with this is greatly appreciated. > > Thank you! > >