MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Displaying decimals

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63482] Re: Displaying decimals
  • From: albert <awnl at arcor.de>
  • Date: Tue, 3 Jan 2006 01:24:34 -0500 (EST)
  • References: <dpb0q8$1ph$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Lea Rebanks wrote:

> 
> 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.

they are all there, you just need mathematica to show them, e.g.:

In[1]:= slope[x_]:=160.245051009838+0.05888359189242*x

In[2]:= InputForm[slope[50]]

Out[2]//InputForm= 163.189230604459

or 

In[3]:= NumberForm[slope[50],20]

Out[3]//NumberForm= 163.189230604459

will do the job (there are other *Form-functions that probably are more
usefull for your case). 

Using N will try to increase the precision of your expression, but that will
never be better than what you start with, which is MachinePrecision in your
case. If you use higher precision from the start, you will see more digits
even with the default behaviour of Mathematica:

In[4]:= slope[x_]:=160.245051009838`20+0.05888359189242`20*x

In[5]:= slope[50]

Out[5]= 163.18923060445900000

But be careful to not waste precision with input of less precision:

In[7]:= slope[50.]

Out[7]= 163.189

In this case you will again need an appropriate *Form-wrapper.

hth

albert


  • Prev by Date: Re: Using a palette to speed typesetting
  • Next by Date: Re: Re: NIntegrate and Sequence
  • Previous by thread: Re: Displaying decimals
  • Next by thread: Re: Displaying decimals