TPS.TST 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. % Author: Alan Barnes <barnesa@aston.ac.uk>.
  2. psexplim 8;
  3. % expand as far as 8th power (default is 6)
  4. cos!-series:=ps(cos x,x,0);
  5. sin!-series:=ps(sin x,x,0);
  6. atan!-series:=ps(atan x,x,0);
  7. tan!-series:=ps(tan x,x,0);
  8. cos!-series*tan!-series; % should series for sin(x)
  9. df(cos!-series,x); % series for sin(x) again
  10. cos!-series/atan!-series;
  11. ps(cos!-series/atan!-series,x,0); % should be expanded
  12. tmp:=ps(1/(1+x^2),x,infinity);
  13. df(tmp,x);
  14. ps(df(1/(1+x^2),x),x,infinity);
  15. tmp*x; % not expanded as a single power series
  16. ps(tmp*x,x,infinity); % now expanded
  17. ps(1/(a*x-b*x^2),x,a/b); % pole at expansion point
  18. ps(cos!-series*x,x,2);
  19. tmp:=ps(x/atan!-series,x,0);
  20. tmp1:=ps(atan!-series/x,x,0);
  21. tmp*tmp1; % should be 1, of course
  22. cos!-sin!-series:=ps(cos sin!-series,x,0);
  23. % cos(sin(x))
  24. tmp:=cos!-sin!-series^2;
  25. tmp1:=ps((sin(sin!-series))^2,x,0);
  26. tmp+tmp1; % sin^2 + cos^2
  27. psfunction tmp1;
  28. % function represented by power series tmp1
  29. tmp:=tan!-series^2;
  30. psdepvar tmp;
  31. % in case we have forgotten the dependent variable
  32. psexpansionpt tmp; % .... or the expansion point
  33. psterm(tmp,6); % select 6th term
  34. tmp1:=ps(1/(cos x)^2,x,0);
  35. tmp1-tmp; % sec^2-tan^2
  36. ps(int(e^(x^2),x),x,0); % integrator not called
  37. tmp:=ps(1/(y+x),x,0);
  38. ps(int(tmp,y),x,0); % integrator called on each coefficient
  39. pscompose(cos!-series,sin!-series);
  40. % power series composition cos(sin(x)) again
  41. cos!-sin!-series;
  42. % should be same as previous result
  43. psfunction cos!-sin!-series;
  44. tmp:=ps(log x,x,1);
  45. tmp1:=pscompose(tmp, cos!-series);
  46. % power series composition of log(cos(x))
  47. df(tmp1,x);
  48. psreverse tan!-series;
  49. % should be series for atan y
  50. atan!-series;
  51. tmp:=ps(e^x,x,0);
  52. psreverse tmp;
  53. % NB expansion of log y in powers of (y-1)
  54. end;