If we have some discontinuous function
$f(x) = \begin{cases} f_1(x) : x \in [x_1, x_2] \ f_2(x) : x \notin [x_1, x_2] \end{cases}$
One way to handle this function in calculations is to carefully check wether or not your specific x-value that you're working with is inside the domain
Where
For example:
While
This notation not only makes the function a bit more compact, it also allows us to use common methods such as factoring, multiplication, division, etc on these individual terms, just like when handling any normal function.
For example, if we have some function
We can use standard algebra to draw conclusions about the statement:
The previous statements could be made using standard notation, but would be a lot more cumbersome, and a lot less intuitive.
This also means that if we want to evaluate the expression at a certain x-value, say
$b = \frac{c}{f_1(x_p)\cdot(x_p\in[x_1, x_2]) + f_2(x_p) \cdot (x_p\notin[x_1,x_2])};$; Then:
We can also factor an expression with booleans, for example, if we have the following:
This is something that, as far as I'm aware, you cannot do with the standard notation. This often comes in handy, and we'll see an example of that later.
If we have some function
Where
We will thus proceed to find an expression for the primitive function to
Let
Let:
From the definition of an integral as a Riemann-sum we get that:
There are now three cases:
1:
2:
3:
Case 1:
$$\begin{align*} \int_{0}^{X}f_1(x)(x\in[x_1,x_2])dx
=& \lim_{\Delta x \rightarrow 0} \sum_{i=1}^{\frac{X}{\Delta x}} f_1(\Delta x \cdot i)\cdot(\Delta x \cdot i \in[x_1,x_2])\cdot \Delta x \
&\Bigg|\Delta x \cdot \frac{X}{\Delta x} = X , X\notin[x_1,x_2]\Longleftrightarrow \Delta x\cdot i \notin[x_1,x_2] \
=& \lim_{\Delta x \rightarrow 0} \sum_{i=1}^{\frac{X}{\Delta x}} f_1(\Delta x \cdot i)\cdot 0 \cdot \Delta x \
&= 0 \end{align*}$$
Case 2:
$$\begin{align*} \int_{0}^{X}f_1(x)(x\in[x_1,x_2])dx
=& \int_{0}^{x_1}f_1(x)(x\in[x_1,x_2])dx + \int_{x_1}^{X}f_1(x)(x\in[x_1,x_2])dx \
=& \lim_{\Delta x \rightarrow 0} \sum_{i=1}^{\frac{x_1-\Delta x}{\Delta x}} f_1(\Delta x \cdot i)\cdot(\Delta x \cdot i \in[x_1,x_2))\cdot \Delta x \ &+ \sum_{i=1}^{\frac{X - x_1}{\Delta x}} f_1(x_1 + \Delta x \cdot i)\cdot(x_1 + \Delta x \cdot i \in[x_1,x_2])\cdot \Delta x \
&\Bigg|\Delta x \cdot \frac{x_1 - \Delta x}{\Delta x} = x_1 - \Delta x, x_1 - \Delta x \notin[x_1,x_2]\Longleftrightarrow \Delta x\cdot i \notin[x_1,x_2] \ &\Bigg|x_1 + \Delta x \cdot \frac{X-x_1}{\Delta x} = x_1 + X - x_1 = X, X\in[x_1,x_2]\Longleftrightarrow x_1 + \Delta x\cdot i \in[x_1,x_2] \
=& \lim_{\Delta x \rightarrow 0} \sum_{i=1}^{\frac{x_1 - \Delta x}{\Delta x}} f_1(\Delta x \cdot i)\cdot 0 \cdot \Delta x \ &+\sum_{i=1}^{\frac{X - x_1}{\Delta x}} f_1(x_1 + \Delta x \cdot i)\cdot 1\cdot \Delta x \
=& \lim_{\Delta x \rightarrow 0} \sum_{i=1}^{\frac{X - x_1}{\Delta x}} f_1(x_1 + \Delta x \cdot i)\cdot \Delta x \
=& \int_{x_1}^{X}f_1(x)dx
\end{align*}$$
Case 3:
$$\begin{align*} \int_{0}^{X}f_1(x)(x\in[x_1,x_2])dx =& \int_{0}^{x_1}f_1(x)(x\in[x_1,x_2])dx + \int_{x_1}^{x_2}f_1(x)(x\in[x_1,x_2])dx + \int_{x_2}^{X}f_1(x)(x\in[x_1,x_2])dx\
&= \lim_{\Delta x \rightarrow 0} \sum_{i=1}^{\frac{x_1 - \Delta x}{\Delta x}} f_1(\Delta x \cdot i)\cdot(\Delta x \cdot i \in[x_1,x_2])\cdot \Delta x \ &+ \sum_{i=1}^{\frac{x_2 - x_1}{\Delta x}} f_1(x_1 + \Delta x \cdot i)\cdot(x_1 + \Delta x \cdot i \in[x_1,x_2])\cdot \Delta x \ &+ \sum_{i=1}^{\frac{X - x_2}{\Delta x}} f_1(x_2 + \Delta x \cdot i)\cdot(x_2 + \Delta x \cdot i \in[x_1,x_2])\cdot \Delta x \
&\Bigg|x_1 + \Delta x \cdot \frac{x_2-x_1}{\Delta x} = x_1 + x_2 - x_1 = x_2, x_2 \in[x_1,x_2]\Longleftrightarrow x_1 + \Delta x\cdot i \in[x_1,x_2] \
&\Bigg|x_2 + \Delta x \cdot \frac{X-x_2}{\Delta x} = x_2 + X - x_2 = X, X \notin[x_1,x_2]\Longleftrightarrow x_1 + \Delta x\cdot i \notin[x_1,x_2] \
=& \lim_{\Delta x \rightarrow 0} \sum_{i=1}^{\frac{x_1 - \Delta x}{\Delta x}} f_1(\Delta x \cdot i)\cdot 0 \cdot \Delta x \ &+ \sum_{i=1}^{\frac{x_2 - x_1}{\Delta x}} f_1(x_1 + \Delta x \cdot i)\cdot 1\cdot \Delta x \ &+ \sum_{i=1}^{\frac{X - x_2}{\Delta x}} f_1(x_2 + \Delta x \cdot i)\cdot 0 \cdot \Delta x \
=& \lim_{\Delta x \rightarrow 0} \sum_{i=1}^{\frac{x_2 - x_1}{\Delta x}} f_1(x_1 + \Delta x \cdot i)\cdot \Delta x \
=& \int_{x_1}^{x_2}f_1(x)dx \end{align*}$$
We thus get the following:
Which can be written neatly in boolean-multiplication form as:
If we want to find the integral to the function from a lower bound to an upper bound, say
From the fundamental theorem of calculus we know that:
We thus get:
We can use these expressions to also get some useful short-hands:
Using u-substitution: $$\begin{cases} let: u = x-x_1 \ x\in [x_1,x_2] \Longleftrightarrow u\in[0,x_2-x_1]\ x\in [x_2,\infty) \Longleftrightarrow u\in[x_2-x_1,\infty)\ \frac{du}{dx} = 1 \Longleftrightarrow du = dx \end{cases}$$
Whereby:
While this is not native to discrete functions, it will come in very handy later for some of our later derivations. Thus:
With this in mind, finding the double-integral becomes trivial:
Let:
$$\begin{align*} =& (\mathbb{F}_1(x)-\mathbb{F}_1(x_1) - F_1(x_1)x + F_1(x_1)x_1)(x\in[x_1,x_2])\ &+(\mathbb{F}_1(x_2)-\mathbb{F}_1(x_1) - F_1(x_1)x_2 + F_1(x_1)x_1)(x\in(x_2,\infty))\ &+ (F_1(x_2)x - F_1(x_2)x_2 - F_1(x_1)x + F_1(x_1)x_2)(x\in(x_2,\infty))\ &+ (F_1(x_2)\infty - F_1(x_2)x_2 - F_1(x_1)\infty + F_1(x_1)x_2)(x\in(x_2,\infty))\
\end{align*}$$
As
Boolean 0 is, in lack of a better word, "stronger" than infinity, which makes intuitive sense, since it's meant to represent true or false, and thus wether or not a term should be included at all or not. We will thus use the bold-notation
Def:
Thus:
$$\begin{align*} {\int\int}_{0}^{X}f_1(x)(x\in[x_1, x_2])dx^2 =& (\mathbb{F}_1(x)-\mathbb{F}_1(x_1) - F_1(x_1)(x - x_1))(x\in[x_1,x_2])\ &+(\mathbb{F}_1(x_2)-\mathbb{F}_1(x_1) - F_1(x_1)(x_2 - x_1))(x\in(x_2,\infty))\ &+ (F_1(x_2) - F_1(x_1))(x-x_2)(x\in(x_2,\infty))\
\end{align*}$$
But we can go further.
Let's say that we want to find the n'th integral:
Let
Continuing the pattern, we get:
$$\begin{align*} \int\int\int {}{\dots}^{;n} \int{X}^{0}f_1(x)(x\in[x_1,x_2])dx^n = \dots
=\int\int\int {}{\dots}^{n-3} \int{X}^{0}&
(F_1^3(x)-F_1^3(x_1) - F_1^2(x_1)(x - x_1) - \frac{1}{2}F_1(x_1)(x - x_1)^2)(x\in[x_1,x_2])\ &+ (F_1^3(x_2)-F_1^3(x_1) - F_1^2(x_1)(x_2 - x_1) - \frac{1}{2}F_1(x_1)(x_2 - x_1)^2)(x\in(x_2,\infty))\ &+ (\mathbb{F}_1(x_2)-\mathbb{F}_1(x_1) - F_1(x_1)(x_2 - x_1))(x-x_2)(x\in(x_2,\infty))\ &+ (F_1(x_2) - F_1(x_1))\frac{1}{2}(x-x_2)^2(x\in(x_2,\infty))
dx^{n-3} \
= \int\int\int {}{\dots}^{n-4} \int{X}^{0}&
(F_1^4(x) - F_1^4(x_1) -F_1^3(x_1)(x-x_1) - \frac{1}{2}F_1^2(x_1)(x - x_1)^2 - \frac{1}{6}F_1(x_1)(x - x_1)^3)(x\in[x_1,x_2])\ &+ (F_1^4(x_2) - F_1^4(x_1) -F_1^3(x_1)(x_2-x_1) - \frac{1}{2}F_1^2(x_1)(x_2 - x_1)^2 - \frac{1}{6}F_1(x_1)(x_2 - x_1)^3)(x\in(x_2,\infty))\ &+ (F_1^3(x_2)-F_1^3(x_1) - F_1^2(x_1)(x_2 - x_1) - \frac{1}{2}F_1(x_1)(x_2 - x_1)^2)(x-x_2)(x\in(x_2,\infty))\ &+ (\mathbb{F}_1(x_2)-\mathbb{F}_1(x_1) - F_1(x_1)(x_2 - x_1))\frac{1}{2}(x-x_2)^2(x\in(x_2,\infty))\ &+ (F_1(x_2) - F_1(x_1))\frac{1}{6}(x-x_2)^3(x\in(x_2,\infty))
dx^{n-4} \
\end{align*}$$
While this process doesn produce a lot of residual terms, if we look close enough we can see a pattern emerge. Sumarizing this pattern, we get:
$$\begin{align*} \int\int\int {}{\dots}^{;n} \int{X}^{0}&f_1(x)(x\in[x_1,x_2])dx^n = \dots \
=& F_1^n(x)(x\in[x_1, x_2]) - \sum_{i=1}^{n} \frac{1}{(n-i)!}F_1^{i}(x_1)(x-x_1)^{n-i}(x\in[x_1, x_2]) \
&+ F_1^n(x_2)(x\in(x_2, \infty)) - \sum_{i=1}^{n} \frac{1}{(n-i)!}F_1^{i}(x_1)(x_2-x_1)^{n-i}(x\in(x_2, \infty)) \
&+ \bigg[F_1^{n-2}(x_2)(x\in(x_2, \infty)) - \sum_{i=1}^{n-2} \frac{1}{(n-i-2)!}F_1^{i}(x_1)(x_2-x_1)^{n-i-2}(x\in(x_2, \infty))\bigg]\frac{1}{2}(x-x_2)^2 \ \vdots\
&+ \bigg[F_1^{n-2}(x_2)(x\in(x_2, \infty)) - \sum_{i=1}^{1} \frac{1}{(n-i - (n-1))!}F_1^{i}(x_1)(x_2-x_1)^{n-i - (n-1)}(x\in(x_2, \infty))\bigg]\frac{1}{(n-1)!}(x-x_2)^{(n-1)} \
=& F_1^n(x)(x\in[x_1, x_2]) - \sum_{i=1}^{n} \frac{1}{(n-i)!}F_1^{i}(x_1)(x-x_1)^{n-i}(x\in[x_1, x_2]) \ &+ \sum_{m=0}^{n-1} \bigg[F_1^{n-m}(x_2)(x\in(x_2, \infty)) - \sum_{i=1}^{n-m} \frac{1}{(n-i - m)!}F_1^{i}(x_1)(x_2-x_1)^{n-i - m}(x\in(x_2, \infty))\bigg]\frac{1}{m!}(x-x_2)^{m} \end{align*}$$
Thus, we get the final formula:
While clunky, this sum only requires as much integration as integrating