From: William on
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.
From: us on
"William " <william.baxter(a)oit.edu> wrote in message <i30s3d$ptm$1(a)fred.mathworks.com>...
> 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.

a hint:

help format;

us
From: Roger Stafford on
"William " <william.baxter(a)oit.edu> wrote in message <i30s3d$ptm$1(a)fred.mathworks.com>...
> 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:

http://en.wikipedia.org/wiki/Continued_fraction

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