# gsolution is general solution of linear differential equation; #8; gsolution(b_,p_,c_,m_,f_,y_,x_,q_):=if(b+c+f-1==0,C_1*exp(x), if(p==q,gsolution(c/(1-b),m,f/(1-b),y,x,p),C_1*exp(nsolve(x^q-b*x^p-c*x^m-f,x)*x))); gsolution(b_,n_,c_,m_,0,y_,x_,q_):= int(gsolution(b,n-m,c,y,x,q-m),x,m)+if(m>0,C_3,0); #6; gsolution0(b_,p_,c_,y_,x_,q_):=if(isfree(b,c,y) and isfree(b,c,x), if(2p==q, if(b*b+4c==0, if(p>=1 or b>0, C_1*exp((b/2)^(1/p)*x)+C_2*exp((b/2)^(1/p)*x)*x,0), if(b*b+4c<0, if(p>=0.8 or b>0, C_1*exp((b/2-sqrt(b^2+4c)/2)^(1/p)*x)+C_2*exp((b/2+sqrt(b^2+4c)/2)^(1/p)*x),0), if(b-(b^2+4c)^0.5>0, C_1*exp((b/2-sqrt(b^2+4c)/2)^(1/p)*x),0)+if(b+(b^2+4c)^0.5>0,C_2*exp((b/2+sqrt(b^2+4c)/2)^(1/p)*x),0) )), C_1*exp(nsolve(x^q-b*x^p-c)*x) ), if(b+c==1, C_1*exp(x), if(d(b,x,p)+c==0 and d(b,x,q)==0, C_1*b ))); gsolution0(b_,p_,0,y_,x_,q_):= if(isfree(b,y),int(gsolution(b,y,x,q-p),x,p)+ gsolution(0,y,x,p), if(hasnot(b,x),int(1/(int(b,y,q-p)),y)=(-1)^(q-p-1)*(C_1+x)^(q-p)/(q-p)! )); #gsolution(b_,p_,0,y_,x_,q_):= if(isfree(b,y),int(gsolution(b,y,x,q-p),x,p)+ gsolution(0,y,x,p) ); gsolution(b_+y_,p_,c_,y_,x_,q_):= if(d(b,x,p)==0, gsolution(y,p,c,y,x,q)-b); gsolution(exp(y_),p_,0,y_,x_,q_):=log(d(log(C_1+x),x,q)/d(log(C_1+x),x,p)) and if(iseven(q-p),log((-1)^(q-p)*(q-1)!/(p-1)!*(C_1-x)^(p-q)),gsolution(0,y,x,p) ); gsolution(exp(b_+y_),p_,0,y_,x_,q_):= if(d(b,x,p)==0,log(d(log(C_1+x),x,q)/d(log(C_1+x),x,p))-b and if(iseven(q-p),log((-1)^(q-p)*(q-1)!/(p-1)!*(C_1-x)^(p-q))-b,gsolution(0,y,x,p) )); gsolution(exp(b_*y_),p_,0,y_,x_,q_):= if(isconstant(b),1/b*log(d(log(C_1+x),x,q)/d(log(C_1+x),x,p)) ); gsolution(exp(f_+b_*y_),p_,0,y_,x_,q_):= if(isconstant(b) and d(f,x,p)==0,-f/b+1/b*log(d(log(C_1+x),x,q)/d(log(C_1+x),x,p)) ); gsolution(y_^m_,p_,0,y_,x_,q_):= block(f:=(fallingfactorial((p-q)/m,q)/fallingfactorial((p-q)/m,p))^(1/m)/(C_1+x)^((q-p)/m), f and if(iseven(m),-f,gsolution(0,y,x,p) )) ; gsolution(y_,p_,0,y_,x_,q_):= block(f:=(fallingfactorial(p-q,q)/fallingfactorial(p-q,p)), f/(C_1+x)^(q-p) and if(iseven(q-p), f/(C_1-x)^(q-p), gsolution(0,y,x,p) )); #gsolution(y_,p_,0,y_,x_,q_):= (-1)^(q-p)*Gamma(2q-p)/Gamma(q)/(C_1+x)^(q-p); gsolution(c_*exp(y_),p_,0,y_,x_,q_):=if(isconstant(c),log(d(log(C_1+x),x,q)/d(log(C_1+x),x,p)/c) and if(iseven(q-p),log((-1)^(q-p)*(q-1)!/(p-1)!*(C_1-x)^(p-q)/c),gsolution(0,y,x,p) )); gsolution(c_*exp(b_+y_),p_,0,y_,x_,q_):=if(isconstant(c) and d(b,x,p)==0,log(d(log(C_1+x),x,q)/d(log(C_1+x),x,p)/c)-b and if(iseven(q-p),log((-1)^(q-p)*(q-1)!/(p-1)!*(C_1-x)^(p-q)/c)-b,gsolution(0,y,x,p) )); gsolution(c_*exp(b_*y_),p_,0,y_,x_,q_):=if(isconstant(b,c), log(d(log(C_1+x),x,q)/d(log(C_1+x),x,p)/c)/b ); gsolution(b_*y_^m_,p_,0,y_,x_,q_):= if(hasnot(b,x),block(f:=(fallingfactorial((p-q)/m,q)/fallingfactorial((p-q)/m,p)/b)^(1/m)/(C_1+x)^((q-p)/m), f and if(iseven(m),-f,gsolution(0,y,x,p) )) ); gsolution(b_*y_,p_,0,y_,x_,q_):= if(hasnot(b,x), block(f:=(fallingfactorial(p-q,q)/fallingfactorial(p-q,p))/b, f/(C_1+x)^(q-p) and if(iseven(q-p), f/(C_1-x)^(q-p), gsolution(0,y,x,p) )) ); gsolution(b_,1,c_,y_,x_,q_):=gsolution(b,c,y,x,q); gsolution(b_/y_,1,0,y_,x_,2):= if(isconstant(b), inverseli(C_1+b*x)); #gsolution(1/y_,1,0,y_,x_,3):= int( 1/sqrt(c_1 *y + 2y* log(y) + c_2),y)=c_3 + x; gsolution(1/y_,1,0,y_,x_,3):= sqrt(e*pi)*erfi(sqrt(log(y)/2-1/2))=c_3 + x; gsolution(1/y_,1,0,y_,x_,2):= inverseli(C_1+x); gsolution(y_^(-0.5),1,0,y_,x_,2):= (W(C_1*exp(x))+1)^2; gsolution(y_,1,0,y_,x_,2):= gsolution(y,0,y,x,2); gsolution(exp(xx_)*y_^n_, p_,0,y_,x_,q_) := if(d(xx,x,2)==0, (-d(xx,x)/n)^((q-p)/n)*exp(-xx/n) and if(iseven(n), -(-d(xx,x)/n)^((q-p)/n)*exp(-xx/n),gsolution(0,y,x,p) )); gsolution(exp(xx_)*y_, p_,0,y_,x_,q_) := if(d(xx,x,2)==0, (-d(xx,x))^(q-p)*exp(-xx) ); #gsolution(exp(-x_)*y_,p_,0,y_,x_,q_):= exp(x); #gsolution(exp(x_)*y_,p_,0,y_,x_,q_) := (-1)^(q-p)*exp(-x); gsolution(x_*y_^m_,p_,0,y_,x_,q_):= (fallingfactorial((p-1-q)/m,q)/fallingfactorial((p-1-q)/m,p))^(1/m)/x^((1+q-p)/m) and if(iseven(m), -(fallingfactorial((p-1-q)/m,q)/fallingfactorial((p-1-q)/m,p))^(1/m)/x^((1+q-p)/m),gsolution(0,y,x,p)); gsolution(x_^n_*y_^m_,p_,0,y_,x_,q_):= (fallingfactorial((p-n-q)/m,q)/fallingfactorial((p-n-q)/m,p))^(1/m)/x^((n+q-p)/m) and if(iseven(m), -(fallingfactorial((p-n-q)/m,q)/fallingfactorial((p-n-q)/m,p))^(1/m)/x^((n+q-p)/m),gsolution(0,y,x,p)); #gsolution(c_*x_^n_*y_^m_,p_,0,y_,x_,q_):= if(isconstant(c),(1/c*fallingfactorial((p-n-q)/m,q)/fallingfactorial((p-n-q)/m,p))^(1/m)/x^((n+q-p)/m) and if(iseven(m), -(1/c*fallingfactorial((p-n-q)/m,q)/fallingfactorial((p-n-q)/m,p))^(1/m)/x^((n+q-p)/m),gsolution(0,y,x,p)) ); gsolution(x_^n_*y_,p_,0,y_,x_,q_):= if(n+q-p==0,fallingfactorial(n,q)/fallingfactorial(n,p)*x/(C_1+x), fallingfactorial(p-n-q,q)/fallingfactorial(p-n-q,p)/x^(n+q-p) ); gsolution(x_*y_,p_,0,y_,x_,q_):= fallingfactorial(p-1-q,q)/fallingfactorial(p-1-q,p)/x^(1+q-p); gsolution((c_+x_)^n_*z_,p_,g_,y_,x_,q_):=if(has(z,y),block(f:=gsolution(x^n*z,p,g,y,x,q), replace(f,x,c+x)) ); gsolution((c_+x_)*z_,p_,g_,y_,x_,q_):=if(has(z,y),block(f:=gsolution(x*z,p,g,y,x,q), replace(f,x,c+x)) ); gsolution(a_*b_*y_^n_,p_,0,y_,x_,q_):=if(hasnot(a,x), a^(-1/n)*(gsolution(b*y^n,p,0,y,x,q)) ); gsolution(a_*b_*y_,p_,0,y_,x_,q_):=if(hasnot(a,x), 1/a*(gsolution(b*y,p,0,y,x,q)) ); gsolution(b_,p_,c_,y_,x_,p_):=gsolution(c/(1-b),y,x,p); #5 second term is first order; gsolution0(b_,c_,y_,x_,p_):= if(isconstant(b,c), C_1*exp(nsolve(x^p-b*x-c)*x), if(b+c==1, C_1*exp(x), if(b+c*x==0, C_1*x, if(isconstant(expand(b/c)+x), C_1*expand(b/c) )))); gsolution(b_,c_,y_,x_,2):= if(isconstant(b,c), if(b*b+4c==0, C_1*exp(b*x/2)+C_2*exp(b*x/2)*x, if(b*b+4c<0, C_1*exp(b*x/2)*cos(sqrt(-b^2-4c)/2*x)+C_2*exp(b*x/2)*sin(sqrt(-b^2-4c)/2*x), C_1*exp((b/2-sqrt(b^2+4c)/2)*x)+C_2*exp((b/2+sqrt(b^2+4c)/2)*x) )), if(b+c==1, C_1*exp(x), if(isconstant(expand(b/c)+x), C_1*expand(b/c) ))); gsolution(y_,c_,y_,x_,q_) :=If(isconstant(c),C_1-c*x ); gsolution(b_*y_,c_,y_,x_,q_) :=If(isconstant(b,c),C_1-c/b*x); gsolution(b_*x_,c_,y_,x_,p_):= if(b+c==0, C_1*x); #gsolution(b_*y_,c_,y_,x_,2):= If(isconstant(b,c),b/c*int( 1/((-W(-exp(-b^2/(2 c)*y^2 -b^2/c* C_2) - 1)/c) - 1),y)=C_1+x ); gsolution(b_/x_,c_,y_,x_,2):=if(c<0, C_1*besselJ((1+b)/2,sqrt(-c)*x)*x^((1+b)/2)+C_2*besselY((b+1)/2,sqrt(-c)*x)*x^((1+b)/2), if(c>0,C_1*besselI((b+1)/2,sqrt(c)*x)*x^((1+b)/2)+C_2*besselK((b+1)/2,sqrt(c)*x)*x^((1+b)/2))); gsolution(1/x_,c_,y_,x_,2):= if(c<0, C_1*besselJ(1,sqrt(-c)*x)*x+C_2*besselY(1,sqrt(-c)*x)*x, if(c>0,C_1*besselI(1,sqrt(c)*x)*x+C_2*besselK(1,sqrt(c)*x)*x)); gsolution(b_,c_*x_,y_,x_,2):= if(hasnot(b,c,x) and hasnot(b,c,y), C_1* exp(b*x/2)* Ai((c*x + b^2/4)/cbrt(c*c)) + C_2* exp(b*x/2)* Bi((c*x + b^2/4)/cbrt(c*c)) ); gsolution(b_,c_/x_, y_,x_,2):= if(b+c==0, C_1*x+C_2*(b*x*Ei(b*x)-exp(b*x))); gsolution(b_,b_/x_, y_,x_,2):= if(hasnot(b,x), C_1*x*exp(b*x)+C_2*(1+b*x*Ei(-b*x)*exp(b*x))); gsolution(b_,c_+x_,y_,x_,2):= if(hasnot(b,x) and hasnot(b,y), C_1* exp(b*x/2)* Ai(x + b^2/4+c) + C_2* exp(b*x/2)* Bi(x + b^2/4+c) ); gsolution(b_,c_+d_*x_,y_,x_,2):= if(isconstant(b,c,d),C_1 *exp(b*x/2) *Ai(( c + d* x + b^2/4)/cbrt(d*d)) + C_2 *exp(b*x/2) *Bi(( c + d *x + b^2/4)/cbrt(d*d)) ); gsolution(1,1/x_, y_,x_,2):= C_1*x*exp(x)+C_2*(1+x*Ei(-x)*exp(x)); gsolution(b_,x_,y_,x_,2):= if(hasnot(b,x) and hasnot(b,y), C_1* exp(b*x/2)* Ai(x + b^2/4) + C_2* exp(b*x/2)* Bi(x + b^2/4) ); gsolution(b_,x_^2,y_,x_,2):= if(hasnot(b,x) and hasnot(b,y), C_1*exp(1/2*b*x-1/2*x^2)*hermite(-b*b/8-1/2,x) ); gsolution(b_*x_,c_,y_,x_,2):= if(hasnot(b,c,x),if(b+c==0,C_1*(-exp(b/2*x^2)*sqrt(2/b)+sqrt(pi)*erfi(sqrt(b/2)*x)*x)+C_2*x, C_1*hermite(-c/b,sqrt(b/2)*x)+C_2*(hermite(-c/b,sqrt(b/2)*x)*(sqrt(pi)*erfi(sqrt(b/2)*x))+c*exp(b/2*x^2)*sqrt(2/b)*x) )); #gsolution(b_*x_,c_,y_,x_,2):= if(hasnot(b,c,x),if(b+c==0,C_1*(-exp(b/2*x^2)*sqrt(2/b)+sqrt(pi)*erfi(sqrt(b/2)*x)*x)+C_2*x, C_1*hermite(-c/b,sqrt(b/2)*x)+C_2*hypergeometric1F1( c/b/2, 1/2, b/2*x^2 ) )); gsolution(b_*x_,b_,y_,x_,2):= if(hasnot(b,x), C_1*exp(b/2 *x^2)+C_2 *exp(b/2* x^2)* erf(sqrt(b/2)* x) ); #gsolution(b_/a_,c_/a_,y_,x_,2):= if(d(a,x)== -b, C_1*legendreP(sqrt(4c+1)/2-1/2,x)+C_2*legendreQ(sqrt(4c+1)/2-1/2,x) ); gsolution(a_/c_,b_/c_, y_,x_,2):= if(c-b-a==0, C_1*exp(x), if(c-b+a==0, C_1*exp(-x), if((d(c,x)+a/2)==0 and d(c,x,2)+b==0, (C_1+C_2*x)/c, if(d(c,x)+a==0, C_1*legendreP(sqrt(4b+1)/2-1/2,x)+C_2*legendreQ(sqrt(4b+1)/2-1/2,x) )))); gsolution(c_*x_/(b_+x_^2),d_/(b_+x_^2),y_,x_,2):= if(c==-4 and d==-2,(C_1+C_2*x)/(b+x^2), if(isfree(b,c,x), c_1 *(x^2 + b)^(1/4 *c + 1/2)* legendreP((sqrt(1 + 2 c + 4 d + c^2))/2-1/2,(c/2 + 1),(sqrt(-1/b)* x)) + c_2 *(x^2 + b)^(1/4 *c + 1/2)* legendreQ((sqrt(1 + 2 c + 4 d + c^2))/2-1/2,(c/2 + 1),(sqrt(-1/b) *x)) )); gsolution(c_*x_/(b_+a_*x_^2),d_/(b_+a_*x_^2),y_,x_,2):= if(isfree(a,b,c,x), c_1 *(a *x^2 + b)^(1/4 *c/a + 1/2)* legendreP((sqrt(a^2 + 2 c *a + 4 d* a + c^2))/(-2 a)-1/2,(c/(2 a) + 1),(sqrt(-a/b)* x)) + c_2 *(a *x^2 + b)^(1/4 *c/a + 1/2)* legendreQ((sqrt(a^2 + 2 c* a + 4 d *a + c^2))/(-2 a)-1/2,(c/(2 a) + 1),(sqrt(-a/b) *x)) ); gsolution(-4*x_/(b_+x_^2),-2/(b_+x_^2),y_,x_,2):= (C_1+C_2*x)/(b+x^2); gsolution(x_/(c_+a_*x_^2),b_/(c_+a_*x_^2),y_,x_,2):= if(hasnot(a,b,c,x), C_1*chebyshevT(sqrt(-b),x) ); gsolution(x_/(c_+x_),1/(c_+x_),y_,x_,2):= if(hasnot(c,x), C_1*exp(x)*(c+x)^(1-c)+C_2*(c+x)^(1-c)*exp(x)*gamma(c-1,c+x) ); gsolution(1/(c_+x_),1/(c_+x_),y_,x_,2):= if(hasnot(c,x), C_1*(c+x)*besselI(2,2sqrt(c+x))+C_2*(c+x)*besselK(2,2sqrt(c+x)) ); gsolution(b_/x_,c_*x_^(-2),y_,x_,2):= if(isfree(b,c,x), if((b+1)^2+4c==0, C_1*x^((b+1)/2)+C_2*x^((b+1)/2)*log(x), if((b+1)^2+4c<0, C_1*x^((b+1)/2)*cos(log(x)*sqrt(-(b+1)^2-4c)/2)+C_2*x^((b+1)/2)*sin(log(x)*sqrt(-(b+1)^2-4c)/2), C_1*x^(b/2+1/2-sqrt((b+1)^2+4c)/2)+C_2*x^(b/2+1/2+sqrt((b+1)^2+4c)/2) ))); gsolution(b_/x_,x_^(-2),y_,x_,2):= if(isfree(b,x), if((b+1)^2+4==0, C_1*x^((b+1)/2)+C_2*x^((b+1)/2)*log(x), if((b+1)^2+4<0, C_1*x^((b+1)/2)*cos(log(x)*sqrt(-(b+1)^2-4)/2)+C_2*x^((b+1)/2)*sin(log(x)*sqrt(-(b+1)^2-4)/2), C_1*x^(b/2+1/2-sqrt((b+1)^2+4)/2)+C_2*x^(b/2+1/2+sqrt((b+1)^2+4)/2) ))); gsolution(b_/x_,c_/x_, y_,x_,2):= if(isconstant(b),if(c<0, C_1*besselJ(abs(-b-1),2sqrt(-c*x))*x^((1+b)/2)+C_2*besselY(abs(-1-b),2sqrt(-c*x))*x^((1+b)/2), C_1*besselI(abs(1+b),2sqrt(c*x))*x^((1+b)/2)+C_2*besselK(abs(1+b),2sqrt(c*x))*x^((1+b)/2) )); gsolution(b_/x_,1/x_, y_,x_,2):= if(isconstant(b), C_1*besselI(abs(-1-b),2sqrt(x))*x^((1+b)/2)+C_2*besselK(abs(-1-b),2sqrt(x))*x^((1+b)/2) ); gsolution(b_/x_,c_+n_*x_^(-2),y_,x_,2):= C_1* x^((1 + b)/2)* besselJ(1/2 sqrt(b^2 + 2 b + 4 n + 1),(-i*sqrt(c) *x)) + C_2* x^((1 + b)/2)* besselY(1/2 sqrt(b^2 + 2 b + 4 n + 1),-i*sqrt(c)* x); gsolution(b_/x_,c_+x_^(-2),y_,x_,2):= C_1* x^((1 + b)/2)* besselJ(1/2 sqrt(b^2 + 2 b + 4 + 1),(-i*sqrt(c) *x)) + C_2* x^((1 + b)/2)* besselY(1/2 sqrt(b^2 + 2 b + 4 + 1),-i*sqrt(c)* x); gsolution(b_/x_,(n_+c_*x_^2)*x_^(-2),y_,x_,2):= C_1* x^((1 + b)/2)* besselJ(1/2 sqrt(b^2 + 2 b + 4 n + 1),(-i*sqrt(c) *x)) + C_2* x^((1 + b)/2)* besselY(1/2 sqrt(b^2 + 2 b + 4 n + 1),-i*sqrt(c)* x); gsolution(b_/x_,(c_+x_^2)*x_^(-2),y_,x_,2):= C_1* x^((1 + b)/2)* besselI(1/2 sqrt(b^2 + 2 b + 4 + 1),(sqrt(c) *x)) + C_2* x^((1 + b)/2)* besselK(1/2 sqrt(b^2 + 2 b + 4 + 1),sqrt(c)* x); gsolution(a_*x_,b_*x_^2,y_,x_,2):= if(isconstant(a,b), C_1* exp((a/4-sqrt(a*a+4b)/4) *x^2)* hermite(-1/2 + a/2/sqrt(a*a+4b),sqrt(sqrt(a*a+4b))/sqrt(2)*x) ); gsolution(b_*x_,c_*x_, y_,x_,2):= if(isconstant(b,c), if(b==c, C_2*exp(-x)*(-2-x),0)+C_1*exp(-c/b*x)*hermite(c^2/b^3,(b^2*x+2c)/sqrt(2)/b^(3/2)) ); #gsolution(b_*x_,b_*x_, y_,x_,2):= if(isconstant(b), C_1*exp(-x)*(-2-x) ); gsolution((x_+b_)/x_,c_/x_, y_,x_,2):= C_1*hypergeometricU(c,-b,x)+C_2*laguerre(-c,-b-1,x); gsolution((x_+b_)/x_,-1/x_, y_,x_,2):= C_1*((-exp(x))+Ei(x)*(b+x))+C_2*(x+b); gsolution((x_+b_)/x_,1/x_, y_,x_,2):= C_1*hypergeometricU(1,-b,x)+C_2*laguerre(-1,-b-1,x); gsolution((-x_+b_)/x_,c_/x_, y_,x_,2):= C_1*exp(-x)*hypergeometricU(c-b,-b,x)+C_2*exp(-x)*laguerre(b-c,-b-1,x); gsolution((-x_+b_)/x_,1/x_, y_,x_,2):= C_1*exp(-x)*hypergeometricU(1-b,-b,x)+C_2*(x-b); gsolution((-x_-1)/x_,-1/x_, y_,x_,2):= C_1*exp(-x)+C_2*Ei(x)*exp(-x); gsolution(1/x_,c_/x_, y_,x_,2):= if(c<0, C_1*x*besselJ(2,2sqrt(-c*x))+C_2*x*besselY(2,2sqrt(-c*x)),C_1*x*besselI(2,2sqrt(c*x))+C_2*x*besselK(2,2sqrt(c*x)) ); gsolution(1/x_,c_*x_^(-2),y_,x_,2):= if(isfree(c,x), if(c== -1, C_1*x+C_2*x*log(x), if(c< -1, C_1*x*cos(log(x)*sqrt(-1-c))+C_2*x*sin(log(x)*sqrt(-1-c)), C_1*x^(1-sqrt(1+c))+C_2*x^(1+sqrt(1+c)) ))); gsolution(1/x_,c_*x_^2,y_,x_,2):= if(isconstant(c),C_1*cosh(sqrt(c)*x^2/2)+C_2*i*sinh(sqrt(c)*x^2/2) ); gsolution(1/x_,x_^(-2),y_,x_,2):= C_1*x^(1-sqrt(2))+C_2*x^(1+sqrt(2)); gsolution(1/x_,1/x_, y_,x_,2):= C_1*x*besselI(2,2sqrt(x))+C_2*x*besselK(2,2sqrt(x)); gsolution(1/x_,x_, y_,x_,2):= C_1*AiPrime(x)+C_2*BiPrime(x); gsolution(1/x_,x_^2,y_,x_,2):= C_1*cosh(x^2/2)+C_2*i*sinh(x^2/2); gsolution(-x_,-1,y_,x_,2):= C_1*exp(-x^2/2)*erfi(x/sqrt(2))+C_2*exp(-x^2/2); gsolution(-x_,1,y_,x_,2) := C_1*(sqrt(pi)*erf(x/sqrt(2))*x + sqrt(2)*exp(-x^2/2)) + C_2*x; gsolution(-x_,x_, y_,x_,2):= C_1* exp(-x - x^2/2)+C_2* exp(-x-x^2/2)* erfi((x + 2)/sqrt(2)); gsolution(-x_,-x_, y_,x_,2):= C_1* exp(x - x^2/2) +C_2* exp(x-x^2/2)* erfi((x - 2)/sqrt(2)); gsolution(x_,c_,y_,x_,2):= if(hasnot(c,x), C_1*hermite(-c,x/sqrt(2)) ); gsolution(x_,6,y_,x_,2):= C_1*exp(x^2/2)*(x^5+10x^3+15x)+C_2*hermite(-6,x/sqrt(2)); gsolution(x_,5,y_,x_,2):= C_1*exp(x^2/2)*(x^4/3+2x^2+1)+C_2*hermite(-5,x/sqrt(2)); gsolution(x_,4,y_,x_,2):= C_1*exp(x^2/2)*(x^3+3x)+C_2*hermite(-4,x/sqrt(2)); gsolution(x_,3,y_,x_,2):= C_1*exp(x^2/2)*(x^2+1)+C_2*hermite(-3,x/sqrt(2)); #gsolution(x_,2,y_,x_,2):= C_1*exp(x^2/2)*x+C_2*hermite(-2,x/sqrt(2)); #gsolution(x_,1,y_,x_,2):= C_1*exp(x^2/2)+C_2*hermite(-1,x/sqrt(2)); gsolution(x_,-1,y_,x_,2):= C_1*(sqrt(pi)*erfi(x/sqrt(2))*x - sqrt(2)*exp(x^2/2)) + C_2*x; gsolution(x_,-2,y_,x_,2):= C_1*(x^2-1); gsolution(x_,-3,y_,x_,2):= C_1*(x^3-3x); gsolution(x_,2,y_,x_,2) := C_1*exp(x^2/2)*x+C_2*(sqrt(2pi)*exp(x^2/2)*erf(x/sqrt(2))*x+2); gsolution(x_,1,y_,x_,2):= C_1*exp(x^2/2)+C_2*exp(x^2/2)*erf(x/sqrt(2)); gsolution(x_,x_^2,y_,x_,2):= C_1* exp( (1/4-sqrt(5)/4) *x^2)* hermite(-1/2 + sqrt(5)/10,sqrt(sqrt(5))/sqrt(2)*x); gsolution(x_,-x_, y_,x_,2):= C_1*exp(x) *(x-2)+C_2*((-2)*exp(x^2/2-x+2)+sqrt(2pi)*erfi(-sqrt(2)+1/sqrt(2)*x)*exp(x)*(x-2)); gsolution(x_,x_, y_,x_,2) := C_1*exp(-x)*(-2-x)+C_2*(exp((-x))*sqrt(2pi)*erfi(sqrt(2)+1/sqrt(2)*x)*(2+x)+(-2)*exp(2+x+x*x/2)); gsolution0(b_,0,y_,x_,q_):= int(gsolution(b,y,x,q-1),x)+C_2; gsolution0(c_,0,y_,x_,2):= if(isconstant(c),C_1+C_2*exp(c*x), if(hasnot(c,y),C_1+C_2*int(exp(int(c,x)),x), if(hasnot(c,x),int(1/(int(c,y)),y)+C_1-x=0) )); gsolution(b_/c_,0,y_,x_,2):= if(d(c,x)+b==0, C_1+C_2*int(1/c,x)); gsolution(b_*y_,0,y_,x_,p_):=if(isconstant(b), (-1)^(p-1)/b*(2*(p-1))!/(p-1)!*(C_1+x)^(1-p), if(hasnot(b,y),2*(-1)^(p-1)/int(b,x,p-1) )); gsolution(b_*exp(x_)*y_,0,y_,x_,p_):= if(isconstant(b), (-1)^(p-1)*exp(-x)/b ); gsolution(a_*exp(b_*x_)*y_,0,y_,x_,p_):= if(isconstant(a,b), (-b)^(p-1)*exp(-b*x)/a ); gsolution(exp(y_),0,y_,x_,q_) := log((-1)^(q-1)*(q-1)!/(C_1+x)^(q-1)); gsolution(exp(x_)/y_,0,y_,x_,p_):= exp(x); gsolution(exp(x_)*y_,0,y_,x_,p_):= (-1)^(p-1)*exp(-x); gsolution(exp(b_*x_)*y_,0,y_,x_,p_):= if(isconstant(b), (-b)^(p-1)*exp(-b*x) ); gsolution(x_^n_*y_,0,y_,x_,q_):= if(n== -1,-2C_2*x/(C_1+C_2*x), -fallingfactorial(-n-q+1,q)/(n+q-1)/x^(n+q-1) ); gsolution(x_*y_,0,y_,x_,q_):= -fallingfactorial(-q,q)/q/x^q and C_1; gsolution((c_+x_)*y_,0,y_,x_,q_):= if(hasnot(c,x), -fallingfactorial(-q,q)/q/(c+x)^q and C_1 ); gsolution(y_,0,y_,x_,p_):=(-1)^(p-1)*(2*(p-1))!/(p-1)!*(C_1+x)^(1-p); gsolution(b_*y_,0,y_,x_,2):= if(isconstant(b), -2/b*C_1*tanh(C_2+C_1*x) and 2/b*C_1*tan(C_2+C_1*x) ); gsolution(b_*x_*y_^2,0,y_,x_,2):= if(isconstant(b), sqrt(2/b)*i/x ); gsolution(b_*x_^n_*y_,0,y_,x_,2):= if(isconstant(b),if(n== -1,-2/b*C_2*x/(C_1+C_2*x), -(n+2)/b/x^(n+1) )); gsolution(b_*x_*y_,0,y_,x_,2):= if(isconstant(b), -3/b/x^2 ); gsolution(1/x_*y_,0,y_,x_,2):= 2C_1 * tan( C_1 *log(x) + C_2)- 1 and -2x/(C_1+x); gsolution(x_,0,y_,x_,2):= C_1*erfi(sqrt(1/2)*x)+C_2; gsolution(y_,0,y_,x_,2):= -2C_1*tanh(C_2+C_1*x) and 2/C_1*tan(C_2+C_1*x); #gsolution(b_*y_,0,y_,x_,p_):= int(1/b,x,p-1); #gsolution(a_+b_*y_,0,y_,x_,p_):= if(isconstant(a,b), 2C_1/b*tan(C_1*x+C_2)-a/b ); gsolution(a_+b_*y_,0,y_,x_,p_):=if(isconstant(a,b), (-1)^(p-1)/b*(2*(p-1))!/(p-1)!*(C_1+x)^(1-p)-a/b ); gsolution(a_+y_,0,y_,x_,p_):=if(isconstant(a), (-1)^(p-1)*(2*(p-1))!/(p-1)!*(C_1+x)^(1-p)-a ); gsolution(0,c_,y_,x_,n_):=gsolution(c,y,x,n); #gsolution(b_,c_,y_,x_,1):=gsolution(c/(1-b),y,x,1); #4; #gsolution(c_,y_,x_,n_):= if(n<0,0, if(n== -1, C_1*exp(integrate((1-d(c,x))/c,x)), sum(c(k+1)*x^k,k,0,ceil(n)-1,1)), if(c>0, C_1*exp(c^(1/n)*x)+if(iseven(n), C_2*exp(-c^(1/n)*x),0), if(c<0, mittag(n,sum(c(k+1)*x^k,k,0,ceil(n)-1,1)+c*x^n), mittag(n,d(c,x,-n)*(abs(n))!+sum(c(k+1)*x^k,k,0,ceil(n)-1,1)) ))); #gsolution(c_,y_,x_,n_):= if(c==0, if(n== -1, C_1*exp(integrate((1-d(c,x))/c,x)), sum(c(k+1)*x^k,k,0,ceil(abs(n))-1,1) ), if(c>0, sum(c(k)*exp(-(-1)^k*c^(1/n)*x),k,1,ceil(abs(n)),1), if(c<0, mittag(n,sum(c(k+1)*x^k,k,0,ceil(abs(n))-1,1)+c*x^n), mittag(n,d(c,x,-n)*((n))!+sum(c(k+1)*x^k,k,0,ceil(abs(n))-1,1)) ))); gsolution0(c_,y_,x_,n_):= if(hasnot(c,y),if(n== -1, C_1*exp(integrate((1-d(c,x))/c,x)), if(c>0 and isconstant(n), C_1*exp(c^(1/n)*x)+if(iseven(n), C_2*exp(-c^(1/n)*x),0 ), if(hasnot(c,x), C_1*mittag(n,c*x^n), C_1*mittag(n,int(c,x,n)*n!) )))); #gsolution(c_ and isconstant(n),y_,x_,n_):= if(hasnot(c,y),if(n== -1, C_1*exp(integrate((1-d(c,x))/c,x)), if(c>0, C_1*exp(c^(1/n)*x)+if(iseven(n), C_2*exp(-c^(1/n)*x),0 ), if(hasnot(c,x), C_1*mittag(n,c*x^n), C_1*mittag(n,int(c,x,n)*n!) )))); #gsolution(a_,y_,x_,4) := if(a>0, C_1*exp(a^(1/4)*x)+C_2*exp(-a^(1/4)*x)+C_3*cos(a^(1/4)*x)+C_4*sin(a^(1/4)*x), if(hasnot(a,x),C_1 *exp((-1)^(3/4) *a^(1/4) *x) + C_2 *exp(-(-1)^(1/4) *a^(1/4) *x) + C_3 *exp(-(-1)^(3/4) *a^(1/4)* x) + C_4 *exp((-1)^(1/4)* a^(1/4)* x) )); #gsolution(a_,y_,x_,3) := if(hasnot(a,x),C_1*exp(cbrt(a)*x)+C_2*exp(-cbrt(a)*x/2)*cos(sqrt(3)/2*cbrt(a)*x)+C_3*exp(-cbrt(a)*x/2)*sin(sqrt(3)/2*cbrt(a)*x) ); gsolution(b_,y_,x_,4) := if(isconstant(b),C_1* exp((-1)^(3/4)* (-b)^(1/4)* x) + C_2* exp(-(-1)^(1/4)*(-b)^(1/4)* x) + C_3* exp(-(-1)^(3/4)* (-b)^(1/4)* x) + C_4* exp((-1)^(1/4)* (-b)^(1/4) *x) ); gsolution(-1,y_,x_,4) := C_3* exp(-x/sqrt(2))* sin(x/sqrt(2)) + C_4* exp(x/sqrt(2))* sin(x/sqrt(2)) + C_1* exp(x/sqrt(2))* cos(x/sqrt(2)) + C_2 *exp(-x/sqrt(2))* cos(x/sqrt(2)); gsolution(1,y_,x_,4) := C_1*exp(x)+C_2*exp(-x)+C_3*cos(x)+C_4*sin(x); gsolution(b_,y_,x_,3) := if(isconstant(b),C_1 *exp((-1)^(2/3)* cbrt(b)* x) + C_2* exp(-(-1)^(1/3)* cbrt(b)* x) + C_3* exp(cbrt(b)* x) ); gsolution(1,y_,x_,3) := C_1*exp(x)+C_2*exp(-(-1)^(1/3)*x)+C_3*exp((-1)^(2/3)*x); gsolution(c_,y_,x_,2) := if(has(c,y),int(1/sqrt(expand(2int(c*y,y))+C_1),y)+C_2-x=0, if(isfree(c,x), if(c<0,C_1*cos(sqrt(-c)*x)+C_2*sin(sqrt(-c)*x), C_1*exp(-sqrt(c)*x)+C_2*exp(sqrt(c)*x)), C_1*mittag(2,2int(c,x,2)) )); gsolution(a_/(b_+c_),y_,x_,p_):= if(d(b+c,x,p)==a, C_1*x^p+p!*b/a*C_1); gsolution((c_+x_)^n_,y_,x_,q_):=if(hasnot(c,x),block(f:=gsolution(x^n,y,x,q), replace(f,x,c+x)) ); gsolution(a_*(c_+x_)^n_,y_,x_,q_):=if(hasnot(a,c,x),if(n+q==0 and a==q!, C_1*(c+x)^q, block(f:=gsolution(a*x^n,y,x,q), replace(f,x,c+x)) )); gsolution(a_*x_^pp_,y_,x_,p_):= if(p==-pp,if(a==p!, C_1*x^p )); #gsolution(log(x_),y_,x_,2):= C_1*E(2,2ln(-2,x))+C_2*E(2,2ln(-2,-x)); gsolution(b_*x_^n_,y_,x_,2):=if(b<0, C_1*sqrt(x)*besselJ(-1/(n + 2),(2sqrt(-b)*x^(n/2 + 1))/(n + 2)) + C_2*sqrt(x)*besselJ(1/(n + 2),(2sqrt(-b)*x^(n/2 + 1))/(n + 2)), C_1*sqrt(x)*besselI(-1/(n + 2),(2sqrt(b)*x^(n/2 + 1))/(n + 2)) + C_2*sqrt(x)*besselI(1/(n + 2),(2sqrt(b)*x^(n/2 + 1))/(n + 2)) ); gsolution(c_*x_^(-2),y_,x_,2):= if(isfree(c,x), if(1+4c==0, C_1*x^(1/2)+C_2*x^(1/2)*log(x), if(1+4c<0, C_1*x^(1/2)*cos(log(x)*sqrt(-1-4c)/2)+C_2*x^(1/2)*sin(log(x)*sqrt(-1-4c)/2), C_1*x^(1/2-sqrt(1+4c)/2)+C_2*x^(1/2+sqrt(1+4c)/2) ))); #gsolution(c_*x_^(-2),y_,x_,2):= if(isfree(c,x), if(1+4c==0, C_1*x^(1/2)+C_2*x^(1/2)*log(x), C_1*x^((1-sqrt(1+4c))/2)+C_2*x^((1+sqrt(1+4c))/2) )); gsolution(c_*x_, y_,x_,2):= if(isfree(c,x), C_1*Ai(cbrt(c)*x)+C_2*Bi(cbrt(c)*x), C_1*mittag(2,2int(c*x,x,2)) ); gsolution(x_^n_,y_,x_,2):=C_1* sqrt(x)*besselI(-1/(n + 2),(2 x^(n/2 + 1))/(n + 2)) + C_2* sqrt(x) *besselI(1/(n + 2),(2 x^(n/2 + 1))/(n + 2)); gsolution(x_^(-4),y_,x_,2):= C_1*exp(1/x)*x+C_2*exp(-1/x)*x; gsolution(x_^(-3),y_,x_,2):= C_1*besselI(1,2sqrt(1/x))/sqrt(1/x)+C_2*besselK(1,2sqrt(1/x))/sqrt(1/x); gsolution(x_^(-2),y_,x_,2):= C_1*x^(1/2-sqrt(5)/2)+C_2*x^(1/2+sqrt(5)/2) ; gsolution(1/x_,y_,x_,2):= C_1*besselI(1,2sqrt(x))*sqrt(x)+C_2*besselK(1,2sqrt(x))*sqrt(x); gsolution(x_,y_,x_,2):= C_1*Ai(x)+C_2*Bi(x); gsolution(b_+a_*x_^2,y_,x_,2):= if(a==b*b, C_2*erf(sqrt(b)*x)*exp(b*x^2/2)+C_1*exp(b*x^2/2), C_1*mittag(2,2int(b+a*x,x,2)) ); gsolution(-1+x_^2,y_,x_,2):= C_1*erfi(x)*exp(-x^2/2)+C_2*exp(-x^2/2); gsolution(1+x_^2,y_,x_,2):= C_1*erf(x)*exp(x^2/2)+C_2*exp(x^2/2); gsolution(c_+x_,y_,x_,2):= if(hasnot(c,x),C_1*Ai(x+c)+C_2*Bi(x+c), C_1*mittag(2,2int(c+x,x,2)) ); gsolution(a_+c_*x_, y_,x_,2):= if(isfree(a,c,x), C_1*Ai(cbrt(c)*(x+a/c))+C_2*Bi(cbrt(c)*(x+a/c)), C_1*mittag(2,2int(a+c*x,x,2)) ); gsolution(c_,y_,x_,1) := if(hasnot(c,y),C_1*exp(int(c,x)) ); gsolution(0,y_,x_,n_):=if(n>3,c_1+c_2*x+c_3*x^2+c_4*x^3, if(n>2,c_1+c_2*x+c_3*x^2, if(n>1,c_1+c_2*x, if(n>0,c_1,0 ))));