# Integral with a max function inside

• Jan 9th 2019, 06:49 AM
Jo37
Integral with a max function inside
Hi all ! :)

I would like to integrate this equation, to check if the values I get by numerical simulation are correct. My initial condition is $\displaystyle e(0)=0$ and I would like to check other values.
However, I don't know how to deal with the max function so I can't compute the exact solution.
$\displaystyle \frac{\partial e}{\partial t} = \frac{1}{\eta }max(0,\sigma-\sigma^*)$ with $\displaystyle \sigma=1-e^{-4t}$
In my specific case, I set the parameters to $\displaystyle \eta = 1/4$, $\displaystyle \sigma^* = 1/2$

Thank you very much for your help !
• Jan 9th 2019, 08:16 AM
topsquark
Re: Integral with a max function inside
Quote:

Hi all ! :)

I would like to integrate this equation, to check if the values I get by numerical simulation are correct. My initial condition is $\displaystyle e(0)=0$ and I would like to check other values.
However, I don't know how to deal with the max function so I can't compute the exact solution.
$\displaystyle \frac{\partial e}{\partial t} = \frac{1}{\eta }max(0,\sigma-\sigma^*)$ with $\displaystyle \sigma=1-e^{-4t}$
In my specific case, I set the parameters to $\displaystyle \eta = 1/4$, $\displaystyle \sigma^* = 1/2$

Thank you very much for your help !

Split the integral into pieces. One interval will be for $\displaystyle 0 \geq \sigma - \sigma *$ and the other $\displaystyle 0 < \sigma - \sigma *$.

-Dan
• Jan 10th 2019, 07:45 AM
Jo37
Re: Integral with a max function inside
Thanks for the reply ! I think my result is still wrong. I don't get the same behavior as the original plot I was given.
Here is my reasoning :

$\displaystyle e(t)= \int_{-oo}^{0 >=\sigma-\sigma^*} 0dt \; +\int_{0 <\sigma-\sigma^*}^{+oo}4(1-e^{-4t}-0.5)dt \\ \left\{\begin{matrix} e(t)= 2t + e^{-4t} + C& if & 0<\sigma-\sigma^*\\ & else & e(t)= 0 \end{matrix}\right.$

In my case e(0)=0 so C=-1.
• Jan 10th 2019, 08:32 AM
romsek
Re: Integral with a max function inside
$\displaystyle \int \limits_0^t~4 \max\left(0,1-e^{-4\tau}-\dfrac 1 2\right)~d\tau =$

$\displaystyle \int \limits_{\frac{\ln(2)}{4}}^t~2 - 4e^{-4\tau}~d\tau =$

$\large \left. 2\tau + e^{-4\tau} \right|_{\frac{\ln(2)}{4}}^t =$

$2t + e^{-4t} - \left(\dfrac{\ln(2)}{2} + \dfrac 1 2\right) =$

$2t + e^{-4t} - \dfrac 1 2 - \dfrac{\ln(2)}{2}$
• Jan 10th 2019, 10:15 AM
Jo37
Re: Integral with a max function inside
However, the graph I get when plotting this equation is still weird. If one starts at $\displaystyle e(0)=0$ and the derivative stays at 0 until $\displaystyle ln(2)/4$, there should be a constant plateau before the function increases. This is not what we get when plotting the solution.