How to solve an integral if it looks like as follows:
$$\int^\infty_{-\infty}\max(\min(A,e^x)-B,0)f(x)\,dx,$$ where $A$ and $B$ are constant
Regards Ray
How to solve an integral if it looks like as follows:
$$\int^\infty_{-\infty}\max(\min(A,e^x)-B,0)f(x)\,dx,$$ where $A$ and $B$ are constant
Regards Ray
Copyright © 2021 JogjaFile Inc.
The integral is zero when $A\leq B$, since $\min(A,e^x)\leq A\leq B$ so $\max(\min(A,e^x)-B,0)=0$ for all $x$.
When $B<A$, we will break it up into three cases:
$$e^x<B\\B<e^x<A\\A<e^x$$
For $e^x<B$, $e^x<A$ and this $\min(e^x,A)=e^x$, and $\min(e^x,A)-B<0$ so the integrand is zero in this case.
For $B<e^x<A$, $\max(\min(A,e^x)-B,0)=e^x-B$.
For $A<e^x$, $\max(\min(A,e^x)-B,0) = A-B$.
So, your integral is:
$$\int_{\log B}^{\log A} (e^x-B)f(x)\,dx + \int_{\log A}^{\infty} (A-B)f(x)\,dx$$
At this point, it depends of $f(x).$
You'll have to do a little more work if $B$ or both can be negative.