# Numerically integrate a function whose lower limit depends on a parameter?

**URL:** <https://community.wolfram.com/t/numerically-integrate-a-function-whose-lower-limit-depends-on-a-parameter/12561>\
**Category:** Questions\
**Tags:** calculus, numerical-computation\
**Created:** [June 5, 2018, 7:02pm UTC](https://community.wolfram.com/t/numerically-integrate-a-function-whose-lower-limit-depends-on-a-parameter/12561 "2018-06-05T19:02:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohamedalzenad](https://avatars.discourse-cdn.com/v4/letter/m/b3f665/32.png) [@mohamedalzenad](https://community.wolfram.com/u/mohamedalzenad)\
**Post date:** [June 5, 2018, 7:02pm UTC](https://community.wolfram.com/t/numerically-integrate-a-function-whose-lower-limit-depends-on-a-parameter/12561/1 "2018-06-05T19:02:18Z")

</div>

I have a function f(r) that I want to integrate numerically. The code is `NIntegrate[f[r], {r, lowerlimit[r], Infinity}] ` . The lower limit is given by  
lowerlimit=c if r\<=100 and lowerlimit=2\*r otherwise, note that r can not be negative and c is some positive number. I wonder how to implement this integral.

---

<div class="post-metadata">

**Author:** ![jpd](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/jpd/32/34994_2.png) [@jpd](https://community.wolfram.com/u/jpd)\
**Post date:** [June 5, 2018, 7:23pm UTC](https://community.wolfram.com/t/numerically-integrate-a-function-whose-lower-limit-depends-on-a-parameter/12561/2 "2018-06-05T19:23:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mohamedalzenad](https://avatars.discourse-cdn.com/v4/letter/m/b3f665/32.png) [@mohamedalzenad](https://community.wolfram.com/u/mohamedalzenad)\
**Post date:** [June 5, 2018, 9:11pm UTC](https://community.wolfram.com/t/numerically-integrate-a-function-whose-lower-limit-depends-on-a-parameter/12561/3 "2018-06-05T21:11:57Z")

</div>

![20180605_170430.jpg](https://global.discourse-cdn.com/wolfram/original/1X/7ecdca3178821df7e6b040908504b6381a91f8c2.jpeg)

---

<div class="post-metadata">

**Author:** ![mohamedalzenad](https://avatars.discourse-cdn.com/v4/letter/m/b3f665/32.png) [@mohamedalzenad](https://community.wolfram.com/u/mohamedalzenad)\
**Post date:** [June 5, 2018, 9:16pm UTC](https://community.wolfram.com/t/numerically-integrate-a-function-whose-lower-limit-depends-on-a-parameter/12561/4 "2018-06-05T21:16:30Z")

</div>

Thank you John. I attached a picture of the problem to make it clearer

---

<div class="post-metadata">

**Author:** ![jpd](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/jpd/32/34994_2.png) [@jpd](https://community.wolfram.com/u/jpd)\
**Post date:** [June 5, 2018, 10:27pm UTC](https://community.wolfram.com/t/numerically-integrate-a-function-whose-lower-limit-depends-on-a-parameter/12561/5 "2018-06-05T22:27:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mohamedalzenad](https://avatars.discourse-cdn.com/v4/letter/m/b3f665/32.png) [@mohamedalzenad](https://community.wolfram.com/u/mohamedalzenad)\
**Post date:** [June 6, 2018, 4:14pm UTC](https://community.wolfram.com/t/numerically-integrate-a-function-whose-lower-limit-depends-on-a-parameter/12561/6 "2018-06-06T16:14:52Z")

</div>

Thank you John, this was so helpful
