MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: adding matrices

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65792] Re: adding matrices
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Mon, 17 Apr 2006 02:28:49 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 4/16/06 at 3:49 AM, ac7220 at wayne.edu (francis hu7xley) wrote:

>am fairly new to mathematica. simply want to add two 3x3 matrices
>together(actually, subtract). if they are called m and p, if i type
>m-p, mathematica treats the second matrix p as a scalar and
>subtracts that entire 3x3 matrix p from each entry of m. the help
>contents do not seem to address this issue!!! there must be a simple
>way of doing this??

Hmm... With version 5.2 running on Mac OS 10.4.6 I don't get the result you describe. Instead doing

In[6]:=
m = Table[Random[], {3}, {3}]

Out[6]=
{{0.248054090808991, 0.08175882048928461, 
   0.09171130051093868}, {0.9320093048442182, 
   0.811932501327654, 0.4762175089976257}, 
  {0.9632985629564331, 0.2848638564009711, 
   0.37751589172137134}}

In[7]:=
p = Table[Random[Integer, {1, 10}], {3}, {3}]

Out[7]=
{{5, 1, 1}, {3, 6, 4}, {7, 4, 1}}

In[8]:=
p - m

Out[8]=
{{4.751945909191009, 0.9182411795107154, 
   0.9082886994890613}, {2.067990695155782, 
   5.188067498672346, 3.5237824910023745}, 
  {6.0367014370435665, 3.715136143599029, 
   0.6224841082786287}

Seems to return the result you want.

Perhaps if you provided a sample of the code you are using?
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Resetting Mathematica
  • Next by Date: Re: Plot {x,y} and {x,z} of a List {x,y,z}
  • Previous by thread: Re: adding matrices
  • Next by thread: Re: adding matrices