Re: mathematica newbie question
- To: mathgroup at smc.vnet.net
- Subject: [mg66907] Re: [mg66879] mathematica newbie question
- From: Sseziwa Mukasa <mukasa at jeol.com>
- Date: Sat, 3 Jun 2006 03:25:52 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
I forgot to include the math group and made a mistake in my earlier
message.
> On Jun 2, 2006, at 4:09 AM, Jeremy Watts wrote:
>
>
>> Hi,
>>
>> Just trying to get to grips with Mathematica and matrices. Why is
>> it when I
>> enter :-
>> {0, 0, 0}, {1, -1, -1}, {-1, 1, 1}}^2
>>
>> then Mathematica returns :-
>>
>> {{0, 0, 0}, {1, 1, 1}, {1, 1, 1}}
>>
>> and not {{0,0,0},{0,0,0},{0,0,0}} (the actual square of the
>> matrix) as I'd
>> have expected?
>>
>
> Because you did not ask for matrix multiplication, ^ operates on
> each element of the lists individually.
>
>
>> Is it treating what I entered as separate vectors or something,
>> and not an
>> actual matrix?
>>
>
> Yes, in general items enclosed in {} are a list, I suggest reading
> the Mathematica Book or the Help Browser to understand what that
> means. A list can be treated as a matrix when given as an argument
> to operators that understand the concept of a matrix. There are
> two ways to achieve what you want:
>
> MatrixExp[{{0,0,0},{1,-1,-1},{-1,1,1}},2]
Sorry I mean MatrixPower[{{0,0,0},{1,-1,-1},{-1,1,1}},2]
>
> or
>
> With[{a={{0,0,0},{1,-1,-1},{-1,1,1}}},a.a]
>
> you can use the Help Browser to get help on these operators.
Regards,
Ssezi