6
$\begingroup$

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.

$\endgroup$
8

3 Answers 3

7
$\begingroup$

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.

$\endgroup$
15
  • $\begingroup$ I'm worried about using total variation because $V_b^a$ seems to run into the same issue as $w_1$ where both of the tails shoot off to positive infinity for $f_1$, which shouldn't be the case. Does your numerator somehow account for this? $\endgroup$
    – Pro Q
    Jun 20, 2019 at 21:49
  • $\begingroup$ This suggestion doesn't seem right. For (non-constant) functions that are differentiable on $(a,b)$ and continuous on $[a,b]$, it satisfies $0 \leq W_{[a,b]}(f) \leq 1$, but any straight line has $W_{[a,b]}(f) = 1$, i.e. is "maximally wobbly" among this class of functions. $\endgroup$
    – jawheele
    Jun 20, 2019 at 21:58
  • $\begingroup$ @ProQ Well, if we take my definition of $W_{[a,b]}(f_1)$ on your $f_1$ function, I calculate it to be $1,$ actually, since $f_1$ is monotonic on $[-1,1].$ The numerator is essentially the max value minus the min value, or the range. If the function is monotonic, that will equal the total variation and it'll cancel to get 1. $\endgroup$ Jun 20, 2019 at 21:59
  • 1
    $\begingroup$ @ProQ Not with my definition of wobbliness. In fact, no polynomial over a finite interval could have infinite total variation. You can probably prove that all polynomials over a finite interval are of bounded variation. $\endgroup$ Jun 20, 2019 at 22:11
  • 1
    $\begingroup$ @jawheele Well, it looks like we may just have to differ in opinion on this one. I think of $\sin(x)$ as differing from its mean no more or less on half a period as on a whole period as on five periods. It's up to the OP to specify what he's after. For such an inherently vague notion as "wobbliness", it's quite likely there could be multiple answers that get at the idea. $\endgroup$ Jun 21, 2019 at 14:47
5
$\begingroup$

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.

$\endgroup$
7
  • $\begingroup$ This is very much closer to what I was looking for! This seems to get at the idea behind wobbliness. My main worry is that it's only for a particular point, and I'm not sure yet the best way to define it over a line. (We could just integrate the curvature and divide by the domain, or do the same thing, but for the curvature of the curvature...) $\endgroup$
    – Pro Q
    Jun 20, 2019 at 22:00
  • 1
    $\begingroup$ You could divide the straight-line distance from $(a,f(a))$ to $(b,f(b))$ by the integral of the curvature over $[a,b].$ Then you'd have a number that was zero for very wobbly functions, and one for straight line functions. That is, you could define $\displaystyle W_{[a,b]}(f)=\frac{\sqrt{(b-a)^2+(f(b)-f(a))^2}}{\int_a^b\frac{|f''(x)|}{(1+(f'(x))^2)^{3/2}}\,dx}.$ $\endgroup$ Jun 20, 2019 at 22:05
  • $\begingroup$ I like that idea a lot. (I can't figure out how to graph it, but it makes sense.) If someone posts that as an answer, I will accept. Answer must give credit to both Adrian and Adam $\endgroup$
    – Pro Q
    Jun 20, 2019 at 22:13
  • $\begingroup$ My idea would have a divide-by-zero corner case for any straight-line function, since for such a function, $f''(x)=0.$ You'd have to define the wobbliness of a straight line function to be one explicitly. $\endgroup$ Jun 20, 2019 at 22:20
  • $\begingroup$ @AdrianKeister I think this is approaching the OP's wobbliness, but I don't think it's quite there. In the simplest case of a semicircular arc of radius $R$, the curvature is constant $\frac{1}{R}$, so your expression evaluates to $W_{[a,b]}(f) = \frac{2R}{2} = R$ (the interval considered is between the endpoints of the semicircular arc). I'd think that wobbliness shouldn't depend on the scale. $\endgroup$
    – jawheele
    Jun 20, 2019 at 22:20
0
$\begingroup$

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.$

$\endgroup$
3
  • $\begingroup$ Is there any standard mathematical function that counts how many times the sign changes within a function, or would we have to define one? $\endgroup$
    – Pro Q
    Jun 20, 2019 at 21:23
  • $\begingroup$ This doesn't seem to work for $x^4 - 4x^3 + 5x^2 - 3x + 1$ (The derivative is $12x^2 - 24x +10$ which has sign changes near .5 and 1.5, but the wobbliness of the function seems to go from about .25 all the way up to 2) $\endgroup$
    – Pro Q
    Jun 20, 2019 at 21:33
  • $\begingroup$ If you could explain why you think the wobbliness only starts at $0.25$ and not (for example) $-1$, and ends at $2$ rather than at $3$ or $4,$ and your reason still allows $2x+\sin x$ to be wobbly, we might make more progress. In your example I see two "bowl" regions separated by a hump, the zeros of the second derivative tell you where the hump borders the bowls, but I don't see other boundaries of the bowls and I don't know why you would expect them to have definite boundaries. $\endgroup$
    – David K
    Jun 21, 2019 at 1:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .