Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • $\begingroup$ Thank you for the suggestion of an alternative approach. However, I am still confused on why the function I defined does not work. $\endgroup$ Commented Sep 17, 2014 at 1:57
  • $\begingroup$ @Beer Your fucction works. ClearAll["Global`*"]; pointset = {{1, 5}, {2, 6}, {4, 2}}; distance[{x_List, y_List}] := Sqrt[Total[(x - y)^2]]; diameter[x_List] := Max[distance /@ Flatten[Outer[List, x, x, 1], 1]]; diameter[pointset] $\endgroup$ Commented Sep 17, 2014 at 2:06
  • $\begingroup$ Thanks for checking the code. I find it weird that both you and evanb actually confirmed that the code works (which I really think it should), but I couldn't get it to work on my own computer. I am guessing that it might have something to do with my version (Mathematica 10). May I know what version you are running? $\endgroup$ Commented Sep 17, 2014 at 2:20
  • $\begingroup$ @BeerR Try this instead. It does the same thing as your function diameter[x_List] := Max[EuclideanDistance @@@ Flatten[Outer[List, x, x, 1], 1]] $\endgroup$ Commented Sep 17, 2014 at 2:29
  • $\begingroup$ I am grateful and have tried the approach that you suggested. I have also found a workaround to find it using Table[]. I am just still confused on why it doesn't work only on my system. $\endgroup$ Commented Sep 17, 2014 at 5:54