2 added 762 characters in body
source | link
diameter[x_List] := Max[EuclideanDistance @@@ Subsets[x, {2}]]
diameter[pointset]
(* 2 Sqrt[5] *)

Now, let's improve the performance "a little bit". I believe the maximal distance will be realized at the points' convex hull (I'll not demonstrate it,but it's quite intuitive).

Now, if you have a lot of points Mathematica provides a convenient and fast way to find the Convex Hull. Let's use it and test the performance with and without it:

<< ComputationalGeometry`
pointset = RandomReal[{0, 1}, {3000, 2}];
diameter[x_List] := Max[EuclideanDistance @@@ Subsets[x, {2}]]

Timing[diameter[pointset]]
Timing[ch = ConvexHull@pointset; diameter[pointset[[ch]]]]

(* {45.328125, 1.39892}
   {0.061250,  1.39892}
*)

Now,YMMV but that's 45 vs .06 secs. Not bad at all for a little improvement ;)

diameter[x_List] := Max[EuclideanDistance @@@ Subsets[x, {2}]]
diameter[pointset]
(* 2 Sqrt[5] *)
diameter[x_List] := Max[EuclideanDistance @@@ Subsets[x, {2}]]
diameter[pointset]
(* 2 Sqrt[5] *)

Now, let's improve the performance "a little bit". I believe the maximal distance will be realized at the points' convex hull (I'll not demonstrate it,but it's quite intuitive).

Now, if you have a lot of points Mathematica provides a convenient and fast way to find the Convex Hull. Let's use it and test the performance with and without it:

<< ComputationalGeometry`
pointset = RandomReal[{0, 1}, {3000, 2}];
diameter[x_List] := Max[EuclideanDistance @@@ Subsets[x, {2}]]

Timing[diameter[pointset]]
Timing[ch = ConvexHull@pointset; diameter[pointset[[ch]]]]

(* {45.328125, 1.39892}
   {0.061250,  1.39892}
*)

Now,YMMV but that's 45 vs .06 secs. Not bad at all for a little improvement ;)

1
source | link

diameter[x_List] := Max[EuclideanDistance @@@ Subsets[x, {2}]]
diameter[pointset]
(* 2 Sqrt[5] *)