
contfrac - evaluation to a continued fraction

Calling sequence:
contfrac(e [ , n ])

Parameters:
e  --   constant expression
n  --   positive integer

Summary:

contfrac(e,n) computes a continued fraction approximation for e, using the
first n digits of its floating-point evaluation. When n is not given, the value
of the variable DIGITS is used. In the output, the sign ... represents a real
number between one and infinity.

The continued fractions obtained belong to a special domain, namely CF, and
usual arithmetic operations can be done on them.

>>  a:=contfrac(PI,5): b:=contfrac(sqrt(7),2): a,b;

                 1                       1
        ---------------------- + 3, ------------------- + 2
               1                       1
        ------------------ + 7     --------------- + 1
             1                       1

         ------------- + 15         ----------- + 1
             1                       1
         --------- + 1             ------- + 1
          1                       1
         --- + 292                 --- + 4
         ...                      ...

>>  a+b, a*b, a^3;

               1              1             1
         --------------- + 5, ------- + 8, ------------- + 31
              1              1            1
         ----------- + 1     --- + 3     ------- + 159
            1               ...          1
         ------- + 3                    --- + 3
          1                            ...
         --- + 1
         ...

See also:  DIGITS , float

