1
$\begingroup$

I am running a function that has a large output in matrix format with small, complex parts added to the numbers- basically a rounding error. I am trying to use Chop to obtain use-able results, but when I highlight Chop[%] and choose Evaluate Cells from the drop down, the program just beeps and highlights the last original output bracket in neon green. Does anyone have any ideas on this? Thanks much,

Laurascreenshot

$\endgroup$

closed as off-topic by m_goldberg, MarcoB, RunnyKine, J. M. is away Mar 24 '16 at 0:18

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – m_goldberg, MarcoB, RunnyKine, J. M. is away
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ be aware "Evaluate Cells" evaluates the entire contents of the cell, not just the thing you highlighted. Your error is probably not with the chop. $\endgroup$ – george2079 Mar 23 '16 at 21:01
  • 1
    $\begingroup$ "why the beep" and "why the coloring" in the help menu may be useful $\endgroup$ – george2079 Mar 23 '16 at 21:07
  • 1
    $\begingroup$ "Why the beep" was helpful! The cell was not evaluatable, so all I had to do was change that... thank you $\endgroup$ – Laura McMullen Mar 23 '16 at 21:23
1
$\begingroup$

Here is some fake data with small real components and very small imaginary components.

data = 
 Table[RandomReal[{10^-19, 10^-17}] + 
   I RandomReal[{10^-58, 10^-48}], {i, 10}]

(* {6.95652*10^-18 + 1.12565*10^-49 I, 
 7.07667*10^-18 + 6.35178*10^-49 I, 3.20216*10^-18 + 3.00947*10^-49 I,
  5.40598*10^-18 + 7.43668*10^-49 I, 2.06847*10^-18 + 8.6374*10^-50 I,
  7.26575*10^-18 + 5.34808*10^-51 I, 
 1.13101*10^-18 + 6.56817*10^-50 I, 9.26818*10^-18 + 6.55484*10^-49 I,
  2.02467*10^-18 + 8.74861*10^-49 I, 
 7.80163*10^-18 + 7.93328*10^-49 I} *)

Chop takes a second argument that sets numbers that are smaller in magnitude to zero. Chop is also listable.

Chop[data, 10^-20]

(* {6.95652*10^-18, 7.07667*10^-18, 3.20216*10^-18, 
 5.40598*10^-18, 2.06847*10^-18, 7.26575*10^-18, 1.13101*10^-18, 
 9.26818*10^-18, 2.02467*10^-18, 7.80163*10^-18} *)
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.