Re: How making arbitray matrices?
- To: mathgroup at smc.vnet.net
- Subject: [mg9403] Re: [mg9324] How making arbitray matrices?
- From: Mario Sancho Graca <mario_sancho.graca at virgin.net>
- Date: Wed, 5 Nov 1997 01:56:24 -0500
- Sender: owner-wri-mathgroup at wolfram.com
Kwag,Jae-Hwan wrote: > > Hello, > > This is Kwag. I am studying NMR in Univ. of Missouri-Columbia. > Nowdays I am using Mathmatica for my project. I have a question. How > can I make arbitray matries which have 2X2 dimensions, and they can be > used to one character; > Let me show you what I gona do; > > The matrix II[x] can be written by > II[x]={{1,0},{0,1}} > II[y] ==85 > II[z]==85 > After I have used these values, I will try to solve my problems. But > I have some trouble which can not use II[x],II[y]=85 directly in my > program without the components such as {{1,0},{0,1}}. Actually If I > put II[x],II[y] into my program on mathematica, I want they can be > expressed by themselves and have the property of matrix. in) =(1 + > II[x] + II[y] + a II[z] + II[x].II[z]+ =85). ( 1 + II[x] + II= [y] > > + a II[z] + II[x].II[z]+ ) > I want the output to be > out=Identity Matrix+IIx + IIy+IIx.IIy+ IIx^2.IIy+ =85 After > calculateing, using //. IIx.IIy->1/4 Identity Matrix,=85, I will sove > this problem. > The mathematica can not be accepted with my expression. Would you give > me advice how I make(declare) these matrices? Without going through the details of your work, can I point out that to assign the value 85 to a symbol one must use the equality sign, In:= II[y] = 85; II[z] = II[y]; Your code is actually using Equal (==) which is a test: lhs == rhs returns True if lhs and rhs are identical. On evaluating the above line the system setups the symbols II[y] and II[z] in the context Global`, but they are not assigned the value (85). The nomenclature II[y] and II[z] are like subscripts for II (see The Mathematica Book, 2.4.5). Subscripts are useful, but note that II[y], II[z] are symbols in their own right. As for using these symbols with lists, one property you should study is Listable, see The Mathematica Book and, for example, Bahder, Mathematica for Scientists and Engineers, 1995. Matrices are a special kind of lists, and all its algebra follows from Listable. Suppose we had the matrix \[ScriptCapitalA], In:= \[ScriptCapitalA] ={ {a11, a12},{a21,a22} }; and the vector \[ScriptCapitalV], In:= \[ScriptCapitalV] = {v1 v2}; then we could multiply \[ScriptCapitalA] by \[ScriptCapitalV]: In:= \[ScriptCapitalA].\[ScriptCapitalV] Out= {{(a11 v1 + a12 v2)}, {(a21 v1 + a22 v2)}} In your code you are attempting to use II[y] with the list II. But note that you have defined II[y] as a scalar. Probably what you are thinking is to use II[y] and II[z] as vectors, in which case you would define them as II[y] = {85}; II[z] = {85}; although a vector of just one element is of little use. ---------------------------------------------------------------------- Mario Sancho Graca University of Warwick Email: mario_sancho.graca at virgin.net Department of Engineering Fax: +44 (0)1203 418922 Coventry CV4 7AL United Kingdom ----------------------------------------------------------------------