Re: 2 Simple Mathematica Questions. (regarding tensors and matrices)
- To: mathgroup at smc.vnet.net
- Subject: [mg45103] Re: 2 Simple Mathematica Questions. (regarding tensors and matrices)
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Wed, 17 Dec 2003 07:54:22 -0500 (EST)
- Organization: Universitaet Leipzig
- References: <brmqjh$oc2$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi, you know to use Part to access H[[1,3,21]] but you don't know to access the elements of L1 with L1[[i,j]] and L2[[k,l]] *and* you don't like Outer[Times, L1, L2, 2] that need no explicit element access at all Since the full matrix A is different for the function call to the Function A[i,j] you *must* use a different symbol to denote a matrix *element*. What is with A=Array[a[i,j],{i,3},{j,3}] ?? Regards Jens "Ashok. R" wrote: > > Greetings. > > This is my first question: > > I am trying to form a 4-tensor, H, whose (i,j,k,l) components are given by > H(i,j,k,l) = M(i,j)A(k,l) where M and A are 2-Tensors (Matrices). This is > what I have been doing so far: > L1 = Array[M, {3, 3}] > > L2 = Array[A,{3,3}] > > H = Table[L1[i,j]*L2[k,l] {i,3},{j,3},{k,3},{l,3}] > > The last statement gives a long output, but not the the correct result. I > want to be able to say > > H[[1,3,2,1]] and get M[1,3]A[2,1] as output. > > Can someone familiar with tensor manipulation in Mathematica tell me how to > do this ? > > ---------------------------------------------------------------------------- > --------------------- > > This is my second question: > > I want to assign a matrix, A, that has three rows and three columns and each > element is identified by A[i,j] > > L1 = Array[A,{3,3}] works, but the array is called L and not A. I tried > > A = Array[A,{3,3}] and that, as expected, gave me a warning about > recursions. > > Thank you for your assistance. I wish you a pleasant day. > > Ashok