Re: distance function
- To: mathgroup at smc.vnet.net
- Subject: [mg68705] Re: [mg68686] distance function
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Thu, 17 Aug 2006 04:18:12 -0400 (EDT)
- Reply-to: hanlonr at cox.net
- Sender: owner-wri-mathgroup at wolfram.com
pts={{x1,y1},{x2,y2},{x3,y3}};
Norm/@Subtract@@@Subsets[pts,{2}]
{Sqrt[Abs[x1 - x2]^2 + Abs[y1 - y2]^2],
Sqrt[Abs[x1 - x3]^2 + Abs[y1 - y3]^2],
Sqrt[Abs[x2 - x3]^2 + Abs[y2 - y3]^2]}
Bob Hanlon
---- dimmechan at yahoo.com wrote:
>
> In the book of Gaylord et al. (1996) there is one exercise which asks
> (see page 113)
>
> "Given a list of points in the plane, write a function that finds the
> set of all distances
> between the points."
>
> Although there is one solution, that solution makes use of the Table
> and Length commands.
>
> Is it a way to define the same function using Higher-Order functions
> like Outer, MapThread etc?
>
> Thanks in advance for any help.
>