MathGroup Archive 1998

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

Search the Archive

Re: What am i missing?

  • To: mathgroup at
  • Subject: [mg12724] Re: What am i missing?
  • From: "Allan Hayes" <hay at>
  • Date: Thu, 4 Jun 1998 02:52:10 -0400
  • References: <6kvrgi$>
  • Sender: owner-wri-mathgroup at

Ray Pendergraph wrote in message <6kvrgi$7td at>...
>Im not saying this is a glitch and I do not want to start a debate like
>the one about why the square root of x squared is not x on
>Mathematicabut my question is this: Why does Mathematica square each
>individual element in a matrix when I say [A]^2 . For instance, I have
>an n x n matrix [A] filled with random numbers. Should'nt {A]^2  be the
>same as [A].[A] instead of squaring each component of the matrix (which
>is what Mathematica does when you say A^2).There must be a reason why
>Wolfram did this and I am not exactly a seasoned mathematician so could
>someone explain?


It's often useful to have the this entry by entry operation as well as
the Dot product, and it follows standard math proctice with lists and

a = {p,q,r};

{p + x, q + y, r + z}

   p  q  r
  {-, -, -}
   x  y  z

   p  q  r
  {-, -, -}
   k  k  k

  {Sin[p], Sin[q], Sin[r]}

In Mathematica it's called "threading", and is done automatically be
functions that have the attribute Listable:


Allan Hayes
Training and Consulting
Leicester UK
hay at
voice: +44 (0)116 271 4198
fax: +44(0)116 271 8642

  • Prev by Date: Re: Union[{0},{0.}] = {0,0.}?
  • Next by Date: Re: hacheurs
  • Previous by thread: What am i missing?
  • Next by thread: Re: variation on Split