1
$\begingroup$

I have a table of numerical values which contains a lot of strange values.

0.e-15, -1.4909, -6.3053, 18.664, -9.2481, -32.211, 73.558, -80.643, 56.146, 
-26.288, 8.142, -1.5221, 0.13093, 0.e-6, 0.e-6, 0.e-5, 0.e-5, 0.e-5, 0.e-5, 
0.e-5, 0.e-5, 0.e-4, 0.e-4, 0.e-4, 0.e-4, 0.e-5, 0.e-5, 0.e-5, 0.e-5, 0.e-5, 
0.e-5, 0.e-6, 0.e-6, 0.e-7, 0.e-7, 0.e-8, 0.e-8, 0.e-9, 0.e-10, 0.e-11, 0.e-12, 
0.e-14, 0.e-24, 0.e-25, 0.e-26, 0.e-27, 0.e-29, 0.e-40, 0.e-41, 0.e-42, 0.e-43, 
0.e-45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.e-15, 0.66031, 
-0.5688, -0.2097, 0.98937, -2.2281, 5.1429, -8.1273, 8.4756, -5.9985, 2.9081, 
-0.93776, 0.18259, -0.016321, 0.e-6, 0.e-6, 0.e-6, 0.e-5, 0.e-5, 0.e-5, 0.e-5, 
0.e-5, 0.e-5, 0.e-5, 0.e-5, 0.e-5, 0.e-5, 0.e-5, 0.e-5, 0.e-5, 0.e-6, 0.e-6, 
0.e-6, 0.e-7, 0.e-7, 0.e-8, 0.e-8, 0.e-9, 0.e-10, 0.e-10, 0.e-11, 0.e-13, 0.e-14, 
0.e-25, 0.e-26, 0.e-27, 0.e-28, 0.e-29, 0.e-41, 0.e-42, 0.e-43, 0.e-44, 0.e-46, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.e-16, 0.e-14, 3.3614, -8.0563, 
3.1065, 16.494, -37.721, 43.843, -33.342, 17.641, -6.5141, 1.6119, -0.24057, 
0.016321, 0.e-6, 0.e-6, 0.e-6, 0.e-5, 0.e-5, 0.e-5, 0.e-5, 0.e-5, 0.e-5, 0.e-5, 
0.e-5, 0.e-5, 0.e-5, 0.e-5, 0.e-5, 0.e-5, 0.e-6, 0.e-6, 0.e-6, 0.e-7, 0.e-7, 
0.e-7, 0.e-8, 0.e-9, 0.e-9, 0.e-10, 0.e-11, 0.e-12, 0.e-14, 0.e-25, 0.e-25, 
0.e-27, 0.e-28, 0.e-29, 0.e-41, 0.e-42, 0.e-43, 0.e-44, 0.e-45, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.e-16, 0.e-14, 3.3614, -8.0563, 3.1065, 16.494, 
-37.721, 43.843, -33.342, 17.641, -6.5141, 1.6119, -0.24057, 0.016321, 0.e-6, 
0.e-6, 0.e-6, 0.e-5, 0.e-5, 0.e-5, 0.e-5, 0.e-5, 0.e-5, 0.e-5, 0.e-5, 0.e-5, 
0.e-5, 0.e-5, 0.e-5, 0.e-5, 0.e-6, 0.e-6, 0.e-6, 0.e-7, 0.e-7, 0.e-7, 0.e-8, 
0.e-9, 0.e-9, 0.e-10, 0.e-11, 0.e-12, 0.e-14, 0.e-25, 0.e-25, 0.e-27, 0.e-28, 
0.e-29, 0.e-41, 0.e-42, 0.e-43, 0.e-44, 0.e-45

Why are the values not zero for numbers such as 0.e-34? How can I set them to zero?

$\endgroup$

closed as off-topic by Szabolcs, m_goldberg, Daniel Lichtblau, Coolwater, MarcoB Jan 30 '18 at 20:25

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, Daniel Lichtblau, Coolwater, MarcoB
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ Chop[] might help! $\endgroup$ – Ulrich Neumann Jan 30 '18 at 11:12
  • $\begingroup$ Mathematica does not recognize e in the way you expect. To represent, say, one thousandth, you should use 1*^-3 in Wolfram language rather than 1e-3. $\endgroup$ – Αλέξανδρος Ζεγγ Jan 30 '18 at 11:20
  • $\begingroup$ 😭@UlrichNeumann I've tried that, but it didn't work. @ Alexander Zeng can you explain that? actually the results should only contain constant values. $\endgroup$ – Ivy Gao Jan 30 '18 at 11:22
  • $\begingroup$ How do you get those values? $\endgroup$ – Αλέξανδρος Ζεγγ Jan 30 '18 at 11:29
  • $\begingroup$ @Ivy Gao: Sorry I didn't see the e-notation. You should provide your data online... $\endgroup$ – Ulrich Neumann Jan 30 '18 at 11:44
2
$\begingroup$

Use HoldForm and List (the curly braces):

