File r37/log/rataprx.rlg artifact b39e64aba8 part of check-in aacf49ddfa


Sun Aug 18 20:52:15 2002 run on Windows
% Tests of the rataprx package.

% Authors: Lisa Temme, Wolfram Koepf (koepf@zib.de)

% periodic decimal representations
rational2periodic(1/3);


  _
0.3

periodic2rational(ws);


 1
---
 3

rational2periodic(-1/3);


   _
-0.3

periodic2rational(ws);


  - 1
------
  3

rational2periodic(1.2/3);


   
0.4

periodic2rational(ws);


 2
---
 5

rational2periodic(1/3.4);


  ________________
0.2941176470588235

periodic2rational(ws);


 5
----
 17

rational2periodic(1.2/3.4);


  ________________
0.3529411764705882

periodic2rational(ws);


 6
----
 17

rational2periodic(352673/3124);


periodic({11289,100},{1,

            4,

            8,

            5,

            2,

            7,

            5,

            2,

            8,

            8,

            0,

            9,

            2,

            1,

            8,

            9,

            5,

            0,

            0,

            6,

            4,

            0,

            2,

            0,

            4,

            8,

            6,

            5,

            5,

            5,

            6,

            9,

            7,

            8,

            2,

            3,

            3,

            0,

            3,

            4,

            5,

            7,

            1,

            0,

            6,

            2,

            7,

            4,

            0,

            0,

            7,

            6,

            8,

            2,

            4,

            5,

            8,

            3,

            8,

            6,

            6,

            8,

            3,

            7,

            3,

            8,

            7,

            9,

            6,

            4})

periodic2rational(ws);


 352673
--------
  3124

rational2periodic(53765/5216);


periodic({1030770,100000},{7,

            0,

            5,

            5,

            2,

            1,

            4,

            7,

            2,

            3,

            9,

            2,

            6,

            3,

            8,

            0,

            3,

            6,

            8,

            0,

            9,

            8,

            1,

            5,

            9,

            5,

            0,

            9,

            2,

            0,

            2,

            4,

            5,

            3,

            9,

            8,

            7,

            7,

            3,

            0,

            0,

            6,

            1,

            3,

            4,

            9,

            6,

            9,

            3,

            2,

            5,

            1,

            5,

            3,

            3,

            7,

            4,

            2,

            3,

            3,

            1,

            2,

            8,

            8,

            3,

            4,

            3,

            5,

            5,

            8,

            2,

            8,

            2,

            2,

            0,

            8,

            5,

            8,

            8,

            9,

            5})

periodic2rational(ws);


 53765
-------
 5216


% continued fractions
% of numbers
cfrac pi;


  1146408
{---------,
  364913

                               1
 3 + ------------------------------------------------------}
                                 1
      7 + ------------------------------------------------
                                    1
           15 + -----------------------------------------
                                      1
                 1 + -----------------------------------
                                         1
                      292 + ---------------------------
                                           1
                             1 + ---------------------
                                             1
                                  1 + ---------------
                                               1
                                       1 + ---------
                                                 1
                                            2 + ---
                                                 1

cfrac(pi,3);


  355             1
{-----,3 + ----------------}
  113               1
            7 + ----------
                       1
                 15 + ---
                       1

cfrac(pi,20);


  1146408
{---------,
  364913

                               1
 3 + ------------------------------------------------------}
                                 1
      7 + ------------------------------------------------
                                    1
           15 + -----------------------------------------
                                      1
                 1 + -----------------------------------
                                         1
                      292 + ---------------------------
                                           1
                             1 + ---------------------
                                             1
                                  1 + ---------------
                                               1
                                       1 + ---------
                                                 1
                                            2 + ---
                                                 1

oldprec:=precision 20;


oldprec := 12

cfrac pi;


          14885392687
