0

Let $f: [0, l]\times[0,l] \rightarrow [0,1]$ continuous. I need a mathematical tool to obtain a 'measure' of the contour lines of $f$, where 'measure' could be meant as their length. I was not able to find any answer in the literature.

Edited out after answers : [I was thinking about defining a function $g:[0,1]\rightarrow \mathbb{R}$ such that: $$ g(z) = \int_0^l\int_0^l\delta(f(x,y) - z)\,\text{d}x\text{d}y\quad, $$ where $\delta(\cdot)$ is the Dirac Delta function. Has it a mathematical meaning? Is there a more formal way to tackle this problem?]

Edit: Following @Mathemagical answer, I still have some doubts. For example: $f:[−2,2]\times[−2,2]\rightarrow[0,1]$,

$$ f(x,y) = \begin{cases} \max(0,−\sqrt(x^2+y^2)+2)\qquad \text{if }\sqrt(x^2+y^2) > 1\\ 1\qquad \text{otherwise} \end{cases} $$ (basically, a flipped truncated cone). Areas are $\pi(2-z)^2$ and $m=2\pi(z−2)$. Firstly, for $z\in[0,1]$, $m<0$, consistent with decreasing areas but, being interested in a positive metric, I guess I should consider the absolute value. Secondly, what about $z=0$ and $z=1$? In the first case, I would like $m = 16 - 4\pi$ (area outside the basis circle) and in the second case $m = \pi$, (area of the plateau). Am I wrong somewhere?

AMel
  • 3

1 Answers1

0

It seems that you have already defined a measure (the length), and are merely looking for a formula to express that.

Perhaps you would have wanted to use a 2 dimensional Dirac Delta function in some way? As written now, it is clearly a one-dimensional DD function. And for that, an integral over an area (a double integral) is not defined.

Edited out after comments: [I don’t really know your context, but is the area enclosed by the contour line also a possible measure? $$g(z) = \mu(f \ge z) = \int \int \mathbb{1}_{f>z}$$ where $ \mathbb{1}_{f>z}$ is a function that is 1 where $f>z$ and zero elsewhere. ]

For what you said you wanted, a better metric is not the length but the following one.

Let $a(z)$ be the area enclosed by the contour line, i.e, the area where $f>z$. Then the metric we want is simply the absolute value of the derivative $$m= \left|\frac{da}{dz}\right|$$ Why this and not the length? Because this captures not “how many points in the domain take the value z” (which, if it is a curve, is always a measure zero set) but “on how much of the domain is f in the vicinity of z?” (Between $z$ and $z+dz$).

In other words, $$da=|a(z+ dz)-a(z)|=|\frac{a(z+ dz)-a(z)}{dz}dz|$$ But $$\lim_{dz\rightarrow 0} \frac{a(z+ dz)-a(z)}{dz}= \frac{da}{dz}$$ so that $$da \approx m dz$$ for finite $dz$. This is why I have suggested $m \varepsilon $ as a measure in the comments.

I wish I could draw a figure to explain this, but I am writing this on a phone, so I cannot. Happy to explain this a little more if you aren’t able to see that after you try some examples. Maybe an example like $f=(\frac{x+y}{\sqrt{2}})^2$ will make it clear. The lengths of the curves where $f=0.0625$ and $f=0.5625$ is the same but the area of the domain where $0.0624<f<0.0626$ is much bigger than the area of the domain where $0.5624<f<0.5626$.

As a bonus area is often easier to compute than the length directly.

Example: let $f=xy$ on your domain. Then $$a=\int_z^1 \int_{\frac{z}{x}}^1 dy dx=1-z+z \ln z$$ So $$m=\ln z$$

I have assumed above that the function does not plateau anywhere. (The inverted cone you mention would work fine if it were not truncated).

If, otoh, your function purely has level sets that are areas (non-zero measure in two dimensions), not curves, the problem is also very easy. Each value of z would be associated with a specific area.

However, if, as I understand from your comments, the function is a mix of both, neither a simple function (taking only a ‘finite’ number of platueax) nor a function that never takes a plateau, both measures are invalid on some part of the domain.

