Re: unser-interface problems using Mathematica as a calculator
- To: mathgroup at smc.vnet.net
- Subject: [mg131990] Re: unser-interface problems using Mathematica as a calculator
- From: Daniel <dosadchy at its.jnj.com>
- Date: Tue, 12 Nov 2013 00:15:10 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
> The example below illustrates why Mathematica's > display rules for approximate numbers are very > confusing for students. Should this be considered a > user-interface bug? If not, why not? In any case, can > the default display be changed to something more > familiar from spreadsheets and other computing > languages? > Thanks, > Alan Isaac > > In[217]:= tv = TimeValue[1, 0.04, 3] > tv == 1.124864 > tv == 1.12486 > > Out[217]= 1.12486 > > Out[218]= True > > Out[219]= False > A statement like this "x == 1.123" is usually a bug (except in a very very VERY specific circumstances), and students should not use it. The the value of x is usually a result of an expression, and different, but mathematically identical implementations of the expression will usually give slightly different numerical results. The test should be: "Abs[x - 1.123] < EPS", where EPS is a small number that depends on the estimation of numerical truncation errors (which depends on the expression).