MathGroup Archive 2012

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

Search the Archive

Re: Norm, Normalize and column vectors

  • To: mathgroup at smc.vnet.net
  • Subject: [mg126390] Re: Norm, Normalize and column vectors
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Sun, 6 May 2012 20:28:34 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jo590k$2bu$1@smc.vnet.net>

On 2012.05.06. 9:25, Brentt wrote:
> Why does Norm work with column vectors, but Normalize does not?
>
> e.g..
> In[1]:= Norm[{{1}, {2}, {3}}]
>
> Out[1]= Sqrt[14]
>
> But
>
> In[2]:=Normalize[{{1}, {2}, {3}}]
>
> Throws red
>
>
> It even says in the documentation that Normalize[v] essentially returns
>
> Times[Power[Norm[v],-1],v],   except returning the 0 vector for the 0
> vector.
> Strangely, the above "equivalent" expression would handle all but th 0
> column vector with aplomb.
>
> I find this curious. Is there a good explanation for this?
>

In Mathematica, there are no column vectors and row vectors.  Instead, 
one can have a tensor of arbitrary rank.

A rank 1 tensor is a vector, written like {x,y,z}
A rank 2 tensor is a matrix written like {{a,b},{c,d}}

If v is a vector and m is a matrix, you can multiply them as v.m and 
m.v, no need to worry if v is a "column" or a "row" vector.

What you *can* have as an equivalent of a column or row vector is a 1 by 
n or an n by 1 matrix.  However, Normalize[] only works with vectors, 
not with matrices.  Norm[] works both with vectors and matrices (though 
for matrices the second argument may only have certain values).

You can have higher rank tensors as well, and multiply them together easily.

It is important to understand this design choice when switching to 
Mathematica from other systems that only have a matrix data type 
but no true vectors or higher rank tensors (and thus the distinction 
between row and column vectors is mandatory).


-- 
Szabolcs Horvát
Visit Mathematica.SE:  http://mathematica.stackexchange.com/



  • Prev by Date: KeyUp event
  • Next by Date: Re: New to Mathematica
  • Previous by thread: Re: Norm, Normalize and column vectors
  • Next by thread: Re: Norm, Normalize and column vectors