In the course of work, I deduced such an expression.

$$ p(t)=\int\limits _{-\infty}^{\infty}\begin{cases} 1/x_{max}, & 0\leq t<x\\ 0, & other \end{cases}\cdot dx, $$ where $x \in [0,x_{max}]$ ($x_{max} = 10$ for example),

$t$ - is variable.

I have built a graph that is calculated numerically using python.

import numpy as np
import matplotlib.pyplot as plt

x_max = 10
t = np.linspace(-x_max * 0.1, x_max * 1.1, 1000)

num_point = 1000
pre_p = np.zeros((num_point, t.size))
x = np.linspace(0, x_max, num_point)

for i, this_x in enumerate(x):
    pre_p[i] = np.where((0 <= t) & (t < this_x),  1/x_max, 0)

p = np.trapz(pre_p, x=x, axis=0)

plt.plot(t, p)

enter image description here

I intuitively figured out how this function should look in symbolic form.

$$ p(t)=\begin{cases} 1-\frac{t}{x_{max}}, & 0\leq t<x_{max}\\ 0, & other \end{cases} $$

But how can the integral be taken symbolically according to the rules of mathematics? The thing is, my function is piecewise. And the variable by which I integrate is right in the condition. It would be great to have links to literature or an article, thanks.

  • $\begingroup$ Your notation of the map being integrated in the first integral is rather confusing. It will help if: (1) you define what $x_{max}, t_{max}$ are and (2) write the function $f(x,t)$ being integrated outside of the integral. Is it a function of two variables $t,x$? $\endgroup$ Apr 20 '21 at 12:47
  • 1
    $\begingroup$ Seeing as the graph has no additional area when x=0, it can be done that $Area=\int_0^{10}1-\frac{x}{10} dx$ after finding the line with the points (0,1) and (10,0) as the endpoints to get Area=$(x-\frac{x^2}{20})|_0^{10}$=$10-\frac{10^2}{20}-0$=5 $\endgroup$ Apr 20 '21 at 12:48
  • $\begingroup$ corrected the question. I am interested in taking the integral. $\endgroup$ Apr 20 '21 at 13:00

Define $$f(t,x) = \begin{cases} \frac 1{x_{\max}},& t\in[0,x]\\0,& t\notin [0,x]\end{cases}$$

Then $$p(t) = \int_0^{x_\max} f(t, x)\,dx$$ Where the limits are from $0$ to $x_\max$, not $-\infty$ to $\infty$, because you said yourself that $x\in [0, x_\max]$. Note that in your definition of $p(t), x$ is a dummy variable, not an actual part of the definition. Its only purpose is to make the notation work. You could switch to a different variable (other that $t$ and $x_\max$, which already have roles) without changing the meaning at all. So in saying $x\in [0, x_\max]$, you are just admitting that you goofed up the limits of the integration.

Now break it out into two cases:

  • $t < 0$ or $t > x_\max$. Then $t\notin [0,x]$ for all $x$ in the limits, so $f(t,x) = 0$ and $\int_0^{x_\max} 0\,dx = 0$
  • $t \in [0, x_\max]$. Then $$\begin{align}p(t) &= \int_0^{x_\max} f(t, x)\,dx \\&= \int_0^t f(t, x)\,dx + \int_t^{x_\max} f(t, x)\,dx\\&=\int_0^t 0\,dx + \int_t^{x_\max} \dfrac 1{x_\max}\,dx\\&= 0 + \dfrac 1{x_\max}(x_\max -t)\\&=1 - \dfrac t{x_\max}\end{align}$$

Putting it together: $$p(t) = \begin{cases}0,& t < 0\\1 - \dfrac t{x_\max}, & 0 \le t \le x_\max\\0,& x_\max < t\end{cases}$$

  • $\begingroup$ It's great. I began to forget how to take integrals. It's great that there are people who can help. $\endgroup$ Apr 21 '21 at 5:56

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.