In that case, does it make sense for you to stick to an area measure (so, for a plateau at z, you would report the area and for the rest, you would just say zero, instead of reporting the length or the variant that I proposed. Because that would be “combining apples and oranges”.

Mathemagical
  • 3,489
  • Thank you for your reply. Sorry for my lack of formalism, but I'm not really into Maths. Basically, I need some tool to measure "how much my function $f$ assumes each of the value $z \in [0,1]$". The point is, I can't invert $f$, hence I am not able to identify points for which $f(x,y) = z$ and compute 2D integrals of DDs centered in this points. I need to think about your proposal of $g$, but I guess it is a good way to obtain the measure I need. – AMel Nov 11 '17 at 11:37
  • :). “How much my function assumes each value” is the basis of a famous type of integration called Lebeague integration. But your problem is quite easily solved. Let me edit the answer say how. – Mathemagical Nov 11 '17 at 13:11
  • Thank you so much for the clear explaination and the examples.Still I have some doubts. For example: $f:[-2,2]\times[-2,2]\rightarrow[0,1]$, $f=-\sqrt(x^2+y^2)+2$ if $\sqrt(x^2+y^2)>1$, $1$ otherwise (basically, a flipped truncated cone). As you say, areas are $\pi(2-z)^2$ and $m=2\pi(z-2)$. Firstly, for $z \in [0,1]$, $m < 0$, consistent with decreasing areas but, being interested in a positive metric, I guess I should consider the abs(). Secondly, what about $z=1$? $m=-2\pi$ but I would like it to be $\pi^2$, i.e. the area of the plateau. Am I wrong somewhere? – AMel Nov 12 '17 at 06:16
  • Sorry, the function should be $f = \max(0, -\sqrt(x^2 + y^2)+2)$ if $\sqrt(x^2+y^2)>1$, so, for my needs, $m$ should be $16 - \pi 4$. Also, I made a typo for $z = 1$, $m$ should be $\pi$. I was late to edit my comment when I realized. – AMel Nov 12 '17 at 06:44
  • Perhaps you could edit this into your question or start an answer of your own so that the LaTeX stuff typesets? – Mathemagical Nov 12 '17 at 06:53
  • Sign does not matter. Based on your problem, you could just as well define a as the area where f<z. But it wouldn’t matter as m should be the absolute value of the derivative. (I shall edit my answer). I have assumed that function is not flat anywhere. But if you have level sets, the function a is not even continuous, let alone differentiable. (So, actually 2 pi is not the derivative (it’s only the limit on one side. Let me write more in the answer about that. – Mathemagical Nov 12 '17 at 07:06
  • I understand your point about "combining apples and oranges", my struggle was, indeed, trying to find a solution to take into account both cases, starting from my informal problem of finding "how much my function assumes each value" (considering only areas of plateaux would make me lose information about all the other points). Hence I had the idea of using DDs, which maybe is too brave. – AMel Nov 12 '17 at 07:34
  • Yes, the DDs would not work either for the mixed case. The issue is more than how to compute it. It’s that the answer itself is of 2 different types (area vs. curve) with different notions of “size”. Here is a last stab: this is what I might call an engineer’s solution :). Pick some ε (as small as you like). Then for very every z, define g(z) as the area of the domain on which the function f lies in the range (f-ε/2,f+ε/2). That would handle both cases. When there are plateaux, you would get something very close to π in your example. – Mathemagical Nov 12 '17 at 09:45
  • And for z values that don’t correspond to plateaux, g would be essentially m ε where m is as we defined it earlier in the answer. Both would be areas, so apples to apples and you can control how accurate things are by shrinking ε. – Mathemagical Nov 12 '17 at 09:48
  • Ok, this sounds as the only thing which can be done. Thank you a lot for your insight and patience! Please can you provide a book reference where I can read more about the original measure you suggested? – AMel Nov 12 '17 at 14:18
  • I can't really think of a reference, but I can explain the thinking a little more. But I want to use MathJax for typesetting. So let me edit into the answer. – Mathemagical Nov 12 '17 at 15:40