definth.red 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. module definth;
  2. fluid '(mellin!-transforms!* mellin!-coefficients!*);
  3. algebraic <<
  4. operator indefint2;
  5. indefint2_rules :=
  6. { indefint2((~f1+~~f2)/~~f3,~x,~y) =>
  7. indefint2(f1/f3,x,y)+indefint2(f2/f3,x,y) when not(f2=0),
  8. indefint2(~n,~f1-~f2,~x,~y) =>
  9. indefint2(n,f1,x,y)-indefint2(n,f2,x,y),
  10. indefint2(~n,~f1+~f2,~x,~y) =>
  11. indefint2(n,f1,x,y)+indefint2(n,f2,x,y),
  12. indefint2(1/~x^(~~a),~f,~x,~y) => transf(defint_choose(f,x),-a,y,x),
  13. indefint2(~x^(~~b)*sqrt(~x),~f,~x,~y) =>
  14. transf(defint_choose(f,x),b+1/2,y,x),
  15. indefint2(sqrt(~x),~f,~x,~y) =>
  16. transf(defint_choose(f,x),1/2,y,x),
  17. indefint2(~x^(~~a),~f,~x,~y) => transf(defint_choose(f,x),a,y,x),
  18. indefint2(~b*~ff,~f,~x,~y) => b*indefint2(ff,f,x,y) when freeof (b,x),
  19. indefint2(~b/(~~c*~ff),~f,~x,~y) => b/c*indefint2(1/ff,f,x,y)
  20. when freeof (b,x) and freeof (c,x) and not(b=1 and c=1),
  21. indefint2(~ff/~b,~f,~x,~y) =>
  22. 1/b*indefint2(ff,f,x,y) when freeof (b,x),
  23. indefint2(~b*~ff,~f,~x,~y) => b*indefint2(ff,f,x,y) when freeof (b,x),
  24. indefint2(~ff/~b,~f,~x,~y) =>
  25. 1/b*indefint2(ff,f,x,y) when freeof (b,x),
  26. indefint2(~~b,~f,~x,~y) => b*indefint2(f,x,y)
  27. when freeof (b,x) and not(b=1),
  28. indefint2(~f,~x,~y) => transf(defint_choose(f,x),0,y,x)
  29. };
  30. let indefint2_rules;
  31. symbolic procedure simpinteg(u);
  32. begin scalar ff1,alpha,y,var,chosen_num,coef,!*uncached;
  33. !*uncached := t;
  34. ff1 := prepsq simp car u;
  35. if ff1 = 'UNKNOWN then return simp 'UNKNOWN;
  36. alpha := cadr u;
  37. y := caddr u;
  38. var := cadddr u;
  39. chosen_num := cadr ff1;
  40. if chosen_num = 0 then << coef := caddr ff1;
  41. return simp reval
  42. algebraic(coef*y**(alpha+1)/(alpha+1))>>
  43. else
  44. << put('f1,'g,getv(mellin!-transforms!*,chosen_num));
  45. coef := getv(mellin!-coefficients!*,chosen_num);
  46. if coef then MELLINCOEF:= coef else MELLINCOEF :=1;
  47. return simp list('new_mei,'f1 . cddr ff1,alpha,y,var)>>;
  48. end$
  49. put('new_mei,'simpfn,'new_meijer)$
  50. symbolic procedure new_meijer(u);
  51. begin scalar f,y,mellin,new_mellin,m,n,p,q,old_num,old_denom,temp,a1,
  52. b1,a2,b2,alpha,num,denom,n1,temp1,temp2,coeff,v,var,new_var,new_y,
  53. new_v,k;
  54. f := prepsq simp car u;
  55. y := caddr u;
  56. mellin := bastab(car f,cddr f);
  57. temp := car cddddr mellin;
  58. var := cadr f;
  59. if not idp VAR then RETURN error(99,'FAIL); % something is rotten, if not...
  60. % better give up
  61. temp := reval algebraic(sub(x=var,temp));
  62. mellin := {car mellin,cadr mellin,caddr mellin,cadddr mellin,temp};
  63. temp := reduce_var(cadr u,mellin,var);
  64. alpha := simp!* car temp;
  65. new_mellin := cdr temp;
  66. if car cddddr new_mellin neq car cddddr mellin then
  67. << k := car cddddr mellin;
  68. y := reval algebraic(sub(var=y,k));
  69. new_y := simp y>>
  70. else
  71. << new_var := car cddddr new_mellin;
  72. new_y := simp reval algebraic(sub(x=y,new_var))>>;
  73. n1 := addsq(alpha,'(1 . 1));
  74. temp1 := {'expt,y,prepsq n1};
  75. temp2 := cadddr new_mellin;
  76. coeff := simp!* reval algebraic(temp1*temp2);
  77. m := caar new_mellin;
  78. n := cadar new_mellin;
  79. p := caddar new_mellin;
  80. q := car cdddar new_mellin;
  81. old_num := cadr new_mellin;
  82. old_denom := caddr new_mellin;
  83. for i:=1 :n do
  84. << if old_num = nil then a1 := append(a1,{simp!* old_num })
  85. else << a1 := append(a1,{simp!* car old_num});
  86. old_num := cdr old_num>>;
  87. >>;
  88. for j:=1 :m do
  89. << if old_denom = nil then b1 := append(b1,{simp!* old_denom })
  90. else << b1 := append(b1,{simp!* car old_denom});
  91. old_denom := cdr old_denom>>;
  92. >>;
  93. a2 := listsq old_num;
  94. b2 := listsq old_denom;
  95. if a1 = nil and a2 = nil then
  96. num := list({negsq alpha})
  97. else if a2 = nil then num := list(append(a1,{negsq alpha}))
  98. else
  99. << num := append(a1,{negsq alpha}); num := append({num},a2)>>;
  100. if b1 = nil and b2 = nil then
  101. denom := list({subtrsq(negsq alpha,'(1 . 1))})
  102. else if b2 = nil then
  103. denom := list(b1,subtrsq(negsq alpha,'(1 . 1)))
  104. else
  105. << denom := list(b1,subtrsq(negsq alpha,'(1 . 1)));
  106. denom := append(denom,b2)>>;
  107. v := gfmsq(num,denom,new_y);
  108. if v = 'fail then return simp 'fail
  109. else v := prepsq v;
  110. if eqcar(v,'meijerg) then new_v := v else new_v := simp v;
  111. return multsq(new_v,coeff);
  112. end$
  113. symbolic procedure reduce_var(u,v,var1);
  114. % Reduce Meijer G functions of powers of x to x
  115. begin scalar var,m,n,coef,alpha,beta,alpha1,alpha2,expt_flag,k,temp1,
  116. temp2,const,new_k;
  117. var := car cddddr(v);
  118. beta := 1;
  119. % If the Meijer G-function is is a function of a variable which is not
  120. % raised to a power then return initial function
  121. if length var = 0 then return u . v
  122. else
  123. << k := u; coef := cadddr v;
  124. for each i in var do
  125. << if listp i then
  126. << if car i = 'expt then
  127. << alpha := caddr i; expt_flag := 't>>
  128. else if car i = 'sqrt then
  129. << beta := 2; alpha := 1; expt_flag := 't>>
  130. else if car i = 'times then
  131. << temp1 := cadr i; temp2 := caddr i;
  132. if listp temp1 then
  133. << if car temp1 = 'sqrt then
  134. << beta := 2; alpha1 := 1; expt_flag := 't>>
  135. else if car temp1 = 'expt and listp caddr temp1 then
  136. << beta := cadr cdaddr temp1;
  137. alpha1 := car cdaddr temp1;
  138. expt_flag := 't>>;
  139. >>;
  140. if listp temp2 and car temp2 = 'expt then
  141. << alpha2 := caddr temp2; expt_flag := 't>>;
  142. if alpha1 neq 'nil then
  143. alpha := reval algebraic(alpha1 + beta*alpha2)
  144. else alpha := alpha2;
  145. >>;
  146. >>
  147. else
  148. << if i = 'expt then << alpha := caddr var; expt_flag := 't>>;
  149. >>;
  150. >>;
  151. % If the Meijer G-function is is a function of a variable which is not
  152. % raised to a power then return initial function
  153. if expt_flag = nil then return u . v
  154. % Otherwise reduce the power by using the following formula :-
  155. %
  156. % y (c*y)^(m/n)
  157. % / /
  158. % | n |
  159. % |t^k*F((c*t)^(m/n))dt = --------- |z^[((k + 1)*n - m)/m]*F(z)dz
  160. % | m*c^(k+1) |
  161. % / /
  162. % 0 0
  163. else
  164. << if listp alpha then << m := cadr alpha; n := caddr alpha;
  165. n := reval algebraic(beta*n)>>
  166. else << m := alpha; n := beta>>;
  167. const := reval algebraic(sub(var1=1,var));
  168. const := reval algebraic(1/(const^(n/m)));
  169. new_k := reval algebraic(((k + 1)*n - m)/m);
  170. coef := reval algebraic((n/m)*coef*(const)^(k+1));
  171. var := reval algebraic(var^(n/m));
  172. return {new_k,car v,cadr v, caddr v,coef,var}>>;
  173. >>;
  174. end$
  175. >>;
  176. endmodule;
  177. end;