Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #9978
| From | Szabolcs Horvát <szhorvat@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Norm, Normalize and column vectors |
| Date | 2012-05-07 00:29 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jo751m$bre$1@smc.vnet.net> (permalink) |
| 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/
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread
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
csiph-web