RE: Displaying many digits
- To: mathgroup at smc.vnet.net
- Subject: [mg40954] RE: [mg40933] Displaying many digits
- From: "David Park" <djmp at earthlink.net>
- Date: Fri, 25 Apr 2003 08:05:55 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Stepan, The following calculated to machine precision but only displayed 6 places. N[BesselJ[1, 3.], 20] 0.339059 Mathematica actually calculated 16 places internally but only displayed 6 places. To display more places you should use NumberForm, not N. NumberForm[BesselJ[1, 3.0], 16] 0.3390589585259365 You can also change the number of displayed digits using the Option Inspector. But we are still in machine precision, which is usually 16 places. The purpose of N is to convert EXACT expressions to approximate number form. So if you used 3 (EXACT) instead of 3.0 (APPROXIMATE) you can get 20 places. N[BesselJ[1, 3], 20] 0.33905895852593645893 But, you say, I don't want to plug exact numbers into BesselJ. Then you can use NumberForm and specify the precision of the approximate number with the number mark (`) and a precision. (Otherwise Mathematica will revert to machine precision.) BesselJ[1, 3.0`21] 0.33905895852593645893 You could also use SetPrecision BesselJ[1, SetPrecision[3., 21]] 0.33905895852593645893 See Section 3.1.4 Numerical Precision in The Mathematica Book David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Stepan Yakovenko [mailto:yakovenko at ngs.ru] To: mathgroup at smc.vnet.net HI! And what if I want to see many BesselJ's digits ? In[2]:= N[BesselJ[1,3.],20] Out[2]= 0.339059 -- Best regards, Stepan mailto:yakovenko at ngs.ru