- #1
caratacus
- 5
- 0
Homework Statement
I've constructed a 5°x5° latitude/longitude cell, from 40-45° N and 85-90°W. This puts the center somewhere near the southern tip of Lake Michigan. I'm trying to find the average distance from the center of that cell (42.5°N, 87.5°W) to any other point in that cell.
Homework Equations
I know that the Haversine formula is used to calculate great circle distances between points. I formatted it nicely and placed it into Mathematica:
Code:
radians = Pi/180;
startLong = 87.5;
startLat = 42.5;
dlon = startLong - x;
dlat = startLat - y;
a = Sin[dlat/2*radians]^2 +
Cos[y*radians]*Cos[startLat*radians]*Sin[dlon/2*radians]^2;
c = 2*ArcTan[Sqrt[a], Sqrt[1 - a]];
d = 6370*c;
The Attempt at a Solution
My thought has been take the Haversine formula and take a double integral, with respect to x from -90° to -85°, then with respect to y from 40° to 45°, where x is longitude and y is latitude. However, this integral can crash Mathematica without breaking a sweat, and the NIntegrate function on Mathematica fails to approximate it correctly; I know because I've changed the starting point to a set of coordinates thousands of miles away, yet the integral approximation hardly changes its value.
In Mathematica,
Code:
NIntegrate[d, {y, 40*radians, 45*radians}, {x, 85*radians, 90*radians}]