# Display returned integral containing assumptions with integral sign

From solving the PDE example of the general 1 dim heat equation in Nasser Abbasi's site https://www.12000.org/my_notes/pde_in_CAS/maple_2019_and_mma_12/insu157.htm#x182-1810003.1.1 (his problem No 151) I get the described solution containing the integral

Integrate[f[x] Sin[(\[Pi] x n)/L], {x, 0, L}, Assumptions -> k > 0 && L > 0]

Instead of this output form, how can I display this integral with the integral sign, as it is displayed in Nasser's site, not showing the assumptions? Neither StandardForm nor TraditionalForm does this. Is taking out (e.g. manually) the assumptions from Integrate's arguments the only way? How can I have Mathematica output the solution with the integral displayed with the integral sign and without the assumptions? Can the assumptions (any assumptions) be taken out automatically from Integrate's arguments, e.g. by some kind of replacement? I can't find out what this general replacement rule would have to be.

Thanks for help!

• "Is taking out (e.g. manually) the assumptions from Integrate's arguments the only way?" - perhaps my definition of "manually" is a little different from yours, but: Integrate[f[x] Sin[(Pi x n)/L], {x, 0, L}, Assumptions -> k > 0 && L > 0] /. HoldPattern[Integrate][fun_, Longest[int : ({__} ..)], rest___] :> Integrate[fun, int]. If you wish, you could also employ Inactive[] somewhere. Commented Feb 2, 2020 at 14:23
• @J.M. This answers my question. Thanks a lot. Commented Feb 2, 2020 at 17:58
• @J.M. I don't think I understand your more elaborate pattern. Probably I'm overlooking something important. Would you mind explaining why it's needed? Commented Feb 2, 2020 at 19:19
• You might also use Interpretation: intForm[int : Verbatim[Integrate][f_, x : Except[_Rule] .., opts___Rule]] := Interpretation[ HoldForm[Integrate[f, x]], int]. Then integral // intForm. Commented Feb 2, 2020 at 20:50
• @Mr.Wizard 1. I don't want Integrate[] on the LHS to evaluate. 2. I want the rule to also catch multivariate integrals like Integrate[f[x] g[y + a], {x, 0, 1}, {y, 0, 1}, Assumptions -> (a > 0)]. Commented Feb 2, 2020 at 23:51

Depending on your needs consider \$PrePrint and MakeBoxes. Something like this:

MakeBoxes[
Integrate[a__, Assumptions -> _],
] := MakeBoxes[Integrate[a], fmt]


Now when you view the integral in TraditionalForm:

Integrate[f[x] Sin[(n π x)/L], {x, 0, L},
Assumptions -> k > 0 && L > 0] // TraditionalForm


$$\int_0^L f(x) \sin \left(\frac{\pi n x}{L}\right) \, dx$$

And TeXForm works too because by default is uses TraditionalForm:

Integrate[f[x] Sin[(n π x)/L], {x, 0, L},
Assumptions -> k > 0 && L > 0] // TeXForm

\int_0^L f(x) \sin \left(\frac{\pi  n x}{L}\right)\, dx

• Thanks a lot for your answer. This kind of global solution is indeed most appropriate for my needs. Commented Feb 3, 2020 at 13:31
• @RolandSalz Happy to help. Let me know if you have problem using this and I'll try to fix it. Commented Feb 4, 2020 at 4:38