1

RELEVANT DEFINITIONS

We define the floor of a real number $x$ to be the unique integer $n = \lfloor x \rfloor$ such that $n \leq x < n$.

We define the modulo of a real number $x$ with respect to a real number $w$ to be the real number value $y = x \% w = x - w \lfloor \frac {x}{w} \rfloor$.


MATHEMATICAL CONTEXT

Integration is a useful tool by which to analyze functions. The derivative is similarly a useful tool as well. Determining a means by which to integrate and differentiate functions that are trickier than most functions or requiring a different skill set than normally taught in a calculus course is therefore beneficial to others.


POTENTIAL USAGE

The modulo function or "saw tooth wave" (as some sites such as Wolfram Alpha appear to call it) can be used to represent discrete wave functions which are sometimes used in signal processing.

I'm not entirely sure what the floor function might be useful for in the real world other than for approximating functions. For example, $x \lfloor x \rfloor$ approximates the general shape of $x^2$. Therefore it stands to reason that there are cases for which clever replacement of $x$ with $\lfloor x \rfloor$ (or something similar) may be useful in coming up with a decent approximation of a function that could potentially be integrated more easily than


KNOWLEDGE LEVEL

At the time I made this post according to the date I was in a calculus 2 course that covered your standard integration methods and other single dimension function related things such as polar coordinate integrals. There was defintiely no interaction between that course or it's predecessor with the two titular functions.

As for my knowledge level at this time... if I were asking this question now I wouldn't be asking it at all because I'd already be able to figure it out myself.


REASON FOR ASKING

Nothing ever talked about how to deal with floor or modulo when combined with integration/differentiation, so I wanted to know how.


THE PROBLEM STATEMENT

Let $f(x)$ and $g(x)$ be functions of $x$. For simplicity's sake and because of the knowledge level being considered let us also assume they can be written as an expression of $x$, $+$, $\cdot$, $\^$, $\ln$, $\cos$, and $\sin$. We don't want them to be anything real unusual, but an answer is allowed to treat them as continuous differentiable and integrable functions if that makes the answer simpler (for example if the reasoning generalizes in some fashion).

Is there a reasonably simple identity that allows one to find the solutions to:

$\int \lfloor f(x) \rfloor dx$

$\int f(x) \% f(y) dx$

$\frac {d}{dx} (f(x) \% f(y))$

$\frac {d}{dx} (f(x))$

If there isn't such a rule or identity or integration method, could someone explain why? Is it simply because they aren't useful enough to warrant messing with and therefore the knowledge base regarding these functions is limited at best, or is there something deeper here that makes the existence of such an identity impossible?


MY ATTEMPT(S)

I honestly had no idea how to solve this when I originally asked it. I recall that in the original post was some really horrible hand-waved reasoning about asymptotes and such that I think ultimately just boiled down to "I can do this if the number of discontinuities work out to being finite because then I just know the answer" - that's equivalent to saying I can find some integrals in very niche specific cases by flat out guessing. While that's a valid way to find integrals in the real world if you're dealing with a problem that you might be able to make an educated guess about, it is not real helpful here as an attempt. That's why I'm not rewriting it.

As for an attempt now... I think the expiration date has already passed on that. Providing an attempt 4 years later (actually a solution) would be best done in an answer.

user64742
  • 2,195
  • 1
    How do you even get the $/3$ anywhere? I get $$\int_0^x \lfloor t\rfloor,dt = \int_0^{\lfloor x\rfloor} \lfloor t\rfloor ,dt + \int_{\lfloor x\rfloor}^x \lfloor x\rfloor,dt = \frac{\lfloor x\rfloor^2+\lfloor x\rfloor}2 + (x-\lfloor x\rfloor)\lfloor x\rfloor = \lfloor x\rfloor(x+\tfrac12-\tfrac12\lfloor x\rfloor) $$ – hmakholm left over Monica Nov 18 '15 at 09:49
  • "The integral at 1 should equal 0" ... good test, which also shows that my calculation above is wrong. I had an off-by-one error, and it should really be $$\int_0^x \lfloor t\rfloor,dt = \int_0^{\lfloor x\rfloor} \lfloor t\rfloor ,dt + \int_{\lfloor x\rfloor}^x \lfloor x\rfloor,dt = \frac{\lfloor x\rfloor^2 - \lfloor x\rfloor}2 + (x-\lfloor x\rfloor)\lfloor x\rfloor = \lfloor x\rfloor(x-\tfrac12-\tfrac12\lfloor x\rfloor)$$ – hmakholm left over Monica Nov 18 '15 at 15:56
  • 1
    Also, $\int\lfloor1/u\rfloor,du=u\lfloor 1/u\rfloor$ cannot be right, because $u\lfloor 1/u\rfloor \to 1$ as $u\to 0$ so the improper integral $\int_0^{1/2}\lfloor 1/u\rfloor,du$ would be 0 if the indefinite integral is $u\lfloor 1/u\rfloor$ -- but actually $\int_0^{1/2} \lfloor 1/u \rfloor,du > \int_0^{1/2} (1/u-1),du = \infty$. – hmakholm left over Monica Nov 18 '15 at 16:04

