MathGroup Archive 2002

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

Search the Archive

Re: A question about Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34612] Re: [mg34559] A question about Mathematica
  • From: Sseziwa Mukasa <mukasa at jeol.com>
  • Date: Wed, 29 May 2002 02:46:51 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On Monday, May 27, 2002, at 01:17 AM, Chen-Ying Huang wrote:

> Hi,
>
>    I have a question about Mathematica and yet I couldn't find an answer
> to. Could you please consider giving me a help on this? This is not a
> long question and I hope it won't bother you too much.
>
>    I was doing some computations. A computation gives me something like
> A/A, another computation gives me something like B/B. I then do a
> true-false statement, that is, If [A/A>=B/B, 1, 0]. Since both
> computations (A/A and B/B) equal to one, the statement is true and hence
> the If statement should lend a 1 as specified.
>
>    However, I found out that the If statement lends a zero because
> somehow, in the computations, A/A is less than B/B by the order of 10 to
> the power of -16.
>
>    Some friends told me that it must be because the bytes used by the
> computations A/A and B/B are different, so to correct this problem, I
> should assign the maximum byte to each object.
>
>    Since I am not very familiar with Mathematica, after an afternoon's
> search, I still have no clue about how to do that.
>
>    Could anyone give me a help on this? I really appreciate it.
>
>
Depending on the order of operations, using machine precision values may 
result in different answers for calculations that are otherwise equal 
mathematically speaking.  Either use full precision values by making 
sure that there are no approximate noninteger values in your 
calculations, which may not be possible, or simply accept that there 
will be floating point error and use a tolerance condition ie, Abs[A/A - 
B/B] <= n*$MachinePrecision where n is a small multiplier, rather than 
testing for exact equality.

Regards,

Sseziwa



  • Prev by Date: Re: Re: Inserting Mathematica-generated EPS files into PowerPoint? (on a Mac)
  • Next by Date: RE: Re: Re: Re: Help! How to calculate additive partitions?
  • Previous by thread: RE: A question about Mathematica
  • Next by thread: Re: A question about Mathematica