Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #12370 > unrolled thread
| Started by | Dana DeLouis <dana01@me.com> |
|---|---|
| First post | 2012-11-17 08:51 +0000 |
| Last post | 2012-11-18 09:02 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Re: Euclidean distance of all pairwise combinations (redundants) Dana DeLouis <dana01@me.com> - 2012-11-17 08:51 +0000
Re: Euclidean distance of all pairwise combinations (redundants) Joseph Gwinn <joegwinn@comcast.net> - 2012-11-18 09:02 +0000
| From | Dana DeLouis <dana01@me.com> |
|---|---|
| Date | 2012-11-17 08:51 +0000 |
| Subject | Re: Euclidean distance of all pairwise combinations (redundants) |
| Message-ID | <k87j6e$s4u$1@smc.vnet.net> |
> Any ideas on how to get the euclidean distance between all the points
including redundants and self references?
Just for fun, and to add complexity, heres one more but with the output
in table form. :>)
list={{1,1},{2,2},{3,3},{4,5}};
(* Edge List - el *)
el=UndirectedEdge@@@Subsets[list,{2}];
g=Graph[el,EdgeWeight->EuclideanDistance@@@el];
MatrixForm[GraphDistanceMatrix[g],TableHeadings->{VertexList[g],VertexList[g]}]
= = = = = = = = = =
HTH :>)
Mac & Math 8
=E2=80=A8Dana DeLouis
=E2=80=A8= = = = = = = = = =
On Tuesday, November 13, 2012 10:35:53 PM UTC-8, Jesse Pisel wrote:
> I have been having a tough time trying to figure out how to include =
all red undant pairwise combinations in my results for the euclidean =
distance between a set of points. I have a set of points with xy =
coordinates and want the euclidean distance between each point including =
the point and itself. So if my points in xy space are list = {{1, 1}, =
{2, 2}, {3, 3}} for example, I want the distance from {1, 1} to {1, 1}, =
{1, 1} to {2, 2}, and {2, 2} to {3, 3} etc. for each point for a total =
of 9 distances all together. The EuclideanDistance function removes the =
redundant distances that I want retained in the results. I have been =
using this code just to play with data but would like to be able to =
expand up to 500+ points:
>
>
>
> list = {{1, 1}, {2, 2}, {3, 3}}
>
> EuclideanDistance @@@ Subsets[list, {2}]
>
>
>
> Any ideas on how to get the euclidean distance between all the points =
including redundants and self references?
[toc] | [next] | [standalone]
| From | Joseph Gwinn <joegwinn@comcast.net> |
|---|---|
| Date | 2012-11-18 09:02 +0000 |
| Message-ID | <k8a877$89f$1@smc.vnet.net> |
| In reply to | #12370 |
In article <k87j6e$s4u$1@smc.vnet.net>, Dana DeLouis <dana01@me.com>
wrote:
> > Any ideas on how to get the euclidean distance between all the points
> including redundants and self references?
>
> Just for fun, and to add complexity, heres one more but with the output
> in table form. :>)
>
>
> list={{1,1},{2,2},{3,3},{4,5}};
>
> (* Edge List - el *)
>
> el=UndirectedEdge@@@Subsets[list,{2}];
>
> g=Graph[el,EdgeWeight->EuclideanDistance@@@el];
>
>
> MatrixForm[GraphDistanceMatrix[g],TableHeadings->{VertexList[g],VertexList[g]}
> ]
>
>
> = = = = = = = = = =
> HTH :>)
> Mac & Math 8
> =E2=80=A8Dana DeLouis
> =E2=80=A8= = = = = = = = = =
>
>
>
>
> On Tuesday, November 13, 2012 10:35:53 PM UTC-8, Jesse Pisel wrote:
> > I have been having a tough time trying to figure out how to include =
> all red undant pairwise combinations in my results for the euclidean =
> distance between a set of points. I have a set of points with xy =
> coordinates and want the euclidean distance between each point including =
> the point and itself. So if my points in xy space are list = {{1, 1}, =
> {2, 2}, {3, 3}} for example, I want the distance from {1, 1} to {1, 1}, =
> {1, 1} to {2, 2}, and {2, 2} to {3, 3} etc. for each point for a total =
> of 9 distances all together. The EuclideanDistance function removes the =
> redundant distances that I want retained in the results. I have been =
> using this code just to play with data but would like to be able to =
> expand up to 500+ points:
> >
> >
> >
> > list = {{1, 1}, {2, 2}, {3, 3}}
> >
> > EuclideanDistance @@@ Subsets[list, {2}]
> >
> >
> >
> > Any ideas on how to get the euclidean distance between all the points =
> including redundants and self references?
What I've used is Outer[EuclideanDistance,list,list,1].
Joe Gwinn
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web