data = HoldForm[{0. e - 15, -1.4909, -6.3053, 
       18.664, -9.2481, -32.211, 73.558, -80.643, 56.146, -26.288, 
       8.142, -1.5221, 0.13093, 0. e - 6, 0. e - 6, 0. e - 5, 0. e - 5, 
       0. e - 5, 0. e - 5, 0. e - 5, 0. e - 5, 0. e - 4, 0. e - 4, 
       0. e - 4, 0. e - 4, 0. e - 5, 0. e - 5, 0. e - 5, 0. e - 5, 
       0. e - 5, 0. e - 5, 0. e - 6, 0. e - 6, 0. e - 7, 0. e - 7, 
       0. e - 8, 0. e - 8, 0. e - 9, 0. e - 10, 0. e - 11, 0. e - 12, 
       0. e - 14, 0. e - 24, 0. e - 25, 0. e - 26, 0. e - 27, 0. e - 29, 
       0. e - 40, 0. e - 41, 0. e - 42, 0. e - 43, 0. e - 45, 0, 0, 0, 0,
       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 0. e - 15, 
       0.66031, -0.5688, -0.2097, 0.98937, -2.2281, 5.1429, -8.1273, 
       8.4756, -5.9985, 2.9081, -0.93776, 0.18259, -0.016321, 0. e - 6, 
       0. e - 6, 0. e - 6, 0. e - 5, 0. e - 5, 0. e - 5, 0. e - 5, 
       0. e - 5, 0. e - 5, 0. e - 5, 0. e - 5, 0. e - 5, 0. e - 5, 
       0. e - 5, 0. e - 5, 0. e - 5, 0. e - 6, 0. e - 6, 0. e - 6, 
       0. e - 7, 0. e - 7, 0. e - 8, 0. e - 8, 0. e - 9, 0. e - 10, 
       0. e - 10, 0. e - 11, 0. e - 13, 0. e - 14, 0. e - 25, 0. e - 26, 
       0. e - 27, 0. e - 28, 0. e - 29, 0. e - 41, 0. e - 42, 0. e - 43, 
       0. e - 44, 0. e - 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
       0 0. e - 16, 0. e - 14, 3.3614, -8.0563, 3.1065, 16.494, -37.721,
       43.843, -33.342, 17.641, -6.5141, 1.6119, -0.24057, 0.016321, 
       0. e - 6, 0. e - 6, 0. e - 6, 0. e - 5, 0. e - 5, 0. e - 5, 
       0. e - 5, 0. e - 5, 0. e - 5, 0. e - 5, 0. e - 5, 0. e - 5, 
       0. e - 5, 0. e - 5, 0. e - 5, 0. e - 5, 0. e - 6, 0. e - 6, 
       0. e - 6, 0. e - 7, 0. e - 7, 0. e - 7, 0. e - 8, 0. e - 9, 
       0. e - 9, 0. e - 10, 0. e - 11, 0. e - 12, 0. e - 14, 0. e - 25, 
       0. e - 25, 0. e - 27, 0. e - 28, 0. e - 29, 0. e - 41, 0. e - 42, 
       0. e - 43, 0. e - 44, 0. e - 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
       0, 0, 0, 0, 0 0. e - 16, 0. e - 14, 3.3614, -8.0563, 3.1065, 
       16.494, -37.721, 43.843, -33.342, 17.641, -6.5141, 
       1.6119, -0.24057, 0.016321, 0. e - 6, 0. e - 6, 0. e - 6, 
       0. e - 5, 0. e - 5, 0. e - 5, 0. e - 5, 0. e - 5, 0. e - 5, 
       0. e - 5, 0. e - 5, 0. e - 5, 0. e - 5, 0. e - 5, 0. e - 5, 
       0. e - 5, 0. e - 6, 0. e - 6, 0. e - 6, 0. e - 7, 0. e - 7, 
       0. e - 7, 0. e - 8, 0. e - 9, 0. e - 9, 0. e - 10, 0. e - 11, 
       0. e - 12, 0. e - 14, 0. e - 25, 0. e - 25, 0. e - 27, 0. e - 28, 
       0. e - 29, 0. e - 41, 0. e - 42, 0. e - 43, 0. e - 44, 
       0. e - 45}];

and perform a replacement:

datap = data /. Plus[Times[__], _Integer] -> 0 // ReleaseHold

Then datap is

{0, -1.4909, -6.3053, 18.664, -9.2481, -32.211, 73.558, -80.643, \
56.146, -26.288, 8.142, -1.5221, 0.13093, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0.66031, -0.5688, -0.2097, 0.98937, -2.2281, 5.1429, -8.1273, \
8.4756, -5.9985, 2.9081, -0.93776, 0.18259, -0.016321, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 3.3614, -8.0563, 3.1065, 16.494, -37.721, 43.843, \
-33.342, 17.641, -6.5141, 1.6119, -0.24057, 0.016321, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 3.3614, -8.0563, 3.1065, 16.494, -37.721, 43.843, \
-33.342, 17.641, -6.5141, 1.6119, -0.24057, 0.016321, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

Is this datap what you want?

$\endgroup$
  • $\begingroup$ yes, this is what I want 👍👍 $\endgroup$ – Ivy Gao Jan 30 '18 at 14:16

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