1 Answers1

3

First of all, you have a function of two variables $f(x, y) = x - y\lfloor x/y \rfloor$. So when you are talking about its derivative, there are various possibilities. But before I get to them, note that $f(x, y)$ is not continuous where $x/y$ is an integer. Therefore it has no derivative at those points. At all other points, the derivatives exist.

  • The partial derivative of $f$ with respect to $x$: $$\frac{\partial f}{\partial x}(x, y) = 1$$ where it exists. (You are almost correct that the greatest integer function $\lfloor t \rfloor$ has derivative $0$. Its derivative is undefined for integer $t$ because of the discontinuity. Everywhere else it is $0$.)
  • The partial derivative of $f$ with respect to $y$: $$\frac{\partial f}{\partial y}(x, y) = \lfloor x/y \rfloor$$
  • The full derivative of $f$ can be considered to be a function $Df$ of 4 variables: $$Df(x, y; u, v) = u\frac{\partial f}{\partial x}(x, y) + v\frac{\partial f}{\partial y}(x, y) = u + v\lfloor x/y \rfloor$$ This map tells how $f$ changes when you move away from $(x, y)$ in the direction pointed to by the vector $(u, v)$.

When integrating a function of two variables, there are also various possibilities: you can do a double integral over an area, or you can define a curve in the plane, and integrate along that curve. So what you will need to be more specific about the integration you are after before I can give you a good answer.


One thing you can do to simplify the issue is to define a function $g(t) = t - \lfloor t\rfloor$. Then $f(x, y) = y g(x/y)$. Since $g$ is a function of only one variable, it has a single derivative. Once again, because it is discontinuous when $t$ is an integer, the derivative of $g$ is undefined for integers. For non-integer $t, g'(t) = 1$.

The antiderivative is given by $$\int g(t)\ dt = \frac{g^2(t) + \lfloor t\rfloor}2 + C$$

While the $\lfloor t\rfloor$ might seem superfluous since it differentiates to $0$, note that the definite integral is given by $$\int_a^b g(t)\ dt = \frac{(g^2(b) + \lfloor b\rfloor) - (g^2(a) + \lfloor a\rfloor)}2$$

Paul Sinclair
  • 45,932
  • @TheGreatDuck - it's as good of an answer as is possible. "meant to be a function of one variable" doesn't define a function of one variable. Since you never clarified what supposed function of one variable you wanted, even after I pointed out that you were describing a function of two variables, not one, I am at a loss to figure out how you thought it would be possible to provide anything more. The closest I could think of is the function $g$ in my post. – Paul Sinclair Mar 13 '16 at 02:59
  • @TheGreatDuck - I see that you tacked that bit on some 40 minutes after I posted my answer. I'm sorry, but we don't get notifications that you've changed the question after we've posted answers. Otherwise I would have pointed out back then how the chain rule works for multi-variate functions: $$\frac{df}{dx} = \frac{\partial f}{\partial a}\frac{da}{dx} + \frac{\partial f}{\partial b}\frac{db}{dx} = a'(x) + \left\lfloor \frac ab \right\rfloor b'(x)$$ when $a/b$ is not integer. When $a/b$ is integer, the derivative does not exist unless $b'(x) = 0$ as well. – Paul Sinclair Mar 13 '16 at 13:50