# The replacement function is an integral and the double integral yields a different answer than the normal double integral I am fairly new to Mathematica. I have a quick inquiry. The code is simple and just 3 lines. Trying to do a replacement rule as follows

``ruletrr = intsl[exp_] :> Integrate[exp, {u, u, 1}] intsl[Integrate[a[u],{u,0,u}]]/.ruletrr ``

So basically I want replace the expression inside the square brackets after ‘intsl’ with integrating the expression from u to 1. The expression inside the square bracket is in fact an integral as well. The integrand is a function of u. However, after the second line, the answer is as follows

``(1 - u)*Integrate[a[u], {u, 0, u}] ``

The answer means that Mathematica takes the expression inside the square bracker as a constant and not a function of u. Kindly copy the preceding line to see the integration symbol as I can’t do it here.

The problem is the first two line is equivalent to the following code line

``Integrate[a[u], {u, u, 1}, {u, 0, u}] ``

The answers are different. Can someone let me know where is the mistake here or why is the integral evaluated.

The entire code input is as follows as a summary

``ruletrr = intsl[exp_] :> Integrate[exp,{u,u,1}] intsl[Integrate[a[u],{u,0,u}]]/.ruletrr Integrate[a[u], {u, u, 1}, {u, 0, u}] ``

The first two lines are equivalent to the third line but the answers are different 