1
$\begingroup$

For example, I have the following integral expression:

g[x, y] = Integrate[f[x, y],x]

How can I modify the above expression to achieve the following definite integral:

h[x,y,a_,b_] = Integrate[f[x, y],{x,a,b}]

i.e. I am looking for a method to convert indefinite to definite integral.

$\endgroup$

2 Answers 2

3
$\begingroup$

Let us introduce the following rule:

Clear[k];

rule=Integrate[k_[x, y], x] -> Integrate[k[x, y], {x, a, b}];

Then

Integrate[f[x, y], x] /. rule

yields

enter image description here

Have fun!

$\endgroup$
2
$\begingroup$

You did not show a use case of why what you are doing is needed.

An option is to take advantage of Mathematica function name overloading.

Clear["Global`*"];
h[f_, x_, y_] := Integrate[f[x, y], x]
h[f_, x_, y_, a_, b_] := Integrate[f[x, y], {x, a, b}]

And now you can do

Mathematica graphics

I do not see a reason to make things more complicated, unless the above does not do what you wanted.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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