# Looking for a metric to express difference between two curves

1. Jan 11, 2012

### meldraft

Hi all,

I am trying to argue that an ellipse is a good approximation for some discontinuity in a material. The ellipse and the interpolated curve I get from the photo look very much alike, but I need an actual number to show how much the two curves differ from each other. I thought of

$$\frac{Area_{actual} - Area_{ellipse}}{Area_{actual}}$$

but it doesn't really give any information about how much the curves match (a square with the same area as the ellipse would give 0 deviation).

I'm kind of new to Riemannian geometry, but I thought that maybe I could use the Riemann curvature tensor, although I don't really know how to do it yet :P . I would appreciate any suggestions you are able to give!

2. Jan 11, 2012

### micromass

Here is a possibility:

Let X be the interior of the first curve and let Y be the interior of the second curve. Then you can make

$$(X\setminus Y) \cup (Y\setminus X)$$

The area of that should be a good (pseudo)metric to describe what you want.

3. Jan 11, 2012

### dodo

If the curves can be expressed in polar form $(r(\theta), \theta)$, perhaps using as origin of coordinates the center of your suggested ellipse, then maybe you could use
$$\int_{\theta_1}^{\theta_2} (r_{ellipse} - r_{interp})^2 d\theta$$
(Am I making sense?)

4. Jan 13, 2012

### meldraft

Micromass, I really like your suggestion, but I had trouble going from sets to actual equations.

The solution I used eventually was Dodo's equation: I also looked up "interpolation error".

http://en.wikipedia.org/wiki/Interpolation

There, the deviation of one curve from the other is measured as the square of the distance difference (just as in Dodo's equation).

5. Jan 13, 2012

### meldraft

Just a correction: Dodo if I'm not mistaken, your formula is meant to calculate the area between the curves correct? If so, shouldn't it be:

$$|\int_0^{2 \pi}{(r_1(θ)^2-r_2(θ)^2)}{dθ}|$$

6. Jan 16, 2012

### dodo

Hi, Meldraft, sorry for the delay, I was travelling.

The formula was not intended to calculate the area in-between. I was intended to be a continuous sum (an integral) of squares... just as when you add the squares of residuals after you fit a curve to data. (I couldn't avoid the multiplication by a delta-angle... but I'm open to suggestions.) Hope this makes some sense now.

Edit: $\theta_1$ and $\theta_2$ are supposed to be the initial and final "sweep angle". Your approximation as an arc of ellipse, when written in polar form, has, as any arc of ellipse, an initial angle and an ending angle. presumably the interpolated curve, if it can be expressed in polar coordinates from the ellipse's center, is also some form of strange arc, with an initial and a final sweep angle.

Last edited: Jan 16, 2012
7. Jan 16, 2012

### meldraft

Ohhh, so you meant like RSS?

Both my curves are closed, since I'm describing a physical hole, so if I understand correctly, I could use:

theta1 = 0, theta2 = 2*pi

I haven't really used this, I'm just familiar with the term, so I'll have to look into it. The area formula (which I am now realising has essentially been micromass' suggestion all along :P) seems to be yielding good results, although I'm a little hesitant on including a self-defined metric. I'd rather use something that is in the literature.

Thank you for your feedback! I'll let you know how it works out!