$PrePrint = Chop
will work fine for suppressing small approximate numbers in the display of your results. However, it won't have an effect on the the output generated by Print:
expr = FourierDCT[FourierDCT[{0, 0, 1, 0, 0}, 2], 3]
{0, 0, 1., 0, 0}
Print[expr]
{0., 0., 1., 2.64289*10^-17, 1.54951*10^-18}
That's because $PrePrint (and also $Post) are applied after the expression has evaluated, which means (counter-intuitively) that Print has already printed by the time that $PrePrint does anything. (MatrixForm has nothing to do with the problem.)
To get Print to go along with the program, you could inject a Chop into it using the Villegas-Gayley hack:
Unprotect[Print];
Module[{inside},
Print[expr__] /; ! TrueQ[inside] :=
Block[{inside = True}, Print @@ Chop@{expr}]
]
Protect[Print];
Now we have
Print[expr]
{0, 0, 1., 0, 0}
Note that this kind of thing may lead you into trouble, since the display of expr now doesn't match its internal representation. For example, if you want to find the positions of the zero elements, by looking at the displayed form, you might think that Position[expr, 0] would do the trick. But really you would need Position[expr, _?(Chop[#] == 0 &)] (or Position[Chop@expr, 0]).
Print[MatrixForm[FourierDCT[FourierDCT[{0, 0, 1, 0, 0}, 2], 3] // Chop]]? You can't useChopoutside the MatrixForm if that's the problem you've been having. – Jonathan Shock May 07 '13 at 05:55Chopwhenever you want to display things. – bill s May 07 '13 at 05:57$Post(or$PrePrint) just the right thing to use whenever one wants to display things? The problem here is that it won't apply toPrinted output (try it without thePrintstatement). – István Zachar May 07 '13 at 06:12$Postcommand will apply this to the output expression but given that the expression itself is generated usingMatrixFormI don't expect it to work on the numbers inside it. Try applyingChopto yourMatrixFormexpression and see what it does. – Jonathan Shock May 07 '13 at 06:17Sqrt[-rational]then everything will remain rational. But if you do operations that generate complex numbers (likeSqrtor roots of polynmials, there are lots!) then you need to deal with it explicitly. You can always applyReto take only the real part orChopto remove small imaginary values. – bill s May 07 '13 at 08:35