Re: Displaying decimals
- To: mathgroup at smc.vnet.net
- Subject: [mg63500] Re: [mg63476] Displaying decimals
- From: "Lea Rebanks" <lrebanks at netvigator.com>
- Date: Tue, 3 Jan 2006 01:25:14 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Thank you David, That's exactly what I wanted. << NumberForm[slope[50], 20] 163.189230604459 >> Many thanks Happy New Year, Lea Rebanks. -----Original Message----- From: David Park [mailto:djmp at earthlink.net] To: mathgroup at smc.vnet.net Subject: [mg63500] Re: [mg63476] Displaying decimals Lea, The primary purpose of N is to convert EXACT numbers, such as Pi or 1/3, to approximate (decimal) numbers. So if N is given an approximate number to begin with it does nothing. (However, the behavior of N has varied some over versions.) If an approximate number has a precision less than or equal to $MachinePrecision (usually about 16 places) then it is always displayed with 6 places. (This can be changed in the Option Inspector). Your numbers are, just barely, within $MachinePrecision. So they display with 6 places and N does nothing to change that. The following illustrates the effect of N on a machine precision number and on an exact number. N[3.3333333333333333, 20] 3.33333 N[Pi, 20] 3.1415926535897932385 In any case, the solution is simple. Use NumberForm instead of N. NumberForm[slope[50], 20] 163.189230604459 If you want to show zeros on the right... NumberForm[slope[50], {20, 17}, NumberPadding -> {"", "0"}] 163.18923060445900000 Look up NumberForm in Help and you will see many options to control the display of numbers. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Lea Rebanks [mailto:lrebanks at netvigator.com] To: mathgroup at smc.vnet.net Given the enclosed function, I can not make Mathematica v5.1 display greater than 3 decimals. Please help. slope[x_]:=160.245051009838+0.05888359189242*x EG. slope[50] = 163.189 I don't know how or why this is happening. I have tried N[expr,20] to no avail. Many thanks for your attention. Lea Rebanks.