contfrac(-------------,{3,
          4738167652

            {1,7},

            {1,15},

            {1,1},

            {1,292},

            {1,1},

            {1,1},

            {1,1},

            {1,2},

            {1,1},

            {1,3},

            {1,1},

            {1,14},

            {1,2},

            {1,1},

            {1,1},

            {1,2},

            {1,2},

            {1,2},

            {1,2}})

cfrac(pi^2);


          27053934029
contfrac(-------------,{9,
          2741136618

            {1,1},

            {1,6},

            {1,1},

            {1,2},

            {1,47},

            {1,1},

            {1,8},

            {1,1},

            {1,1},

            {1,2},

            {1,2},

            {1,1},

            {1,1},

            {1,8},

            {1,3},

            {1,1},

            {1,10},

            {1,5},

            {1,1},

            {1,3}})

cfrac(pi*e*sqrt(2));


          22809995021
contfrac(-------------,{12,
          1888712428

            {1,12},

            {1,1},

            {1,68},

            {1,1},

            {1,3},

            {1,1},

            {1,2},

            {1,1},

            {1,6},

            {1,1},

            {1,15},

            {1,1},

            {1,5},

            {1,1},

            {1,1},

            {1,2},

            {1,1},

            {1,8},

            {1,2}})

precision oldprec;


20


% of rational functions
cfrac((x+2/3)^2/(6*x-5),x);


     2
  9*x  + 12*x + 4
{-----------------,
     54*x - 45

  6*x + 13          1
 ---------- + -------------}
     36         24*x - 20
               -----------
                    9

cfrac((x+2/3)^2/(6*x-5),x,0);


  6*x + 13   6*x + 13
{----------,----------}
     36         36

cfrac((x+2/3)^2/(6*x-5),x,1);


     2
  9*x  + 12*x + 4
{-----------------,
     54*x - 45

  6*x + 13          1
 ---------- + -------------}
     36         24*x - 20
               -----------
                    9

cfrac((x+2/3)^2/(6*x-5),x,10);


     2
  9*x  + 12*x + 4
{-----------------,
     54*x - 45

  6*x + 13          1
 ---------- + -------------}
     36         24*x - 20
               -----------
                    9

cfrac((x*8-7/2)^4/(x^5-2/3),x);


          4           3           2
  196608*x  - 344064*x  + 225792*x  - 65856*x + 7203
{----------------------------------------------------,
                          5
                      48*x  - 32

     4*x + 7        524288*x - 458752        144060*x - 574709
 1/(--------- + 1/(------------------- + 1/(------------------- + 1/(
      16384                245                   29503488

              1428871832845410168479416320*x + 5604409773009942380402638848
             --------------------------------------------------------------- + 1
                               110370509467032373008840289

             /(4638094170692621015213105500565148574652*x

                - 3747067916403980284808800355871185905903)/365473525943308099\
             0834049614798549893120))))}

cfrac((x*8-7/2)^4/(x^5-2/3),x,2);


   524288*x - 458752
{---------------------,
       2
  128*x  + 112*x + 49

                  1
 -----------------------------------}
   4*x + 7              1
  --------- + ---------------------
    16384       524288*x - 458752
               -------------------
                       245


% of analytic functions
cfrac(e^x,x,10);


      5       4        3         2
   - x  - 30*x  - 420*x  - 3360*x  - 15120*x - 30240
{----------------------------------------------------,
    5       4        3         2
   x  - 30*x  + 420*x  - 3360*x  + 15120*x - 30240

                                  x
 1 + ------------------------------------------------------------}
                                    - x
      1 + ------------------------------------------------------
                                      x
           2 + ------------------------------------------------
                                        - x
                3 + ------------------------------------------
                                          x
                     2 + ------------------------------------
                                            - x
                          5 + ------------------------------
                                              x
                               2 + ------------------------
                                                - x
                                    7 + ------------------
                                                  x
                                         2 + ------------
                                                    - x
                                              9 + ------
                                                    2

% default order is 4
cfrac(e^x,x);


   3      2
  x  + 9*x  + 36*x + 60
{-----------------------,
       2
    3*x  - 24*x + 60

                  x
 1 + ---------------------------}
                   - x
      1 + ---------------------
                      x
           2 + ---------------
                       - x
                3 + ---------
                          x
                     2 + ---
                          5

