TRI.TST 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. % load tri;
  2. global '(textest!*);
  3. symbolic procedure texexa(code);
  4. begin
  5. prin2 "\TRIexa{"; prin2 textest!*;
  6. if !*TeXindent then prin2 "}{TeXindent}{" else
  7. if !*TeXbreak then prin2 "}{TeXBreak}{" else
  8. if !*TeX then prin2 "TeX" else prin2 "}{---}{";
  9. if !*TeXbreak then prin2 tolerance!* else prin2 "---";
  10. prin2 "}{"; prin2 code; prin2 "}"; terpri()
  11. end;
  12. algebraic procedure exa(expression,code);
  13. begin symbolic texexa code; return expression end;
  14. % ----------------------------------------------------------------------
  15. % Examples from the Integrator Test File
  16. % ----------------------------------------------------------------------
  17. symbolic(textest!*:="Integration");
  18. texsetbreak(120,1000);
  19. on texindent;
  20. off echo;
  21. out "tritst.tex";
  22. exa(int(1+x+x**2,x),
  23. "int(1+x+x**2,x);");
  24. exa(int(x**2*(2*x**2+x)**2,x),
  25. "int(x**2*(2*x**2+x)**2,x);");
  26. exa(int(x*(x**2+2*x+1),x),
  27. "int(x*(x**2+2*x+1),x);");
  28. exa(int(1/x,x),
  29. "int(1/x,x);");
  30. exa(int((x+1)**3/(x-1)**4,x),
  31. "int((x+1)**3/(x-1)**4,x);");
  32. exa(int(1/(x*(x-1)*(x+1)**2),x),
  33. "int(1/(x*(x-1)*(x+1)**2),x);");
  34. exa(int((a*x+b)/((x-p)*(x-q)),x),
  35. "int((a*x+b)/((x-p)*(x-q)),x);");
  36. exa(int(1/(a*x**2+b*x+c),x),
  37. "int(1/(a*x**2+b*x+c),x);");
  38. exa(int((a*x+b)/(1+x**2),x),
  39. "int((a*x+b)/(1+x**2),x);");
  40. exa(int(1/(x**2-2*x+3),x),
  41. "int(1/(x**2-2*x+3),x);");
  42. % Rational function examples from Hardy, Pure Mathematics, p 253 et seq.
  43. exa(int(1/((x-1)*(x**2+1))**2,x),
  44. "int(1/((x-1)*(x**2+1))**2,x);");
  45. exa(int(x/((x-a)*(x-b)*(x-c)),x),
  46. "int(x/((x-a)*(x-b)*(x-c)),x);");
  47. exa(int(x/((x**2+a**2)*(x**2+b**2)),x),
  48. "int(x/((x**2+a**2)*(x**2+b**2)),x);");
  49. exa(int(x**2/((x**2+a**2)*(x**2+b**2)),x),
  50. "int(x**2/((x**2+a**2)*(x**2+b**2)),x);");
  51. exa(int(x/((x-1)*(x**2+1)),x),
  52. "int(x/((x-1)*(x**2+1)),x);");
  53. exa(int(x/(1+x**3),x),
  54. "int(x/(1+x**3),x);");
  55. exa(int(x**3/((x-1)**2*(x**3+1)),x),
  56. "int(x**3/((x-1)**2*(x**3+1)),x);");
  57. exa(int(1/(1+x**4),x),
  58. "int(1/(1+x**4),x);");
  59. exa(int(x**2/(1+x**4),x),
  60. "int(x**2/(1+x**4),x);");
  61. exa(int(1/(1+x**2+x**4),x),
  62. "int(1/(1+x**2+x**4),x);");
  63. exa(int(sin x**2/x,x),
  64. "int(sin x**2/x,x);");
  65. exa(int(x*cos(xi/sin(x))*cos(x)/sin(x)**2,x),
  66. "int(x*cos(xi/sin(x))*cos(x)/sin(x)**2,x);");
  67. shut "tritst.tex";
  68. off tex;
  69. end;