# How to display the value of a very small number instead of “0.” [duplicate]

I need to perform an integration. There is one particular value, which may be very small that is showing up as 0.. Is there any command in Mathematica 9 that will give me the very small value instead of 0.?

-

## marked as duplicate by Öskå, Pickett, bobthechemist, m_goldberg, belisarius is forthJul 2 '14 at 19:00

Chop, Round, Floor. But after re-reading I see you are using NumberForm. Why? Get rid of it unless you have some special (cosmetic) reason for using it. –  Mike Honeychurch Jul 2 '14 at 10:58
isnt he asking how to not chop the result? –  george2079 Jul 2 '14 at 13:00
@george2079 you have a point! ARIJIT, while you get a display of 0., Mathematica still knows about the correct value, but does not display all digits. Can you post your code as code, not just as image? Then we should be able to help you more easily. This Q&A might give you a starting point: mathematica.stackexchange.com/questions/3736/… –  Yves Klett Jul 2 '14 at 13:52
Please post code that can be copied instead of images of code. –  Michael E2 Jul 2 '14 at 15:35

The problem seems to be that the values are very small, smaller than can be represented by a machine numbers. Perhaps NIntegrate decides the answer is zero. You can use arbitrary-precision numbers, which you can do with the WorkingPrecision option, to get nonzero values.

a2 = 525/10;
u = 2*i - 1/2;
u1 = u*Pi/2;
u2 = u1/a2;
u4 = -1/5^2;
Table[NIntegrate[
BesselJ[2, 2 x] BesselJ[2, u2 x] x Exp[u4 x^2], {x, 0, Infinity},
AccuracyGoal -> 20, WorkingPrecision -> 20], {i, 5}]
(*
{ 3.9132803101634619543*10^-153338638,
-2.8913652452626206553*10^-153338639,
-2.1189063245786547756*10^-153338638,
-3.8801006291402211574*10^-153338639,
1.5024724257794001238*10^-153338638}
*)

-
Wow 10^_1533...you have my vote –  ubpdqn Jul 2 '14 at 16:52
@ubpdqn Yeah, it's hard to imagine a number that small being used. –  Michael E2 Jul 2 '14 at 17:12

I have interpreted this question as per george2079s comment. I think this may a case of "asking too much" but I defer to numerical experts.

Note:

Manipulate[
Plot[Evaluate[
BesselJ[2, 2 x] BesselJ[2, us[[1]] x] x Exp[u4 x^2]], {x, 0, s},
PlotRange -> {-0.003, 0.003}], {s, {5, 10, 20, 30, 40, 50}}]


Then testing for small upper limits (noting failure of convergence methods). I rewrote the code (and hope I have not made a mistake):

a2 = 52.5;
u4 = -1/25;
us = # Pi/(2 a2) & /@ (2 #1 - 0.5 & /@ Range[5])
fun[y_, t_] :=
NIntegrate[BesselJ[2, 2 x] BesselJ[2, y x] x Exp[u4 x^2], {x, 0, t},
AccuracyGoal -> 20]


Tabulating:

Grid[Quiet[{#2, fun[#1, #2]} & @@@ Tuples[ {us, Range[10, 50, 10]}]]]


-

Extended comment (this question will probably get closed as a duplicate in any case).

As a (presumably) new user the best way to wean yourself of procedural constructs like For is to begin using Table. There are other ways to do things in Mathematica but the transition from For to Table is probably the easiest and most intuitive to begin with.

In that code Quiet is used to suppress a warning about lack of convergence. Note that I changed u4 to make it a real. Chop is used to treat very small numbers below a cut off -- in this case below 10^-7 as zero. You can also use functions like Map.

In both cases above I'm sticking with the way you have set up the problem rather than re-writing. Objective is to show alternatives to For keeping the body essentially the same.

Finally there is no need to use Print to get the output:

-