cfrac(x^2/(x-1)*e^x,x);


   6      4    2
  x  + 3*x  + x
{----------------,
     4    2
  3*x  - x  - 1

                2
             - x
 ----------------------------}
                   2
              - 2*x
  1 + ----------------------
                   2
                  x
       1 + ----------------
                     2
                    x
            1 + ----------
                       2
                      x
                 1 + ----
                      1

cfrac(x^2/(x-1)*e^x,x,2);


      2
     x
{----------,
     2
  2*x  - 1

          2
       - x
 ---------------}
             2
        - 2*x
  1 + ---------
          1

cfrac(atan(x),x,10);


               9            7             5             3
       307835*x  + 4813380*x  + 19801782*x  + 29609580*x  + 14549535*x
{----------------------------------------------------------------------------,
         10            8            6             4             2
  19845*x   + 1091475*x  + 9459450*x  + 28378350*x  + 34459425*x  + 14549535

                                 x
 -----------------------------------------------------------------}
                                   2
                                  x
  1 + -----------------------------------------------------------
                                      2
                                   4*x
       3 + -----------------------------------------------------
                                        2
                                     9*x
            5 + -----------------------------------------------
                                           2
                                       16*x
                 7 + -----------------------------------------
                                             2
                                         25*x
                      9 + -----------------------------------
                                               2
                                           36*x
                           11 + ----------------------------
                                                  2
                                              49*x
                                 13 + ---------------------
                                                    2
                                                64*x
                                       15 + --------------
                                                       2
                                                   81*x
                                             17 + -------
                                                    19

cfrac(asin(x),x,5);


         5           3
  69049*x  - 717780*x  + 922320*x
{---------------------------------,
          4           2
  145125*x  - 871500*x  + 922320

                    x
 ----------------------------------------}
                        2
                     - x
  1 + ----------------------------------
                            2
                      - 17*x
       6 + ----------------------------
                               2
                        - 549*x
            10 + ---------------------
                                   2
                          - 69049*x
                  238 + -------------
                            1098


% not implemented
cfrac(log(x),x,4);


***** not yet implemented 

cfrac(asech(x),x,5);


***** not yet implemented 

cfrac(sin sqrt x,x,4);


***** not yet implemented 

% wrong input
cfrac(1,x);


cfrac(1,x)

cfrac(x,x,x);


cfrac(x,x,x)

cfrac(x,x,x,5);


cfrac(x,x,x,5)


% Pade representations
pade(sin(x),x,0,3,3);


          2
 x*( - 7*x  + 60)
------------------
       2
   3*(x  + 20)

pade(tanh(x),x,0,5,5);


     4        2
 x*(x  + 105*x  + 945)
-----------------------
      4       2
 15*(x  + 28*x  + 63)

pade(atan(x),x,0,5,5);


        4        2
 x*(64*x  + 735*x  + 945)
--------------------------
         4       2
 15*(15*x  + 70*x  + 63)

pade(1/(x*sin(x)),x,0,3,2);


  2
 x  + 6
--------
     2
  6*x

pade(sin(x)/x^2,x,0,10,1);


     10        8         6           4            2
  - x   + 110*x  - 7920*x  + 332640*x  - 6652800*x  + 39916800
---------------------------------------------------------------
                          39916800*x

pade(sin(x)/x^2,x,0,10,2);


     10        8         6           4            2
  - x   + 110*x  - 7920*x  + 332640*x  - 6652800*x  + 39916800
---------------------------------------------------------------
                          39916800*x

pade(sin(x)/x^2,x,0,10,3);


        10         8           6             4              2
  - 23*x   + 4620*x  - 451440*x  + 22619520*x  - 498960000*x  + 3113510400
---------------------------------------------------------------------------
                                        2
                           19958400*x*(x  + 156)

