[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: rational numbers only
From: |
Geraint Paul Bevan |
Subject: |
Re: rational numbers only |
Date: |
Thu, 05 Jan 2006 11:43:19 +0000 |
User-agent: |
Mozilla Thunderbird 1.0.7 (X11/20051013) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jorge Barros de Abreu wrote:
> ans = 3.5000
>
> but i will like that the answer was:
>
> ans = 7/2
>
> the desired answer is 7/2, not 3.5.
The 'rat' command will find a rational approximation to a number:
octave> [n,d] = rat(1+0.5+1/3+5/3); [num2str(n), '/', num2str(d)]
ans = 7/2
- --
Geraint Bevan
http://www.mech.gla.ac.uk
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iEYEARECAAYFAkO9BlEACgkQcXV3N50QmNN1tACfeAMkFJuUPkjdEd/q7K2+9UU9
hMIAnjVp5kEcRmANC030eRwAcIZByk4y
=3N0e
-----END PGP SIGNATURE-----
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- Re: rational numbers only, David Bateman, 2006/01/05
- rational numbers only, Jorge Barros de Abreu, 2006/01/05
- Re: rational numbers only,
Geraint Paul Bevan <=
- Re: rational numbers only, Jordi Gutierrez Hermoso, 2006/01/05
- Re: rational numbers only, Jorge Barros de Abreu, 2006/01/05
- Re: rational numbers only, John W. Eaton, 2006/01/05
- Re: rational numbers only, Jordi Gutierrez Hermoso, 2006/01/05
- Re: rational numbers only, John W. Eaton, 2006/01/05
- Re: rational numbers only, Jordi Gutierrez Hermoso, 2006/01/05
- Re: rational numbers only, Paul Kienzle, 2006/01/05