Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: Table through zero...strange

  • To: mathgroup at smc.vnet.net
  • Subject: [mg67040] Re: Table through zero...strange
  • From: dh <dh at metrohm.ch>
  • Date: Wed, 7 Jun 2006 05:10:38 -0400 (EDT)
  • References: <e63mqt$kqd$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hello,
what you are seeing is the result of floating point arithmetic, that is 
inheremtly inaccurate. Look at:
Table[x,{x,-0.1,0,0.02}] //FullForm
and
Table[x,{x,-0.4,0,0.05}] //FullForm
For this reason, it is usually better to use Integer arithmetics for the 
iterator. E.g.:
Table[-0.1 + i 0.02, {i, 0, 5}]
This gives what you want.



leptonic wrote:
> Hello,
> 
> When i type in Mathematica (version 4) Table[x, {x, -0.1, 0, 0.02}]
> 
> it gives me {-0.1, -0.08, -0.06, -0.04, -0.02, -3.46945 x 10-18]}
> but for example Table[x, {x, -0.1, 0, 0.05}] will give a reasonable
> {-0.1, -0.05, 0.}.
> 
> Probably a very stupid question but i can't figure out why the zero
> makes problem.
> 
> Thanks for any help.
> 


  • Prev by Date: Any ideas on expanded results for SetPartitions in discrete-combinatoria
  • Next by Date: RE: Table through zero...strange
  • Previous by thread: Re: Table through zero...strange
  • Next by thread: RE: Table through zero...strange