Artificial intelligent assistant

How to measure how erratic is a function between a and b I need to compare the outputs of some functions and to rate their "erratness". Given a function, the less erratic function between a and b would be a straight line and the more erratic function would probably be a triangular or sine wave, the bigger its amplitude or its frequency the bigger their erratness. I'm not sure if it's clear what I mean. I've thought that a way to calculate it could be to calculate the length of the line generated by the function between a and b. The smaller the length the less erratic will be the function. The questions are: 1. Do you think this is a good way to achieve what I need? 2. How can the length of the output of a function be calculated? Thanks in advance.

There is something called the total variation of a function. If the function is differentiable, it's computed as $\int_a^b|f'(x)|\,dx$. There are standard methods for computing the derivative and the integral numerically. If the function is not differentiable, there's a different definition, which should also be suitable for numerical computation. See the discussion at <

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 0b88ff8f1da883215bd1bfd749091626