Up | Next | Prev | PrevTail | Tail |
Authors: Lisa Temme and Wolfram Koepf
The division of one integer by another often results in a period in the decimal part. The rational2periodic function in this package can recognise and represent such an answer in a periodic representation. The inverse function, periodic2rational, can also convert a periodic representation back to a rational number.
Periodic Representation of a Rational Number |
SYNTAX: | rational2periodic(n); |
INPUT: | n is a rational number |
RESULT: | periodic({a,b} , {c1,...,cn}) |
where a/b is the non-periodic part |
and c1,...,cn are the digits of the periodic part. |
EXAMPLE: | 59∕70 written as 0.8428571 |
1: rational2periodic(59/70); |
periodic({8,10},{4,2,8,5,7,1}) |
Rational Number of a Periodic Representation |
SYNTAX: | periodic2rational(periodic({a,b},{c1,...,cn})) |
periodic2rational({a,b},{c1,...,cn}) |
INPUT: | a | is an integer |
b | is 1, −1 or an integer multiple of 10 |
c1,...,cn | is a list of positive digits |
RESULT: | A rational number. |
EXAMPLE: | 0.8428571 written as 59∕70 |
2: periodic2rational(periodic({8,10},{4,2,8,5,7,1})); |
59 |
—- |
70 |
3: periodic2rational({8,10},{4,2,8,5,7,1}); |
59 |
—- |
70 |
Note that if a is zero, b will indicate how many places after the decimal point that the
period occurs. Note also that if the answer is negative then this will be indicated
by the sign of a (unless a is zero in which case it is indicated by the sign of
b).
ERROR MESSAGE
***** operator to be used in off rounded mode
The periodicity of a function can only be recognised in the off rounded mode. This
is also true for the inverse procedure.
EXAMPLES
A continued fraction (see [?] §4.2) has the general form
A more compact way of writing this is as
This is represented in REDUCE as
SYNTAX: | cfrac(number); |
cfrac(number,length); |
cfrac(f, var); |
cfrac(f, var, length); |
INPUT: | number | is any real number |
f | is a function |
var | is the function variable |
Optional Argument: length
The length argument is optional. For an NON-RATIONAL function input the
length argument specifies the number of ordered pairs, {ai,bi}, to be returned. It’s
default value is five. For a RATIONAL function input the length argument can only
truncate the answer, it cannot return additional pairs even if the precision is
increased. The default value is the complete continued fraction of the rational
input. For a NUMBER input the default value is dependent on the precision of
the session, and the length argument will only take effect if it has a smaller
value than that of the number of ordered pairs which the default value would
return.
EXAMPLES
The Padé approximant represents a function by the ratio of two polynomials. The coefficients of the powers occuring in the polynomials are determined by the coefficients in the Taylor series expansion of the function (see [?]). Given a power series
and the degree of numerator, n, and of the denominator, d, the pade function finds the unique coefficients ai,bi in the Padé approximant
SYNTAX: | pade(f, x, h, n, d); |
INPUT: | f | is the funtion to be approximated |
x | is the function variable |
h | is the point at which the approximation is |
evaluated |
n | is the (specified) degree of the numerator |
d | is the (specified) degree of the denominator |
RESULT: | Padé Approximant, ie. a rational function. |
ERROR MESSAGES
***** not yet implemented
The Taylor series expansion for the function, f, has not yet been implemented in
the REDUCE Taylor Package.
***** no Pade Approximation exists
A Padé Approximant of this function does not exist.
***** Pade Approximation of this order does not
exist
A Padé Approximant of this order (ie. the specified numerator and denominator
orders) does not exist but one of a different order may exist.
EXAMPLES
[1] Baker(Jr.), George A. and Graves-Morris, Peter:
Padé Approximants, Part
I: Basic Theory, (Encyclopedia of mathematics and its applications,
Vol 13, Section: Mathematics of physics), Addison-Wesley Publishing
Company, Reading, Massachusetts, 1981.
Up | Next | Prev | PrevTail | Front |