This doesn't make any sense. You appear to be using the name r to refer to the variable of integration as well as an independent parameter. Please be clearer.
r
Thank you John. I attached a picture of the problem to make it clearer
On your paper, you have x as the variable of integration, which makes sense. Do that in your code. Define your function lowerlimit using Piecewise, Condition, or even If. Then your expression will, given a value for r, yield a result.
x
lowerlimit
Piecewise
Condition
If
Thank you John, this was so helpful