Re: Norm
- To: mathgroup at smc.vnet.net
- Subject: [mg68012] Re: [mg67973] Norm
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Thu, 20 Jul 2006 06:04:53 -0400 (EDT)
- References: <200607190921.FAA21393@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On 19 Jul 2006, at 11:21, 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? > > Thanks for your help, > Claus > Norm[{{0., 1.}, {5., 1.}}, 2] does not compute the distance between the points {0,1} and {5,1} but the 2-norm of the matrix {{0., 1.}, {5., 1.}}. This is defined as the square root of the sum of the squares of the matrix entries, in other words it is Sqrt[0^2+1^2+5^2+1^2]//N 5.19615 This is of course completely different form the distance, which is: Norm[{{0, 1}-{5, 1}}, 2] 5 where - is not the dash but the subtraction sign! Andrzej Kozlowski
- References:
- Norm
- From: Clausenator@gmail.com
- Norm