<<Declare.m

?Declare

?NewDeclare

Declare[{x,y},Real, {n,m},Integer, a,NonNegative]

(* Now Mathematica can do several useful simplifications: *)
Sqrt[x^2]

(x^4)^(1/7)

RealQ[ Sqrt[x^2 + y^4] ]

(* Also uncertain cases are recognized: *)
RealQ[ Sqrt[ x^2 - y^2 ] ]

Then use the standard package to obtain real and imaginary parts.

<<Algebra`ReIm`

Re[ (x+I y)^2 Exp[I a Sqrt[x^2+y^2]] ]

This is somewhat simpler than the form returned by the built-in ComplexExpand.

ComplexExpand[(x+I y)^2 Exp[I a Sqrt[x^2+y^2]]]

Many definite integrals simplify very nicely when using Declare. This is the original integral, note that none of the parameters has any declarations yet:

f = Integrate[Exp[-I w t]/(w-I w0),{w,-Infinity,Infinity}]

The above result is correct fot all (real) w0 and t, but not very pleasant to read. Using Declare we can at once see that the integral is zero if w0>0 and t>0.

Declare[{w0,t},Positive]; f

Declare[t,Negative]; f

With NewDeclare you can make the declaration more general again:

NewDeclare[t,Real]; f

(-1)^(2n)

Anytime you can use ? to see which properties are currently in force for a given variable:

?n