# Verifying a Superior Integration Method for Step Functions

I should note that this is an integration algorithm and therefore intermediate steps DO appear to be unjustified. The purpose of this question is to justify or reject this algorithm as always giving correct solutions.

Suppose we have some piecewise continuous function $f$ and that it can be written in the form $f(x) = G(x,\lfloor g_1(x) \rfloor,\lfloor g_2(x) \rfloor,\cdots, \lfloor g_n(x) \rfloor)$, for some functions $g_1(x), g_2(x), \cdots g_n(x)$ and $G(x,y_1,y_2,\cdots, y_n)$ such that $\lfloor g_1(x) \rfloor,\lfloor g_2(x) \rfloor,\cdots, \lfloor g_n(x) \rfloor$ are piecewise constant functions and $G$ is piecewise continuous with respect to $x$.

Now we have the algorithm to compute the general integral for $f$:

INTEGRATE-WITH-FLOOR(f)

1. Let $H(x,y_1,y_2,\cdots, y_n) = \int G(x,y_1,y_2,\cdots, y_n) dx$ be a new function.

2. Let $F(x) = H(x,\lfloor g_1(x) \rfloor,\lfloor g_2(x) \rfloor,\cdots, \lfloor g_n(x) \rfloor)$ be a new function.

3. Let $C(x)$ be a new piecewise constant function such that $F(x) + C(x)$ is continuous.

4. Return $F(x) + C(x)$.

Now I know this is more like an algorithm from a Computer Science class than a Math forum but I think it works and I seek verification.

Furthermore:

Does this algorithm compare to any existing methods. I was taught this method back when I was in calculus a few years ago but I have never seen it since then nor understood if it was justified or not.

Is there any way to extend this to differential equations at all or would it be too difficult?

Note: not looking for algorithms. Just general discussion of how it would be extended is just fine as well.

• For step 5, it seems we need to know where the cusps of $F(x)$ (which depends on all the points of discontinuity of $\lfloor g(x)\rfloor$) were in order to solve for the piecewise function $c$. The dependence of the location of the cusps with $E$ may be analogous to the root finding problem of functions in general, thus there might not be a closed form in general. – Secret Dec 23 '17 at 8:56
• @Secret no definitely not. A good example is the integral of $1 \mod x$. Its integral is $x - x*floor(x) - H(x)$ where $H$ is the step function version of the harmonic series or something to that effect. It is worth noting that I neither claim to know nor state it is always possible to find such a c. I am merely saying that if one obtains such a function then completing the steps gives one the indefinite integral. – The Great Duck Dec 23 '17 at 17:22
• Step (1) is ill-defined. Step (2) is impossible (see en.wikipedia.org/wiki/Nonelementary_integral). The whole thing is wrong even if I close both eyes about step (2) and be as lenient as I can about interpreting the rest of it, because of $\int \lfloor x·\sin(1/x) \rfloor\ dx$. But I'll not respond any further because it is obvious from a logic perspective that all such attempts are doomed. Unfortunately, it's too hard to explain without requiring a significant logic background. – user21820 Dec 27 '17 at 7:42
• @user21820 I agree 100% that step 1 is ill defined,but for an operation upon a string it is probably "good enough" for the audience of stack which is primarily high schoolers.I very well f**ing aware of the lack of closed forms, sir. I never said E'' was an elementary function.Yes, my answer *does point out the flaw that not all such functions of floor are piecewise constant (which is the necessary stipulation).I am aware of that issue but sometimes get lazy and neglect to mention it. (note: this is the result of a pretty heated argument in chat so apologies for the expletive). – The Great Duck Dec 27 '17 at 7:51
• @user21820 I would point out that not all integration methods work in all circumstances due to lack of closed form, but thats more of a human limitation than a limitation of the actual mathematics being right or wrong. If you have a better way to phrase 1 I'll be happy to put it there. Good luck though, I doublt it is that easy to formalize and would probably muddle the post with (honestly) unnecessary explanation. Most people will understand well enough to use it. – The Great Duck Dec 27 '17 at 7:54

This algorithm is not completely true or it at leaat appears so. I can only verify it for a piecewise continuous $f$ and where $\lfloor g(x) \rfloor$ in the algorithm is piecewise constant.

THE PROOF

We will prove the correctness of this algorithm by a sequence of definitions and propositions.

First we define $f^+(x) = \lim_{h \to 0^{+}} \frac {f(x+h) - \lim_{a \to x^{+}} f(a)}{h}$ and $f^-(x) = \lim_{h \to 0^{-}} \frac {f(x+h) - \lim_{a \to x^{-}} f(a)}{h}$ as shorthand for the left and right hand derivatives of some function $f$ at $x$.

Now we will define a special operator that will serve as a means of formalizing the questions algorithm.

Definition: We define the implied derivative to be an operator that takes in a function $f$ and returns a set of functions as shown by the expression $f^{\to} = \{g | \forall_{x \in R} (g(x) = f^+(x)) \lor (g(x) = f^-(x))\}$.

We will define a piecewise constant function via the following:

A piecewise constant function $g$ is any function that has a left and right hand derivative of $0$ everywhere.

We now prove the following propositions.

The implied derivative of any result of steps 1-4 is the original function $f$.

We now define an implied antiderivative of some function $f$ to be any function $F$ such that $f$ is an implied derivative of $F$.

Any two implied antiderivatives of some function $f$ known as $F$ and $F'$ differ by some unique piecewise constant function $C$.

Now we must go one step further and prove the following.

If $F$ is an implied antiderivative of $f$, then for all piecewise constant functions $C$ we have that $F + C$ is an implied antiderivative of $f$.

Because all results of the first 4 steps of the algorithm are an implied antiderivative of the imput we can state that adding a piecewise constant function to it results in another implied antiderivative. Therefore, all results of the algorithm are continuous implied antiderivatives of the input. Now we shall relate implied antiderivatives to integrals.

Suppose we have two continuous implied antiderivatives of $f$ caled $F$ and $F'$. Then there exists a unique constant $c$, such that $F = F' + c$.

Now we go one step further.

Suppose we have a continuous implied antiderivative of $f$ caled $F$. Then for all constants $c$, $F + c$ is a continuous implied antiderivative of $f$.

Now that we have done that we only have one theorem left to prove.

If $F(x) = \int_0^x f(x)$ then $F$ is a continuous implied antiderivative of $f$.

Since all integrals are continuous implied antiderivatives of the input to the algorithm we only need to show that all continuous implied antiderivatives are integrals of the input. Because all such implied antiderivatives differ by a constant, we have that they differ by some integral by a constant. Since anything that differs from an integral by a constant is also an integral we have that all continuous implied antiderivatives are integrals.

Therefore, any result of the algorithm is a valid integral of the input.

I will fill in more of the sub proofs later on. It is late and I am tired. I have to say, this whole thing quite literally took me two years to prove and finally I have pretty much done it. Hopefully nobody takes offense to me needing a minor break before proving all these subtheorems.

• Considering the monstrosity this one was/will be to prove I dont even think extending this to differential equations is currently feasible. – The Great Duck Dec 27 '17 at 7:07