In matlab there is a function called "int(f,x)" which takes in a symbolic function and a variable and integrates it. I decided to try using it today to play around and do a few integrals and I got a pretty interesting surprise.

I integrated the following and got the following results from matlab:

$$\int floor(x) dx = x*floor(x)$$

$$\int floor(\sqrt x) dx = x*floor(\sqrt x)$$

$$\int x*floor(x) dx = \frac {x^2}2*floor(x)$$

I think you see the pattern. Matlab's integral seems to treat symbols of the form floor(f(x)) as constants. Oddly enough, I actually have a name for and use this operator in self-developed integration methods. I call it an implied integral. Is there some actual reason why matlab's integration function does implied integration or is it just a "bug" in the lack of algorithms for certain integrals? This is the first instance I've seen of anything mimicking the sort of things I've been doing over the past year or so, so if matlab has followed down the same path I am and is doing something I'm not yet aware of that would interesting to see.

On the flipside I now know of a working implied integral calculator, which is awesome.


These are not bugs. Note that $\int f(x)\; dx$ is supposed to be an antiderivative of $f(x)$. The antiderivatives you quote are perfectly good in all intervals where $f$ is continuous. However, at points where $f$ is discontinuous there is generally no antiderivative.

Now you seem to want to choose a function that is an antiderivative where such a thing exists and additionally is continuous at the discontinuities of $f$. That turns out not to be easy to do in general. It is easy in the examples you gave, because you know exactly where the jumps occur, but it's easy to find functions where you don't know exactly where they occur.

  • 1
    $\begingroup$ "Indefinite integral" is usually taken to be a synonym of "antiderivative". See e.g. Wikipedia. $\endgroup$ – Robert Israel Nov 9 '16 at 20:29
  • 1
    $\begingroup$ Wolfram alpha just tells me "(no result found in terms of standard mathematical functions)". I wouldn't call that better. $\endgroup$ – Robert Israel Nov 9 '16 at 20:31
  • $\begingroup$ Which "most systems" are you referring to? Matlab doesn't have its own symbolics: it used to use Maple, but then it switched to MuPad. $\endgroup$ – Robert Israel Nov 9 '16 at 22:36
  • $\begingroup$ But if you want a definite integral, you can ask Matlab for one: int(f, 'x', a, b). You can make $a=0$, say, and $b$ a symbolic variable, which gives you your version of "indefinite integral". $\endgroup$ – Robert Israel Nov 9 '16 at 22:38
  • $\begingroup$ Modern terminology is usually to use "indefinite integral" to mean an antiderivative, but it is sometimes used, as @TheGreatDuck does, to mean the definite integral with specified lower bound as a function of the upper bound. This is also called "semidefinite integral", as at economics.stackexchange.com/questions/24312/… for example. It has also been used to mean a semidefinite integral plus a constant; then the Fundamental Theorem of Calculus states (given appropriate conditions) that an indefinite integral is the same as an antiderivative. $\endgroup$ – Toby Bartels Oct 25 '19 at 21:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.