From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Converting irrational numbers to rational
Date: Sat, 31 Jul 2010 20:07:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 14
Message-ID: <i31vp9$ihv$>
References: <i30s3d$ptm$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1280606825 19007 (31 Jul 2010 20:07:05 GMT)
NNTP-Posting-Date: Sat, 31 Jul 2010 20:07:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:657991

"William " <> wrote in message <i30s3d$ptm$>...
> Sorry, I am very new to matlab.  I would like to display my answers in rational numbers instead of scientific notation which I am getting now.  Anything helps, really just looking for the help doc that has info on this subject.
- - - - - - - - - -
  Also check out the 'rat' and 'rats' (no relationship with the rodent) matlab functions.

  For some theoretical background read the Wikipedia article at:

In particular read the section "Best rational approximations".

  Additional note: You mentioned "irrational" numbers in your subject title, but bear in mind that all of matlab's floating points numbers are of necessity rational - in fact they are all integers divided by various powers of two - the smallest positive double precision floating point number is 1/2^1074 and all its other numbers are integer multiples of this.

Roger Stafford