|
|
Ricky
SFN Die Hard
USA
4907 Posts |
|
Ricky
SFN Die Hard
USA
4907 Posts |
|
Ricky
SFN Die Hard
USA
4907 Posts |
|
Ricky
SFN Die Hard
USA
4907 Posts |
Posted - 02/04/2009 : 22:30:09 [Permalink]
|
Oh, and an explanation of the algorithm might help.
Fix p on the sphere, and for each point x_1, ..., x_n in your set, calculate the Great Circle Distance, call this d_1, ..., d_n. Set d = f(d_1, ..., d_n) where f maps into the nonnegative real numbers. Now letting p vary, find p such that d is minimized. My two functions that I've been using are the standard ones:
f(d_1, ..., d_n) = |d_1| + ... + |d_n|
and
f(d_1, ..., d_n) = d_1^2 + ... + d_n^2 |
Why continue? Because we must. Because we have the call. Because it is nobler to fight for rationality without winning than to give up in the face of continued defeats. Because whatever true progress humanity makes is through the rationality of the occasional individual and because any one individual we may win for the cause may do more for humanity than a hundred thousand who hug their superstitions to their breast.
- Isaac Asimov |
|
|
Dave W.
Info Junkie
USA
26022 Posts |
Posted - 02/04/2009 : 23:02:44 [Permalink]
|
Originally posted by Ricky
Dave, I have an idea that uses differential topology, but I need the X, Y, Z coordinates. Would you mind providing them? | Ricky, so far as I know, the only problems I had in my algorithms were switching from spherical coordinates to X,Y,Z and back again. I was trying to implement the conversion equations on Wikipedia.
I'm pretty sure I was getting the conversion to Cartesian coords correct, it was the conversion back that was the problem.
The average point, of course, was somewhere inside Earth. So I'd get a new value R with sqrt(X2+Y2+Z2). Then, following the equations on Wikipedia,X/R = sin φ sin θ Y/R = sin φ cos θ Z/R = cos φ So then,φ = cos-1 Z/R θ = sin-1((X/R)/sin φ) And finally...
Nevermind. I had φ and θ backwards. Dammit. I just needed to talk it through. I've got no mathy people around.
With your algorithm, is the minimal distance (or distance-squared) point equal to the average (or mean)? I mean, if one takes a set of random numbers, is the straight arithmetic average (N) of those numbers equal to the minimal sum of the differences between N and each number in the set? Similarly, would the mean of the numbers (M) be equal to the minimal sum of the differences squared? If so, you've probably got the right answers already. |
- Dave W. (Private Msg, EMail) Evidently, I rock! Why not question something for a change? Visit Dave's Psoriasis Info, too. |
|
|
Ricky
SFN Die Hard
USA
4907 Posts |
Posted - 02/05/2009 : 00:23:14 [Permalink]
|
At first I had dismissed averaging the Euclidean coordinates, but perhaps that was too hasty. You will have an error term which grows with the distance of the points because you aren't taking curvature into account, but as this only needs to be an approximation, that's ok. An example of this is two points close together, and a third further away. The average will be 1/3 down the line connecting them, but this will not corresponding to 1/3 as a distance on the sphere.
The only real problems occur when this average is close to the center of the sphere, however those problems aren't with the method but with the question itself. The solution isn't stable (it varies too greatly) in this case.
To be convinced of your conversions, just try doing the average on single values. 0 lat and 0 lon, or other nice points.
With your algorithm, is the minimal distance (or distance-squared) point equal to the average (or mean)? |
No, it is not. The problem here is that average is rather difficult to define on the sphere. At least I haven't found a good way. I took it as meaning "the point which has the smallest sum of distances between itself and all the points in the set" (or sum of the distances squared), which is precisely what my algorithm finds. It is more or less an algorithm for "line of best fit", with "point" substituted for "line". |
Why continue? Because we must. Because we have the call. Because it is nobler to fight for rationality without winning than to give up in the face of continued defeats. Because whatever true progress humanity makes is through the rationality of the occasional individual and because any one individual we may win for the cause may do more for humanity than a hundred thousand who hug their superstitions to their breast.
- Isaac Asimov |
|
|
Zebra
Skeptic Friend
USA
354 Posts |
Posted - 02/05/2009 : 00:38:52 [Permalink]
|
Did your calculations take into account the equatorial bulge, because of which the earth is closer to an oblate spheroid (or oblate ellipsoid) than to a sphere?
(I'm mostly just messin' with ya - but a spherical model could lead you to the wrong cruise ship in the Mediterranean) |
I think, you know, freedom means freedom for everyone* -Dick Cheney
*some restrictions may apply |
|
|
Dave W.
Info Junkie
USA
26022 Posts |
Posted - 02/05/2009 : 06:31:24 [Permalink]
|
Turns out I did not have φ and θ reversed. After a bunch of checking, the last set of coords I gave is correct with the method I used.Originally posted by Ricky
At first I had dismissed averaging the Euclidean coordinates, but perhaps that was too hasty. You will have an error term which grows with the distance of the points because you aren't taking curvature into account, but as this only needs to be an approximation, that's ok. An example of this is two points close together, and a third further away. The average will be 1/3 down the line connecting them, but this will not corresponding to 1/3 as a distance on the sphere. | So long as the average isn't smack-dab in the middle of the points, the error amount will be inversely proportional to the average's distance to the origin (which corresponds to how spread-out the points are, yes). With one point at 0,-89 and nine points at 0,89, the average should be 0,71.2 but this method finds 0,88.75 With a 2/8 split, the average should be 53.4, but we find 0,88.33, etc. The "depth" of the Cartesian average drops as the split becomes more balanced. With a 4/6 split, my result is still 85.012 when it should be 17.8! However, with a 5/5 split of points, My result is 0,0 as it should be, even though the average point is only 111 km from the center of Earth.The only real problems occur when this average is close to the center of the sphere, however those problems aren't with the method but with the question itself. The solution isn't stable (it varies too greatly) in this case. | With the Terror Attack average, its depth is only 843.5 km. However, the Earthquake average is 3945.8 km deep! There is probably a large error there.
To be convinced of your conversions, just try doing the average on single values. 0 lat and 0 lon, or other nice points. | Yeah, I realized that a bit late.With your algorithm, is the minimal distance (or distance-squared) point equal to the average (or mean)? | No, it is not. | Took me a moment, but I see that now. The average of 0,2 and 10 is 4, but the number with the minimal sum of differences is 2.
The problem here is that average is rather difficult to define on the sphere. At least I haven't found a good way. I took it as meaning "the point which has the smallest sum of distances between itself and all the points in the set" (or sum of the distances squared), which is precisely what my algorithm finds. It is more or less an algorithm for "line of best fit", with "point" substituted for "line". | Well, I just realized that so long as a hemisphere can be defined such that all the points are within it, you can transform the coordinates such that the center of that hemisphere becomes 0,0 and then you should be able to convert to cylindrical coordinates, do a simple average of both φ and z, and then run the same transforms in reverse to get lat,long. But our earthquake guesses cannot be so confined. The terror attack points can be, because their largest difference is much less than 180°.
Must think some more... |
- Dave W. (Private Msg, EMail) Evidently, I rock! Why not question something for a change? Visit Dave's Psoriasis Info, too. |
|
|
Dave W.
Info Junkie
USA
26022 Posts |
Posted - 02/05/2009 : 06:32:38 [Permalink]
|
Originally posted by Zebra
(I'm mostly just messin' with ya - but a spherical model could lead you to the wrong cruise ship in the Mediterranean) | We only need to be accurate to 200 km for the earthquake prediction. Unfortunately, there is no such slop for the terror attack location, it's gotta be spot-on or else no points. |
- Dave W. (Private Msg, EMail) Evidently, I rock! Why not question something for a change? Visit Dave's Psoriasis Info, too. |
|
|
Dave W.
Info Junkie
USA
26022 Posts |
Posted - 02/05/2009 : 07:18:37 [Permalink]
|
Originally posted by Dave W.
Well, I just realized that so long as a hemisphere can be defined such that all the points are within it, you can transform the coordinates such that the center of that hemisphere becomes 0,0 and then you should be able to convert to cylindrical coordinates, do a simple average of both φ and z, and then run the same transforms in reverse to get lat,long. | I didn't mean "convert to cylindrical coordinates," I meant "project (like Mercator) to cylindrical coordinates." So with latitude θ, y = ln(tan(θ)+sec(θ)), and the reverse transform is θ = tan-1(sinh(y))...
...so for the terror attack,39.15, 17.30 <- Straight average of lat/long 45.52, 24.60 <- Cartesian average -65.4, -145.2 <- norms squared 51.5, -145.2 <- norms 40.11, 17.30 <- Mercator average And it's clear that your methods are messed up, Ricky.
The longitudes for the terror attack run from -82.999 to 68.368, and because the latitudes are all within 32° of each other the average shouldn't cross over the poles. The answer must be within the "rectangle" defined by the two corners 24.63,-82.99 and 55.75,68.37, no question. |
- Dave W. (Private Msg, EMail) Evidently, I rock! Why not question something for a change? Visit Dave's Psoriasis Info, too. |
|
|
Dave W.
Info Junkie
USA
26022 Posts |
Posted - 02/05/2009 : 12:34:01 [Permalink]
|
Originally posted by Dave W.
And it's clear that your methods are messed up, Ricky. | Well, my first attempt at implementing minimum distance resulted in 58.05,-152.4 so I'm not doing any better. |
- Dave W. (Private Msg, EMail) Evidently, I rock! Why not question something for a change? Visit Dave's Psoriasis Info, too. |
|
|
Ricky
SFN Die Hard
USA
4907 Posts |
|
Ricky
SFN Die Hard
USA
4907 Posts |
|
moakley
SFN Regular
USA
1888 Posts |
Posted - 06/23/2009 : 07:32:48 [Permalink]
|
Sometimes in this contest you really don't want to be right.
Ed McMahon dies |
Life is good
Philosophy is questions that may never be answered. Religion is answers that may never be questioned. -Anonymous |
|
|
BigPapaSmurf
SFN Die Hard
3192 Posts |
Posted - 06/23/2009 : 08:29:26 [Permalink]
|
Way to go Moakley, at least the feds have a suspect now. |
"...things I have neither seen nor experienced nor heard tell of from anybody else; things, what is more, that do not in fact exist and could not ever exist at all. So my readers must not believe a word I say." -Lucian on his book True History
"...They accept such things on faith alone, without any evidence. So if a fraudulent and cunning person who knows how to take advantage of a situation comes among them, he can make himself rich in a short time." -Lucian critical of early Christians c.166 AD From his book, De Morte Peregrini |
|
|
|
|
|
|