# how to make DSolve not generate Assumptions in the solution?

Sometimes Mathematica generates solutions to a PDE which are hard to read, since it attaches assumptions to the result. If a user knows these assumptions are obvious physically, they might want to avoid having them included in the output so that it is easier to read.

I do not know how to tell Mathematica to avoid showing these assumptions. The option GenerateConditions->False does not work here, since this is a call to DSolve which does not accept this option. But DSolve internally uses Integrate

Is there other ways to do this? Here is a MWE

## Example 1

Remove[L0];
ClearAll[u,t,k,x,f];
pde=D[u[x,t],t]==k D[u[x,t],{x,2}];
bc={Derivative[1,0][u][0,t]==0,Derivative[1,0][u][L0,t]==0}
ic=u[x,0]==f[x];
sol=DSolve[{pde,bc,ic},u[x,t],{x,t}];
sol=sol/.{K->n,K->x} The solution is correct. But I'd like to see it as I do not know how to pass GenerateConditions->False to Integrate which is internally used by DSolve.

Btw, Maple generates the same answer, without those assumptions by default, which makes it little easier to read

restart;
L:='L'; u:='u'; t:='t'; x:='x';
interface(showassumed=0);
assume(L>0);
pde:=diff(u(x,t),t)=k*diff(u(x,t),x$2); bc:=D(u)(0,t)=0,D(u)(L,t)=0: ic:=u(x,0)=f(x): sol:=pdsolve([pde,bc,ic],u(x,t)): sol:=subs(_Z2=n,sol); ## Example 2 It also depends on the PDE and the boundary conditions. For example, in this one, Mathematica generates strange Assumptions->True in the result, which I do not understand, and did not include assumptions on time or length or k as above. But the PDE solution is correct Remove[L0]; ClearAll[u,t,k,x]; pde=D[u[x,t],t]==k D[u[x,t],{x,2}]; bc={u[0,t]==0,u[L0,t]==0}; ic=u[x,0]==f[x]; sol=DSolve[{pde,bc,ic},u[x,t],{x,t}]; sol=sol/.K->n In summary, I'd just like an option to disable display of Assumptions in result if possible. I convert these results to Latex, and with assumptions there, the output is hard to read. Using version 11.3 on windows. ## 3 Answers How about modifying $PrePrint?:

(* Solution 1 *)
$PrePrint = (# /. HoldPattern@Integrate[a__, (_ -> _) ..] :> Integrate[a]) &; (* Solution 2 *)$PrePrint = (# /. HoldPattern@Integrate[a__, OptionsPattern[]] :> Integrate[a]) &;


Notice we've only changed the display, sol and Out[…] are still expressions involving Assumptions.

I hate to state the obvious, but does the following do what you want?

% /. Integrate[x___, Assumptions -> _, y___] :> Integrate[x, y]


If you just want to improve the TeXForm output, you could modify the TraditionalForm Integrate formatting definition:

Unprotect[Integrate];
Integrate /: MakeBoxes[
Integrate[a__, OptionsPattern[]],
] /;! TrueQ@$IntFlag := Block[{$Foo=True},

Integrate[f[x]Sin[x],{x,0,L0},Assumptions->True] //TeXForm

$\int_0^{\operatorname{L0}} f(x) \sin (x) \, dx$