123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104 |
- 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
|