Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9972 > unrolled thread

Norm, Normalize and column vectors

Started byBrentt <brenttnewman@gmail.com>
First post2012-05-06 07:25 +0000
Last post2012-05-07 00:29 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Norm, Normalize and column vectors Brentt <brenttnewman@gmail.com> - 2012-05-06 07:25 +0000
    Re: Norm, Normalize and column vectors Szabolcs Horvát <szhorvat@gmail.com> - 2012-05-07 00:29 +0000

#9972 — Norm, Normalize and column vectors

FromBrentt <brenttnewman@gmail.com>
Date2012-05-06 07:25 +0000
SubjectNorm, Normalize and column vectors
Message-ID<jo590k$2bu$1@smc.vnet.net>
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?

[toc] | [next] | [standalone]


#9978

FromSzabolcs Horvát <szhorvat@gmail.com>
Date2012-05-07 00:29 +0000
Message-ID<jo751m$bre$1@smc.vnet.net>
In reply to#9972
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/

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web