Re: Norm
- To: mathgroup at smc.vnet.net
- Subject: [mg68005] Re: Norm
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Thu, 20 Jul 2006 06:04:46 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
On 7/19/06 at 5:21 AM, Clausenator at gmail.com wrote: >Hi, I want to calculate a distance matrix, similar to (as poorly >explained at) http://en.wikipedia.org/wiki/Distance_matrix >I found out about the Function "Norm" in mathematica 5. >Here is a little example. I want to calculate the distance between >vectors {0,1} and {5,1}. The distance should be 5 >Now, >Norm[{{0., 1.}, {5., 1.}}, 2] results 5.10293 >Norm[{{0., 1.} - {5., 1.}}, 2] results 5.0 >According to the documentation I have (Mathematica Help Browser, >search for "Norm" under "Built-in Functions") the version with the >comma is documented. I like the solution with the dash better. Which >one is it? In other words, is there some Wolfram description or can >you explain the difference? Yes, In[10]:= {{0.,1.},{5.,1.}}!={{0.,1.}-{5.,1.}} Out[10]= True Norm[{{0,.1,}-{5.,1.}},2] is exactly the same as Norm[{{5.,0}},2] which is 5. The dash tells Mathematica to do a subtraction then compute the norm. Norm[{{0.,1.},{5.,1.}},2] is the norm of a 2x2 matrix and is not equal to 5. In particular for a matrix, m, Norm[m] is a singular value of m. Also, the default for the Norm function is the 2-norm. That is In[4]:= Norm[{{0,1},{5,1}}]==Norm[{{0,1},{5,1}},2] Out[4]= True and In[9]:= Norm[{{0,1},{5,1}}//N]==First@SingularValueList[{{0,1},{5,1}}//N] Out[9]= True Finally, all of this is documented and can be found using the Help Browser. -- To reply via email subtract one hundred and four