How can you mathematically define a "wobbly" function?

971 Views Asked by At

There are a lot of functions that look wobbly.

For example $x^4 + x^3$ looks a little wobbly when it gets near the x axis. The function $\sin(x)$ is extremely wobbly. The function $\sin(x) + x$ is also extremely wobbly.

What is a mathematical expression that seems to calculate how "wobbly" a function $f(x)$ is?

What I've done so far:

At first I thought "wobbly" was just the slope changing quickly. To measure how fast the slope is changing, that would be the slope of the slope, and we don't care about direction, so we obtain:

$$w_1(f; a, b) = \int_a^b | f''(x) | dx$$

where $w_1$ is the first definition I've come up with for the "wobbliness" of a function from $x = a$ to $x = b$ where $a < b$.

However, when I tested this on the function $f_1(x) = x^4 + x^3 - x^2 - x$, it didn't seem right. $f_1$ seems to be wobbly from $-1$ to $1$. However, $w_1(f_1) = \int_a^b |12x^2+6x-2|$ which seems to be largest for $a, b < -1$ or $1 < a, b$, which is not what we want.

My next thought was that maybe I'm counting how often a function is switching from a non-zero slope to a zero slope over a particular range. This would make $f_1$ be wobbly from $-1$ to $1$, and would also make $\sin(x)$ be very wobbly as well.

However, I didn't even attempt to come up with a mathematical formula for this definition (which I will call $w_2$), because I recognized that $f_2 = \sin(x) + 2x$ would be a counterexample. It's also very wobbly, but its slope is never 0.

Interestingly enough, $w_1$ seems to do a good job of measuring where $f_2$ is wobbly.

So, again, what mathematical function can be used to quantify how "wobbly" another function is?

(It must work for at least $f_1$ and $f_2$ and hopefully generalize to other functions as well.)

Here are graphs of $f_1$, $f_2$, $w_1(f_1)$, and $w_1(f_2)$ in case they are helpful for understanding.

3

There are 3 best solutions below

7
On BEST ANSWER

You can use the curvature of the graph to measure how non-straight the graph is at a given point. It is given by $$ \kappa(x) = \frac{|f''(x)|}{\big(1+(f'(x))^2\big)^\frac32}$$ It's similar to your first guess $|f''(x)|$ but the denominator causes it to become small if the slope is big, because in this situation even big $f''(x)$ does not mean a big change in the direction of the graph.

The integral of the curvature over an arc length (not over just $x$) has an interesting property, that it measures the angle by which the graph has turned on a giving interval:

\begin{align} K_{[a,b]} =\int_a^b \kappa (x) ds(x) &= \int_a^b \frac{|f''(x)|}{\big(1+(f'(x))^2\big)^\frac32} \sqrt{1+(f'(x))^2} dx = \\ &= \int_a^b \frac{|f''(x)|}{1+(f'(x))^2} dx = \\ &= \int_a^b \left| \frac{d}{dx} \arctan f'(x)\right| dx = \\ &= \int_a^b \left| \frac{d}{dx} \varphi(x)\right| dx\end{align} where $\varphi(x)$ denotes the declination angle of the graph at point $x$. The absolute value makes sure that turns left and turns right acccumulate, and not cancel each other. As a consequence $K_{[a,b]}$ does not depend on the scale: if you stretch the graph proportionally in all directions, it remains the same. It is also invariant under isometries (translations, rotations). It is equal $0$ on intervals where function graph is straight, otherwise always greater that $0$, it can be used even for generic curves (that are not a graph of a function), although then the curvature needs to be calculated from a different formula. It is also extensive, that is for $a<b<c$ we have $K_{[a,c]}= K_{[a,b]}+K_{[b,c]}$.

In the comments @AdrianKeister proposed another scale-invariant quantity, the ratio of arc length and the straight-line distance:

$$ R_{[a,b]} =\frac{\int_a^b \sqrt{1+(f'(x))^2} dx}{\sqrt{(b-a)^2+(f(b)-f(a))^2}}$$

It is equal to $1$ for straight lines, otherwise always greater than $1$. It is scale-invariant, and invariant under isometries. It seems to work well-enough for graphs of functions, although for other curves it can exhibit some strange behavior; for example, for a closed curve (like a full circle) you have $R_{[a,b]} = \infty$, then it becomes finite again if I take more than a full circle. It can be made arbitrarily bigg just by stretching the graph in the $y$ direction ($f(x) \rightarrow \lambda f(x)$). It's not extensive, and actually adding sometimes considering a bigger interval can make $R$ smaller.

3
On

You could consider when the second derivative of the function changes sign. When the second derivative is negative you’re going over a hump and when it’s positive you’re inside a kind of bowl shape even if the function is increasing the whole time like $2x+\sin x.$

15
On

Perhaps you're thinking of total variation. You can think of it as "vertical distance traveled". You could, perhaps, over some region, divide the range by the total variation. That is, you could define your "wobbliness" as $$W_{[a,b]}(f)=\frac{\displaystyle\sup_{x\in[a,b]}f(x)-\inf_{x\in[a,b]}f(x)}{V_{\!b}^{\!a}(f)}, $$ where, of course, we would have to have $V_{\!b}^{\!a}(f)\not=0.$ This $W_{[a,b]}(f)$ would be a number in the interval $(0,1],$ and it would be undefined for a constant function. You could define the "wobbliness" of a constant function to be one. $W_{[a,b]}(f)$ would be close to zero if the function was very wobbly. It would equal $1$ if the function was monotonic. This idea has the virtue of being well-defined even for not-very-well-behaved functions.

If the function is differentiable, then I would use arc length as follows: $$W_{[a,b]}(f)=\frac{\sqrt{(b-a)^2+(f(b)-f(a))^2}}{\int_a^b\sqrt{1+(f'(x))^2}\,dx}.$$ This would be near zero for very wobbly functions, and one for a straight line. No issue with divide-by-zero in this case.