MathGroup Archive 2003

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

Search the Archive

RE: Distance between to points in r^3

  • To: mathgroup at smc.vnet.net
  • Subject: [mg41587] RE: [mg41576] Distance between to points in r^3
  • From: "David Park" <djmp at earthlink.net>
  • Date: Wed, 28 May 2003 04:57:22 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Ronny,

Another method.


v1 = {3, 4, 5};
v2 = {6, 7, 8};

Doing it step by step, all in one cell...

v2 - v1
%^2
Plus @@ %
Sqrt[%]

Subtraction of vectors is subtraction of the elements.
% refers to the previous output.
Squaring a vector squares the elements.
@@ is Apply and Plus @@ % changes the list to a sum.

Doing it all at once...

Sqrt[Plus @@ ((v2 - v1)^2)]

The parentheses are necessary.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/ 


From: Ronny Mandal [mailto:ronnyma at math.uio.no]
To: mathgroup at smc.vnet.net

 Hi.
 
 Assume that I've got to vectors  (3,4,5) and (6,7,8).How do I 
 calculate the distance between them?
 
 Thanks in advance.
 
 Ronny M


  • Prev by Date: RE: Distance between to points in r^3
  • Next by Date: RE: Decimal point in printed numbers
  • Previous by thread: Re: QUICK COPY & PASTE: WYSIWYG
  • Next by thread: Re: Distance between to points in r^3