pade(exp(x),x,0,10,10);


  10        9         8           7            6             5               4
(x   + 110*x  + 5940*x  + 205920*x  + 5045040*x  + 90810720*x  + 1210809600*x

                 3                2                                    10
  + 11762150400*x  + 79394515200*x  + 335221286400*x + 670442572800)/(x

           9         8           7            6             5               4
    - 110*x  + 5940*x  - 205920*x  + 5045040*x  - 90810720*x  + 1210809600*x

                   3                2
    - 11762150400*x  + 79394515200*x  - 335221286400*x + 670442572800)

pade(sin(x),x,0,20,20);


                                                                 18
(420*x*( - 1670454796485655407005204111896505853962882149730473*x

                                                                    16
         + 3750723201144687025399857898162770954823924964685652842*x

                                                                       14
         - 3582506072289078352047596683909246967322825072732178695360*x

                                                                          12
         + 1869589702800106132374452333905246037435005346891034203856000*x

                                                                            10
         - 573228615690533362277150976788354558105622438150759712792761600*x

                                                                               8
         + 103954806107838160002753187442833010398502453693126706480803904000*x

         - 10728835421367893971671793497263049404983813914658053829579862016000

          6
        *x  + 

                                                                               4
        575186523659337692549014637994968894181652462542936979129823993856000*x

         - 

        13299404753182468245973779380302173780050163417906548608594453340160000

          2
        *x  + 8461166135144631096871438729757765368229020614386275136075764211\
                                                                   20
        7120000))/(9703514253649496804459335098386178033709237613*x

                                                          18
    + 26693188916859840432281615685297667671827346329880*x

                                                             16
    + 40131841713883475746635715860433350742371877282920840*x

                                                                14
    + 42773075706893663042738071933996865427898294402559424000*x

                                                                   12
    + 35329791607150874190393563954056763271257094118524405024000*x

                                                                      10
    + 23367407211060385995097426988941972393423826920849430345472000*x

                                                                         8
    + 12411237061763347778639777646354605230793727402242210950475520000*x

                                                                           6
    + 5182014156622335713728846799235531962702355938650410017404846080000*x

                                                                              4
    + 1615241584293926563589087600285609358152611856120931412435087564800000*x  

                                                                               2
   + 337066298264605104501019771103522770139245794549642179643364545331200000*x

    + 35536897767607450606860042664982614546561886580422355571518209689190400000

   )

% no Pade Approximation exists 
pade(exp(1/x),x,0,5,5);


***** no Pade Approximation exists 

% wrong order
pade(sin(x)/x^2,x,0,10,0);


***** Pade Approximation of this order does not exist 

% not implemented
pade(factorial(x),x,1,3,3);


***** not yet implemented 

% extended Pade representations
pade(asech(x),x,0,3,3);


              2                        2                 2
  - 3*log(x)*x  + 8*log(x) + 3*log(2)*x  - 8*log(2) + 2*x
-----------------------------------------------------------
                            2
                         3*x  - 8

taylor(ws-asech(x),x,0,10);


               11       13    6     43    8    1611    10      11
log(x)*(0 + O(x  )) + (-----*x  + ------*x  + -------*x   + O(x  ))
                        768        2048        81920

pade(sin(sqrt(x)),x,0,3,3);


           3            2
 x*(56447*x  - 4851504*x  + 132113520*x - 885487680)
------------------------------------------------------
                 3         2
 7*sqrt(x)*(179*x  - 7200*x  - 2209680*x - 126498240)

taylor(ws-sin(sqrt(x)),x,0,10);


        1        13/2         1399187         15/2
 - ------------*x     + --------------------*x
    6227020800           229747925062656000

          1364974757          17/2           12300718539103          19/2
 - -------------------------*x     + ------------------------------*x
    10397012600785434624000           6310321239870308548952064000

      21/2
 + O(x    )


end;


Time for test: 49929 ms, plus GC time: 280 ms


REDUCE Historical
REDUCE Sourceforge Project | Historical SVN Repository | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]