Re: 2 Simple Mathematica Questions. (regarding tensors and matrices)
- To: mathgroup at smc.vnet.net
- Subject: [mg45105] Re: [mg45083] 2 Simple Mathematica Questions. (regarding tensors and matrices)
- From: "Sseziwa Mukasa,,(978) 536-2359" <mukasa at jeol.com>
- Date: Wed, 17 Dec 2003 07:54:24 -0500 (EST)
- References: <200312161121.GAA24760@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On Dec 16, 2003, at 6:21 AM, 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 ?
>
Outer[Times,L1,L2]
> -----------------------------------------------------------------------
> -----
> ---------------------
>
> 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.
There's no reason to do an assignment. A[i,j] is an expression with
value A[i,j] unless you define another value for it.
Regards,
Ssezi
- References:
- 2 Simple Mathematica Questions. (regarding tensors and matrices)
- From: "Ashok. R" <ashokr@alum.dartmouth.org>
- 2 Simple Mathematica Questions. (regarding tensors and matrices)