Home > freetb4matlab > general > rat.m

rat

PURPOSE ^

%

SYNOPSIS ^

function [n,d] = rat(x,tol)

DESCRIPTION ^

% -*- texinfo -*-
% @deftypefn {Function File} {@var{s} =} rat (@var{x}, @var{tol})
% @deftypefnx {Function File} {[@var{n}, @var{d}] =} rat (@var{x}, @var{tol})
%
% Find a rational approximation to @var{x} within the tolerance defined
% by @var{tol} using a continued fraction expansion.  For example,
%
% @example
% @group
% rat(pi) = 3 + 1/(7 + 1/16) = 355/113
% rat(e) = 3 + 1/(-4 + 1/(2 + 1/(5 + 1/(-2 + 1/(-7))))) 
%        = 1457/536
% @end group
% @end example
%
% Called with two arguments returns the numerator and denominator separately
% as two matrices.
% @end deftypefn
% @seealso{rats}

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Sat 16-May-2009 00:04:49 by m2html © 2003