patches.tst 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. % This file tests some of the patches included in the patches.red file.
  2. % If the latter file has been correctly installed, none of these should
  3. % give an error.
  4. % 7 Aug 99.
  5. % This did not terminate.
  6. df(tan((sqrt(1-x^2)*asin acos x + 2*sqrt(1-x^2)*x)/x),x);
  7. % 20 Oct 99.
  8. % This gave a wrong answer.
  9. a1:=12x^2-16x+3;
  10. a2:=3x-4;
  11. off mcd;
  12. on combineexpt;
  13. e^(a1/a2);
  14. on mcd; off combineexpt;
  15. clear a1,a2;
  16. % 8 Nov 99.
  17. % This gave a catastrophic error.
  18. factorize(2*c*s*u^3*v^5-2*c*s*u^3*v +2*c*s*u*v^5-2*c*s*u*v
  19. -s^2*u^4*v^4+s^2*u^4+s^2*u^2*v^6-s^2*u^2*v^4-s^2*u^2*v^2
  20. +s^2*u^2 +s^2*v^6-s^2*v^2+u^4*v^4-u^4*v^2 -v^4+v^2);
  21. % 18 Dec 99.
  22. % The following integration generated a catastrophic error.
  23. load_package numeric;
  24. on rounded;
  25. f := exp(10*exp(-x)*(x+1-0.1))$
  26. num_int(f,x=(0 .. 300));
  27. off rounded;
  28. clear f;
  29. % 31 Jan 00.
  30. % This gave an error that x was invalid as a kernel.
  31. weight x=1,y=1; wtlevel 10; factor x;
  32. symbolic(wtl!* := asymplis!* := nil);
  33. remfac x;
  34. % 5 Feb 00.
  35. % This gave a spurious error.
  36. matx := mat((1,2)); sign sqrt 42;
  37. % 6 Feb 00.
  38. % This gave a wrong answer.
  39. on complex;
  40. sqrt(i*sqrt(3)-1);
  41. off complex;
  42. % 10 Feb 00.
  43. % This gave the error that "***** x= - 2.61803398875 invalid as scalar."
  44. on rounded,fullroots;
  45. solve(x^3+4*x^2+4*x+1,x);
  46. off rounded,fullroots;
  47. % 18 Feb 00.
  48. % This used to cause a type mismatch error.
  49. m := mat((a,b),(c,d)); det sub(a=1,m);
  50. % 18 Apr 00.
  51. % matchlength!* can now be set to match more products.
  52. for all a let opr(a*v) = a*opr(v);
  53. opr(a1*a2*a3*a4*a5*v);
  54. matchlength!* := 6;
  55. opr(a1*a2*a3*a4*a5*v);
  56. % 22 Apr 00;
  57. % This example created a long list in oldrules!*.
  58. procedure hu (x); wq(x) := x^2; wq(2) := 20;
  59. for i:=1:1000 do hu i; for i:=1:1000 do hu i;
  60. lisp length oldrules!*;
  61. % 28 Jul 00.
  62. % A sum index within a derivative was treated as an identifier.
  63. sum(x^n/factorial n*sub(x=0,df(cos x,x,n)),n,0,5);
  64. % 2 Aug 00.
  65. % With complex on, some factorizations seemed to run forever.
  66. on complex;
  67. factorize (400*y^12+400*y^10*z+40*y^9*z^2+100*y^8*z^2
  68. +20*y^7*z^5+120*y^7*z^4+20*y^7*z^3+41*y^6*z^4+60*y^5*z^7
  69. +60*y^5*z^5+20*y^4*z^7+6*y^4*z^6+20*y^4*z^5
  70. +2*y^3*z^6+9*y^2*z^8+6*y*z^8+z^8);
  71. off complex;
  72. % 29 Aug 00.
  73. % This caused a segmentation violation or similar error.
  74. load_package gentran,scope;
  75. matrix aaa(10,10);
  76. on gentranopt;
  77. gentran aaa(1,1) ::=: aaa(1,1);
  78. off gentranopt;
  79. % 19 Sep 00.
  80. % This used to give a spurious "not found" message.
  81. sqrt_:= {sqrt(~x/~y) => sqrt x/sqrt y};
  82. clearrules sqrt_;
  83. clear sqrt_;
  84. % 20 Sep 00.
  85. % The following caused a catastrophic error.
  86. load_package algint;
  87. int(1/sqrt((2*e^c-y)/(e^c*y)),y);
  88. % 8 Nov 00.
  89. % The following did not optimize completely.
  90. load_package scope;
  91. dX1 := - sqrt(abs(k_l*mttx1 - k_l*mttx2))*sign(k_l*mttx1 - k_l*mttx2)*f*mttu5 +
  92. sqrt(abs(k_l*mttx1 - k_s*mttx3 - mttu3))*
  93. sign( - k_l*mttx1 + k_s*mttx3 + mttu3)*f*mttu6 +
  94. sqrt(abs(k_l*mttx1 - k_s*mttx4 - mttu4))*
  95. sign( - k_l*mttx1 + k_s*mttx4 + mttu4)*f*mttu7 - mttu2$
  96. dX2 := sqrt(abs(k_l*mttx1 - k_l*mttx2))*sign(k_l*mttx1 - k_l*mttx2)*f*mttu5
  97. - sqrt(abs(k_l*mttx2 - k_s*mttx3))*sign(k_l*mttx2 - k_s*mttx3)*f*mttu8
  98. - sqrt(abs(k_l*mttx2 - k_s*mttx4))*sign(k_l*mttx2 - k_s*mttx4)*f*mttu9 +
  99. mttu1$
  100. dX3 := f*( - sqrt(abs(k_l*mttx1 - k_s*mttx3 - mttu3))*
  101. sign( - k_l*mttx1 + k_s*mttx3 + mttu3)*mttu6 +
  102. sqrt(abs(k_l*mttx2 - k_s*mttx3))*
  103. sign(k_l*mttx2 - k_s*mttx3)*mttu8)$
  104. dX4 := f*( - sqrt(abs(k_l*mttx1 - k_s*mttx4 - mttu4))*
  105. sign( - k_l*mttx1 + k_s*mttx4 + mttu4)*mttu7 +
  106. sqrt(abs(k_l*mttx2 - k_s*mttx4))*
  107. sign(k_l*mttx2 - k_s*mttx4)*mttu9)$
  108. optimize
  109. dX1 :=: dX1,
  110. dX2 :=: dX2,
  111. dX3 :=: dX3,
  112. dX4 :=: dX4
  113. iname s$
  114. remprop('!:rd!:,'intequivfn);
  115. % 20 Nov 00.
  116. % This used to return results in the wrong order.
  117. noncom u,v;
  118. sum(u(n)*v(1-n),n,0,1);
  119. % 13 Dec 00.
  120. % This used to go into an infinite loop.
  121. on numval,rounded; y:=x^4+x3*x^3+x2*x^2+x1*x+x0;
  122. on fullroots;
  123. % This one takes a long time.
  124. % solve(y,x)$
  125. off numval,rounded,fullroots; clear y;
  126. % 9 Jan 01.
  127. solve({y=x+t^2,x=y+u^2},{x,y,u,t});
  128. % 14 Jan 01.
  129. % This caused an error.
  130. resultant(p^3-3p^2-a,3p*(p-2),p);
  131. % 19 Jan 01.
  132. % Some algebraic integrals could produce a catastrophic error.
  133. % Unfortunately, there is no simple example of this problem.
  134. % 22 Jan 01.
  135. % This used to give a spurious zero divisor error.
  136. int((sqrt((-sqrt(a^4*x^2+4)+a^2*x)/(2*x))
  137. *(-sqrt(a^4*x^2+4)*a^2*x-a^4*x^2-4))/(2*(a^4*x^2+4)),x);
  138. % This used to return an incorrect result.
  139. noncom q;
  140. 1/mat((1,0,0),(x/p*q 1,1,0),(x*y/(2p*(p-1))*q 1*q 1,y/(p-2)*q 1,1));
  141. % 2 Feb 01.
  142. % This used to give a spurious zero divisor error.
  143. solve(sqrt x*sqrt((4x^2*x+1)/x)-1=0,x);
  144. % 9 Feb 01.
  145. % The patched version of combine!-logs included an undefined macro.
  146. % No test is included for this.
  147. % 20 Feb 01.
  148. % Even with combineexpt on, some expressions did not simplify adequately.
  149. on combineexpt;
  150. a*a^x;
  151. e*e^(2/(2-x));
  152. e^(x+3)*e^(3/(4-3*x))/e^(5*x-3);
  153. off combineexpt;
  154. % 6 Mar 01.
  155. % This produced a stream of "***** Unexpected algebraic" messages and
  156. % then aborted.
  157. int((x^(2/3)*sqrt(sqrt(y)*sqrt(pi) + 2*pi*y*x)*sqrt( - sqrt(y)*sqrt(pi)
  158. + 2pi*y*x))/(4pi*y*x^3 - x),x);
  159. end;