Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The title says it all. Reading posts such as this however, I'm not seeing how to do this. This is the simplest example that can show my problem.

f = c/x;
a = a1;
b = b1;
NIntegrate[f, {x, a, b}] /. {a1 -> 1, b1 -> 4, c -> 2}
share|improve this question
up vote 4 down vote accepted

You just have to make the substitution in both the function and limits before NIntegrate. Simple example:

f = c/x;
NIntegrate[f /. #, {x, a, b} /. #] & @ {a -> 1, b -> 4, c -> 2}
share|improve this answer

Maybe little odd method:

g[f, {x, a, b}] /. {a1 -> 1, b1 -> 4, c -> 2, g -> NIntegrate}
share|improve this answer

Holding NIntegrate Unevaluted also works.

Unevaluated[NIntegrate[f, {x, a, b}]] /. {a -> 1, b -> 4, f -> 2/x}
(* 2.77259 *)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.