1
$\begingroup$

Is there a common trick to automatically show output with "Chop" applied? I typically get results like below, which hinders readability

{{1., -2.08167*10^-16, -1.73472*10^-18}, {-2.08167*10^-16, 1., 
  3.19189*10^-16}, {-1.73472*10^-18, 3.19189*10^-16, 1.}}
$\endgroup$

marked as duplicate by Mr.Wizard Jun 8 '17 at 1:51

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    $\begingroup$ Run $Post = Chop; and try again. $\endgroup$ – J. M. is away Apr 5 '17 at 2:37
  • $\begingroup$ $Post = # /. x_Real /; 0 < Abs[x] < 10^-10 :> SetAccuracy[x, -Log10@Abs[x]]& might be preferred sometimes. Since what should be zero is relative, this shows how big the number being treated as zero is. $\endgroup$ – Michael E2 Apr 5 '17 at 3:02
  • 2
    $\begingroup$ The problem with $Post, imo, is that it is applied to every output. I don't think I'd want Chop applied to every output. Hence I don't use it, but apply formatters by hand & when appropriate. $\endgroup$ – Michael E2 Apr 5 '17 at 3:04
  • 4
    $\begingroup$ Do you want your results to be chopped or do you want to show chopped results? $\endgroup$ – Kuba Apr 5 '17 at 7:15
  • 3
    $\begingroup$ What Kuba is saying is that there is $Post, which affects what is stored in Out (i.e. the value of %) and there is $PrePrint, which only affects how it is shown on screen. I think $Post has a high potential for confusion because x=Sin[1], x+1 is going to be different from Sin[1], %+1. $\endgroup$ – Szabolcs Apr 5 '17 at 8:15

Browse other questions tagged or ask your own question.