Mathematica 9 is now available
Student Support Forum
Student Support Forum: 'Inverting a matrix of formulas' topicStudent Support Forum > General > "Inverting a matrix of formulas"

< Previous CommentHelp | Reply To Comment | Reply To Topic
Author Comment/Response
Forum Moderator
email me
09/23/00 11:05am

>{s} is a 2 component vector. s(1)=Sin(Pi x), s(2)=Sin(2 Pi x).
>[B] is a 2 x 2 matrix. [B] is defined as B(1,1)=Integral[(0,1),s(1)*s(1)], B(1,2)=Integral[(0,1),s(1)*s(2)],
>B(2,1)=Integral[(0,1),s(2)*s(1)], B(2,2)=Integral[s(2)*s(2)]. (Please note, I am new to Mathematica and the above equations are not necessarily the way they must be entered, they are only trying to convey the operations without the mathematical symbols)
>For some reason when I define the matrix [B] in this type of fashion and then try to invert it, I recieve the message that [B] is not a square matrix....However, this is not the case....Furthermore, If I actually solve each matrix component as a real number rather than leaving it in the formula form, I can then invert without a problem....The only difference in the output cells of the two forms of the matrix before I attempt to invert them is that the formula version appears as {{{.5 Pi^2},{0}},{{0},{2 Pi^2}}} and the real number version output cell appears as {{.5 Pi^2,0},{0,2 Pi^2}}....Note, the number of brackets seems to be the only difference! Yet one inverts and the other will not.


Of course the number of brackets will make a difference. Look at the Dimensions of each list:

In[12]:= Dimensions[{{{.5 Pi^2}, {0}}, {{0}, {2 Pi^2}}}]
Out[12]= {2, 2, 1}

In[13]:= Dimensions[{{.5 Pi^2, 0}, {0, 2 Pi^2}}]
Out[13]= {2, 2}

You don't include the code that generates the first list so I can not suggest changes prior to the final output, however one way to fiddle with the output to get a 2 by 2 matrix is:

In[17]:= templist = Flatten[{{{0.5*Pi^2}, {0}}, {{0}, {2*Pi^2}}}]
Out[17]= {4.934802200544679, 0, 0, 2*Pi^2}

In[18]:= Partition[templist, 2]
Out[18]= {{4.934802200544679, 0}, {0, 2*Pi^2}}

Tom Zeller
Forum Moderator

URL: ,

Subject (listing for 'Inverting a matrix of formulas')
Author Date Posted
Inverting a matrix of formulas Rick Hladik 09/23/00 10:57am
Re: Inverting a matrix of formulas Forum Modera... 09/23/00 11:05am
< Previous CommentHelp | Reply To Comment | Reply To Topic