+ Extensions

- As a challenge problem, motivated students should attempt to
(i) compute the Hausdorff distance of "best" fitting graphs;
(ii) determine the "best" fitting parabola with the Hausdorff distance function.

- The Hausdorff metric or distance is used in the study of fractals to determine whether two sets (which may be quite complicated) look the same. Fortunately, the idea is quite simple. To understand the Hausdorff distance between two curves, you have to define what you mean by the distance between the curves. This in turn is easier to understand if you first define the distance between a point and a curve.

- 1) The distance between a point and a curve is the length of the shortest line segment between the point and the curve. That is, d(x, B) = min { d (x, y): y in B }.

2) The distance between curve A and curve B is greatest distance among all of the distances between a point on A to the curve B. That is,
d(A, B) = max { d(x, B): x in A }.
Similarly, the distance between curve B and curve A is the greatest distance among all of the distances between a point B to the curve A. At first, this may seem redundant, but the following example should explain that the definition is not symmetric:

- Suppose A = unit circle centered at the origin; and
B = the circle of radius 2 centered at (5, 0).

Input := 

ParametricPlot[{{Cos[t], Sin[t]}, {2 Cos[t] + 5, 2 Sin[t]}},
 {t, 0, 2 Pi}, AspectRatio -> Automatic]
Output =

-Graphics-

- Then, the distance from A to B = 4, while the distance from B to A = 6.

3) Finally, the Hausdorff distance is simply the maximum between the distance from A to B and B to A. So, in the case of the catenary vs. parabola, call
A = catenary (true shape of the St. Louis Arch); and
B = parabola.
While it is easy to describe, the Hausdorff distance is typically hard to compute symbolically. However, given an example, one can often exploit the geometry of the sets A and B (which may be sets of points on a curve y = f(x), for example) to find the distance between them. In the following example, we work four examples to compare the Hausdorff distance between the "best fitting" curves found in the Possible Solutions section to the catenary equation for the Arch.

- Example: (see the Possible Solutions section to see how g1[x], ..., g4[x] were found.)

f[x] = the St. Louis arch
g1[x] = Least Squares fit
g2[x] = Arc Length Fit #1 (touch at vertices)
g3[x] = Arc Length Fit #2 (touch at ground)
g4[x] = Fit to three points: ground and vertex

Input := 

A = 68.7672;
c = 3.0022;
L = 299.2239;
fc = 625.0925;
f[x_] = fc - A(Cosh[c x/L]- 1);
Input := 

g1[x_] = 652.8286904319139 - 0.006330791164684482*x^2;
Input := 

g2[x_] = 625.0925 - 0.007238154230161798*x^2;
Input := 

g3[x_] = 648.0786735587897 - 0.007238154230161798*x^2;
Input := 

g4[x_] = 625.0925 - 0.006981548027223175*x^2;

- The Hausdorff distance between g1[x] and f[x] is 27.7362:

Input := 

Plot[{f[x], g1[x]}, {x, 0, L + 25},
 AspectRatio -> Automatic,
 PlotRange -> {0, 670}]
Output =

-Graphics-

It's clear from the graph above that the greatest distance between either curve occurs on the y - axis and is easy to compute, so the Hausdorff distance between g1[x] and f[x] is

Input := 

g1[0] - f[0]
Output =

27.7362

- The Hausdorff distance between g2[x] and f[x] is 34.5409:

Input := 

Plot[{f[x], g2[x]}, {x, 0, L + 10},
 AspectRatio -> Automatic,
 PlotRange -> {0, 670}]
Output =

-Graphics-

In this case, there is clearly a place inside [0, L] where the greatest distance occurs.

We find the two distances described above by finding the length of the line perpendicular through one of the curves and measuring the length of the segment between them. The Hausdorff distance is the maximum of both of these.

Input := 

distftog[x_] := 
 Sqrt[(1 + 1/g2'[x]^2)(FindRoot[f[x0] == g2[x] - 1/g2'[x] (x0 - x),
   {x0, x}][[1, 2]] - x)^2]
Input := 

distgtof[x_] := 
 Sqrt[(1 + 1/f'[x]^2)(FindRoot[g2[x0] == f[x] - 1/f'[x] (x0 - x),
   {x0, x}][[1, 2]] - x)^2]
Input := 

Plot[{distgtof[x], distftog[x]}, {x, 0.01, L}]
Output =

-Graphics-
Input := 

Plot[distftog[x], {x, 160.4, 160.6}]
Output =

-Graphics-
Input := 

Plot[distgtof[x], {x, 192.2, 192.25}]
Output =

-Graphics-

Since both of the graphs have the same maximum, the Hausdorff distance between f[x] and g2[x] is 34.5409.

- The Hausdorff distance between g3[x] and f[x] is 25.8622:

Input := 

Plot[{f[x], g3[x]}, {x, 0, L},
 AspectRatio -> Automatic,
 PlotRange -> {0, 660}]
Output =

-Graphics-

In this case, it's not clear if the maximum occurs at the y-axis or in the middle of the interval.

We find the two distances described above by finding the length of the line perpendicular through one of the curves and measuring the length of the segment between them. The Hausdorff distance is the maximum of both of these.

Input := 

distftog[x_] := 
 Sqrt[(1 + 1/g3'[x]^2)(FindRoot[f[x0] ==
   g3[x] - 1/g3'[x] (x0 - x),
   {x0, x}][[1, 2]] - x)^2]
Input := 

distgtof[x_] := 
 Sqrt[(1 + 1/f'[x]^2)(FindRoot[g3[x0] ==
   f[x] - 1/f'[x] (x0 - x),
   {x0, x}][[1, 2]] - x)^2]
Input := 

Plot[{distgtof[x], distftog[x]}, {x, 0.01, L}]
Output =

-Graphics-

Now we can tell that the maximum is not on the y-axis.

Input := 

Plot[distftog[x], {x, 178.05, 178.1}]
Output =

-Graphics-
Input := 

Plot[distgtof[x], {x, 202.2, 202.22}]
Output =

-Graphics-

Since both of the graphs have the same maximum, the Hausdorff distance between f[x] and g2[x] is 25.8622.

- The Hausdorff distance between g4[x] and f[x] is 31.9065:

Input := 

Plot[{f[x], g4[x]}, {x, 0, L},
 AspectRatio -> Automatic,
 PlotRange -> {0, 640}]
Output =

-Graphics-

In this case, there is clearly a place inside [0, L] where the greatest distance occurs.

We find the two distances described above by finding the length of the line perpendicular through one of the curves and measuring the length of the segment between them. The Hausdorff distance is the maximum of both of these.

Input := 

distftog[x_] := 
 Sqrt[(1 + 1/g4'[x]^2)(FindRoot[f[x0] ==
   g4[x] - 1/g4'[x] (x0 - x),
   {x0, x}][[1, 2]] - x)^2]
Input := 

distgtof[x_] := 
 Sqrt[(1 + 1/f'[x]^2)(FindRoot[g4[x0] ==
   f[x] - 1/f'[x] (x0 - x),
   {x0, x}][[1, 2]] - x)^2]
Input := 

Plot[{distgtof[x], distftog[x]}, {x, 0.01, L}]
Output =

-Graphics-
Input := 

Plot[distftog[x], {x, 158.5, 158.55}]
Output =

-Graphics-
Input := 

Plot[distgtof[x], {x, 187.5, 187.7}]
Output =

-Graphics-

Since both of the graphs have the same maximum, the Hausdorff distance between f[x] and g2[x] is 31.9065.

- So measuring by Hausdorff distance, one could say that g3[x] gives the best fit.