(*^

::[paletteColors = 128; 
	fontset = title, "New York", 24, L3, center, bold, nohscroll;
	fontset = subtitle, "New York", 18, L2, center, bold, nohscroll;
	fontset = subsubtitle, "New York", 14, L2, center, bold, nohscroll;
	fontset = section, "New York", 14, L2, bold, nohscroll, grayBox;
	fontset = subsection, "New York", 12, L2, bold, nohscroll, blackBox;
	fontset = subsubsection, "New York", 10, L2, bold, nohscroll, whiteBox;
	fontset = text, "New York", 10, L2, nohscroll;
	fontset = smalltext, "New York", 9, L2, nohscroll;
	fontset = input, "Courier", 10, L2, bold, nowordwrap;
	fontset = output, "Courier", 10, L2, nowordwrap;
	fontset = message, "Courier", 10, L2, R65535, nowordwrap;
	fontset = print, "Courier", 10, L2, nowordwrap;
	fontset = info, "Courier", 10, L2, nowordwrap;
	fontset = postscript, "Courier", 12, L2, nowordwrap;
	fontset = name, "Geneva", 10, L2, italic, B65535, nowordwrap, nohscroll;
	fontset = header, "Times", 10, L2;
	fontset = footer, "Times", 12, L2, center;
	fontset = help, "Geneva", 10, L2, nohscroll;
	fontset = clipboard, "New York", 12, L2;
	fontset = completions, "New York", 12, L2, nowordwrap;
	fontset = network, "Courier", 10, L2, nowordwrap;
	fontset = graphlabel, "Courier", 12, L2, nowordwrap;
	fontset = special1, "New York", 12, L2, nowordwrap;
	fontset = special2, "New York", 12, L2, center, nowordwrap;
	fontset = special3, "New York", 12, L2, right, nowordwrap;
	fontset = special4, "New York", 12, L2, nowordwrap;
	fontset = special5, "New York", 12, L2, nowordwrap;]
:[font = input; ]
(*
This file demonstrates the use of the packages Declare.m together
with (modified) Trigonometry.m and standard ReIm.m.
The packages are assumed to be in directory Misc. Modify the << -
commands if necessary.
*)
:[font = input; startGroup; ]
(* Load in the package..*)
<<Misc/Declare.m
:[font = print; inactive; endGroup; ]
{Declare, NonPositive, RealQ, NonZero, EqnCanonical}
:[font = input; startGroup; ]
?Declare
:[font = info; inactive; endGroup; ]
Declare[a,Odd] or   Declare[{x,y},Real] etc. Possible declarations are  
   Odd,Even,Integer,Real,Positive,Negative,   NonPositive,NonNegative.
:[font = input; ]
Declare[{x,y}, Real]; Declare[{n,m},Integer];
Declare[a,NonNegative]
:[font = input; startGroup; ]
(* Now Mathematica can do several useful simplifications: *)
Sqrt[x^2]
;[s]
3:0,0;7,1;18,0;71,-1;
3:2,13,9,Courier,1,10,0,0,0;1,12,9,Courier,3,10,0,0,0;0,12,9,Courier,0,10,0,0,0;
:[font = output; inactive; output; endGroup; ]
Abs[x]
;[o]
Abs[x]
:[font = input; startGroup; ]
(x^4)^(1/7)
:[font = output; inactive; output; endGroup; ]
Abs[x]^(4/7)
;[o]
      4/7
Abs[x]
:[font = input; startGroup; ]
RealQ[ Sqrt[x^2 + y^4] ]
:[font = output; inactive; output; endGroup; ]
True
;[o]
True
:[font = input; startGroup; ]
(* Equations can be simplified with EqnCanonical: *)
(x^2 + y^2 + 1) f[x] g[y] == 0 //EqnCanonical
;[s]
2:0,0;98,0;99,-1;
3:2,13,9,Courier,1,10,0,0,0;0,12,9,Courier,3,10,0,0,0;0,12,9,Courier,0,10,0,0,0;
:[font = output; inactive; output; endGroup; ]
f[x]*g[y] == 0
;[o]
f[x] g[y] == 0
:[font = input; startGroup; ]
x^2 + y^2 + 1 == 0 //EqnCanonical
:[font = output; inactive; output; endGroup; ]
False
;[o]
False
:[font = input; startGroup; ]
(x + a)/(x^2 + y^2) == 0 //EqnCanonical
:[font = output; inactive; output; endGroup; ]
a + x == 0
;[o]
a + x == 0
:[font = input; startGroup; ]
(* Also negative cases are recognized: *)
RealQ[ Sqrt[ x^2 - y^2 ] ]
:[font = output; inactive; output; endGroup; ]
RealQ[(x^2 - y^2)^(1/2)]
;[o]
            2    2
RealQ[Sqrt[x  - y ]]
:[font = input; startGroup; ]
(* This is left unevaluated because it can be real if
   x== 0 and y == 0: *)
RealQ[ Sqrt[ - x^2 - y^2 ] ]
:[font = output; inactive; output; endGroup; ]
RealQ[(-x^2 - y^2)^(1/2)]
;[o]
             2    2
RealQ[Sqrt[-x  - y ]]
:[font = input; ]
(* Together with the standard package ReIm.m the real and imaginary
  parts are simplified nicely: *)
<<Algebra/ReIm.m
:[font = input; startGroup; ]
Declare[k0, Positive];
Re[ Sqrt[x^2 + y^2] Exp[I k0 Sqrt[x^2 + y^2]] ]
:[font = output; inactive; output; endGroup; ]
(x^2 + y^2)^(1/2)*Cos[k0*(x^2 + y^2)^(1/2)]
;[o]
      2    2               2    2
Sqrt[x  + y ] Cos[k0 Sqrt[x  + y ]]
:[font = input; startGroup; ]
(* Also Even and Odd integers are recognized: *)
EvenQ[2n]
:[font = output; inactive; output; endGroup; ]
True
;[o]
True
:[font = input; startGroup; ]
OddQ[(2n+3)(4m-9)]
:[font = output; inactive; output; endGroup; ]
True
;[o]
True
:[font = input; startGroup; ]
OddQ[2^(2n)]
:[font = output; inactive; output; endGroup; ]
!EvenQ[2^(2*n)]
;[o]
        2 n
!EvenQ[2   ]
:[font = input; startGroup; ]
(* If we tell Mathematica that n > 0, the last result can
   be simplified: *)
Declare[n,Positive];
OddQ[2^(2n)]
;[s]
3:0,0;14,1;25,0;113,-1;
3:2,13,9,Courier,1,10,0,0,0;1,12,9,Courier,3,10,0,0,0;0,12,9,Courier,0,10,0,0,0;
:[font = output; inactive; output; endGroup; ]
False
;[o]
False
:[font = input; ]
(* The package Misc/Trig.m has been slightly modified
   from the standard package Algebra/Trigonometry.m to take
   advantage of Declare.m. Let's load it..*)
<<Misc/Trig.m
:[font = input; startGroup; ]
Sin[2 Pi n] //TrigCanonical
:[font = output; inactive; output; endGroup; ]
0
;[o]
0
:[font = input; startGroup; ]
Cos[n Pi] //TrigCanonical
:[font = output; inactive; output; endGroup; ]
(-1)^n
;[o]
    n
(-1)
:[font = input; startGroup; ]
Cos[(2n+1)Pi] //TrigCanonical
:[font = output; inactive; output; endGroup; ]
-1
;[o]
-1
:[font = input; startGroup; ]
Tan[(n^2 + n - 7) Pi]//TrigCanonical
:[font = output; inactive; output; endGroup; ]
0
;[o]
0
:[font = input; startGroup; ]
Tan[(n+1)Pi]//TrigCanonical
:[font = output; inactive; output; endGroup; ]
0
;[o]
0
:[font = input; startGroup; ]
(* There are also some other additional definitions, like:*)
IntegerQ[Floor[x]]
:[font = output; inactive; output; endGroup; ]
True
;[o]
True
^*)