rataprx.tst 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. % Tests of the rataprx package.
  2. % Authors: Lisa Temme, Wolfram Koepf (koepf@zib.de)
  3. % periodic decimal representations
  4. rational2periodic(1/3);
  5. periodic2rational(ws);
  6. rational2periodic(-1/3);
  7. periodic2rational(ws);
  8. rational2periodic(1.2/3);
  9. periodic2rational(ws);
  10. rational2periodic(1/3.4);
  11. periodic2rational(ws);
  12. rational2periodic(1.2/3.4);
  13. periodic2rational(ws);
  14. rational2periodic(352673/3124);
  15. periodic2rational(ws);
  16. rational2periodic(53765/5216);
  17. periodic2rational(ws);
  18. % continued fractions
  19. % of numbers
  20. cfrac pi;
  21. cfrac(pi,3);
  22. cfrac(pi,20);
  23. oldprec:=precision 20;
  24. cfrac pi;
  25. cfrac(pi^2);
  26. cfrac(pi*e*sqrt(2));
  27. precision oldprec;
  28. % of rational functions
  29. cfrac((x+2/3)^2/(6*x-5),x);
  30. cfrac((x+2/3)^2/(6*x-5),x,0);
  31. cfrac((x+2/3)^2/(6*x-5),x,1);
  32. cfrac((x+2/3)^2/(6*x-5),x,10);
  33. cfrac((x*8-7/2)^4/(x^5-2/3),x);
  34. cfrac((x*8-7/2)^4/(x^5-2/3),x,2);
  35. % of analytic functions
  36. cfrac(e^x,x,10);
  37. % default order is 4
  38. cfrac(e^x,x);
  39. cfrac(x^2/(x-1)*e^x,x);
  40. cfrac(x^2/(x-1)*e^x,x,2);
  41. cfrac(atan(x),x,10);
  42. cfrac(asin(x),x,5);
  43. % not implemented
  44. cfrac(log(x),x,4);
  45. cfrac(asech(x),x,5);
  46. cfrac(sin sqrt x,x,4);
  47. % wrong input
  48. cfrac(1,x);
  49. cfrac(x,x,x);
  50. cfrac(x,x,x,5);
  51. % Pade representations
  52. pade(sin(x),x,0,3,3);
  53. pade(tanh(x),x,0,5,5);
  54. pade(atan(x),x,0,5,5);
  55. pade(1/(x*sin(x)),x,0,3,2);
  56. pade(sin(x)/x^2,x,0,10,1);
  57. pade(sin(x)/x^2,x,0,10,2);
  58. pade(sin(x)/x^2,x,0,10,3);
  59. pade(exp(x),x,0,10,10);
  60. pade(sin(x),x,0,20,20);
  61. % no Pade Approximation exists
  62. pade(exp(1/x),x,0,5,5);
  63. % wrong order
  64. pade(sin(x)/x^2,x,0,10,0);
  65. % not implemented
  66. pade(factorial(x),x,1,3,3);
  67. % extended Pade representations
  68. pade(asech(x),x,0,3,3);
  69. taylor(ws-asech(x),x,0,10);
  70. pade(sin(sqrt(x)),x,0,3,3);
  71. taylor(ws-sin(sqrt(x)),x,0,10);
  72. end;