# differential equation solver; # solve differential equation and fractional differential equation for unknown y with independent variable x; # dsolve(eq,y) # there are 3 way to input derivative y: y', y(1,x), or ds(y,x,1) # there are 3 way to input second order derivative y: y'', y(2,x), or ds(y,x,2) # e.g. dsolve( y' = x*y, y) # dsolve( y(0.5,x)=y^2 ) # dsolve(a_,y_,x_,q_) = If(isfree(a,y),d(a,x,-q), If(isfree(a/y,y),mittag(q,d(a/y,x,-q)), If(isfree(a,x), solve(d(1/a, y,-q)=x^q/q!,y) ))); # dsolve(a_+b_, y_,x_,q_) := If(isfree(a,b,y), d(a+b,x,-q)+C_1+if(q>1, C_2*x,0), If(isfree(a,b,x), solve(d(1/(a+b),y,-q)=x^q/q!,y)+if(q>1, C_2*x^2+C_1*x,C_1+x), If(isfree(a,y) and isfree(d(b,y),y), block(dsolve:=d(d(b,y),x,-q),simplify(mittag(q,dsolve)*d(a*mittag(q,-dsolve),x,-q))+mittag(q,dsolve)), If(isfree(b,y) and isfree(d(a,y),y), block(dsolve:=d(d(a,y),x,-q),simplify(mittag(q,dsolve)*d(b*mittag(q,-dsolve),x,-q))+mittag(q,dsolve)) )))); dsolve(a_ and b_, y_,x_,p_) := dsolve(a, y,x,p) and dsolve(b, y,x,p); dsolve(a_ and b_ and c_ and d_, y_,x_,p_) := dsolve(a, y,x,p) and dsolve(b, y,x,p) and dsolve(c, y,x,p) and dsolve(d, y,x,p); dsolve(a_+y_, y_,x_,q_) := gsolution(1,y,x,q)+If(isfree(a,x),-a,psolution(1,a,y,x,q)); dsolve(a_+b_*y_, y_,x_,q_) := gsolution(b,y,x,q)+psolution(b,a,y,x,q); dsolve(a_*y_+y_, y_,x_,q_) := If(isfree(a,y), C_1*mittag(q,d(a+1,x,-q)*q!) ); dsolve(b_*y_^n_, y_,x_,q_) := If(isfree(b,y),If(isfree(b,x), block(p:=(1/b*fallingfactorial(q/(1-n),q))^(1/(n-1)),if(iseven(q),p*(C_1-x)^(q/(1-n)) and p*(C_1+x)^(q/(1-n)), p*(C_1+x)^(q/(1-n)))), block(p:=int(simplify(1/b),x,q),pp:=simplify(b^2*p^n),if(pp==1,p,if(pp==-1,-p ))) )); dsolve(b_/y_, y_,x_,p_) := block(dd:=d(b,x,p),if(dd<>0 and hasnot(dd,x), -b/sqrt(dd) and b/sqrt(dd) ) ); #dsolve(b_*y_^n_, y_,x_,2) := If(isfree(b,y),If(isfree(b,x),((2n+2)/b)^(1/(n-1))/((n-1)*(C_1-x))^(2/(n-1)) and ((2n+2)/b)^(1/(n-1))/((n-1)*(C_1+x))^(2/(n-1)), (n/fallingfactorial(-n,2)*int(b,x,2))^(1/(2-n)) )); dsolve(b_*(c_+x_)^m_*y_^n_, y_,x_,q_) := If(isfree(b,c,y),If(isfree(b,c,x), (fallingfactorial((m+q)/(1-n),q)/b)^(1/(n-1))*(c+x)^((m+q)/(1-n)) )); dsolve(b_*(c_+a_*x_)^m_*y_^n_, y_,x_,q_) := If(isfree(a,b,c,y),If(isfree(b,c,x), (fallingfactorial((m+q)/(1-n),q)/a/b)^(1/(n-1))*(c/a+x)^((m+q)/(1-n)) )); dsolve(b_*x_^m_*y_^n_, y_,x_,q_) := If(isfree(b,y),If(isfree(b,x), block(k:=(1/b*fallingfactorial((m+q)/(1-n),q))^(1/(n-1))*(x)^((m+q)/(1-n)), if(isodd(n),-k and k,k)) )); dsolve(b_*x_*y_^n_, y_,x_,q_) := If(isfree(b,y),If(isfree(b,x), block(k:=(1/b*fallingfactorial((1+q)/(1-n),q))^(1/(n-1))*(x)^((1+q)/(1-n)), if(isodd(n),-k and k,k)) )); dsolve((b_+x_)^m_*y_^n_, y_,x_,q_) := If(isfree(b,x), block(p:=(fallingfactorial((m+q)/(1-n),q))^(1/(n-1)),g:=(b+x)^((m+q)/(1-n)),if(isodd(n),-p*g and p*g, p*g ))); dsolve((b_+c_*x_)^m_*y_^n_, y_,x_,q_) := If(isfree(b,c,x), (1/c^m*fallingfactorial((m+q)/(1-n),q))^(1/(n-1))*((b+c*x)/c)^((m+q)/(1-n)) ); dsolve(x_^m_*y_^n_, y_,x_,q_) := block(p:=(fallingfactorial((m+q)/(1-n),q))^(1/(n-1)),g:=x^((m+q)/(1-n)),if(isodd(n),-p*g and p*g, p*g )); dsolve(x_*y_^n_, y_,x_,q_) := block(p:=(fallingfactorial((1+q)/(1-n),q))^(1/(n-1)),g:=x^((1+q)/(1-n)),if(isodd(n),-p*g and p*g, p*g )); dsolve((b_+x_)*y_^n_, y_,x_,q_) := If(isfree(b,x), block(p:=(fallingfactorial((1+q)/(1-n),q))^(1/(n-1)),g:=(b+x)^((1+q)/(1-n)),if(isodd(n),-p*g and p*g, p*g ))); dsolve((b_+c_*x_)*y_^n_, y_,x_,q_) := If(isfree(b,c,x), block(p:=(1/c*fallingfactorial((1+q)/(1-n),q))^(1/(n-1)),g:=(b/c+x)^((1+q)/(1-n)),if(isodd(n),-p*g and p*g, p*g ))); dsolve(y_^n_, y_,x_,q_) := block(p:=fallingfactorial(q/(1-n),q)^(1/(n-1)),g:=(C_1+x)^(q/(1-n)),if(iseven(q),p*(C_1-x)^(q/(1-n)) and p*g, if(isodd(n),-p*g and p*g, p*g ))); #dsolve(y_^2, y_,x_,p_) := (2p)!/p!/2*(-1/(C_1+x))^p; dsolve(b_*y_, y_,x_,n_) := gsolution(b,y,x,n); dsolve(exp(xx_)*y_^n_, y_,x_,q_) := if(hasnot(xx,y) and d(xx,x,2)==0, (d(xx,x)/(1-n))^(q/(n-1))*exp(xx/(1-n)) ); dsolve(exp(y_), y_,x_,n_) := log((-1)^n*n!/(C_1+x)^n); dsolve(y_, y_,x_,n_) := gsolution(1,y,x,n); dsolve(1/y_, y_,x_,2) := exp(-inverseerf(i* sqrt(2)/sqrt(pi)*(C_1 + x))^2) and exp(-inverseerf(-i* sqrt(2)/sqrt(pi)*(C_1 + x))^2); dsolve(x_*y_, y_,x_,2) := C_1*Ai(x)+C_2*Bi(x); dsolve(a_+b_*y_, y_,x_,2) := if(isfree(a,b,y), if(a==b, gsolution(b,y,x,2)-1, gsolution(b,y,x,2)+psolution(b,a,y,x,2) )); dsolve(a_+y_, y_,x_,2) := if(isfree(a,y),if(isfree(a,x), C_1*exp(x)+C_2*exp(-x)-a, C_1*exp(x)+C_2*exp(-x)+psolution(1,a,y,x,2) )); dsolve(x_+y_, y_,x_,2) := C_1*exp(x)+C_2*exp(-x)-x; dsolve(x_+b_*y_, y_,x_,2) := if(isfree(b,x), gsolution(b,y,x,2)-x/b, gsolution(b,y,x,2)+psolution(b,x,y,x,2) ); dsolve(a_+b_*y_,y_,x_,1):=If(isfree(a,b,y), If(isfree(a,b,x), C_1*exp(b*x)-a/b, C_1*exp(integrate(b,x))+psolution(b,a,y,x,1) )); #dsolve(a_+x_/y_,y_,x_,1):=replace(int(1/replace(a,x/y,zz),zz),zz,x/y)=log(x)+C_1; #dsolve(a_+y_/x_,y_,x_,1):=replace(int(1/replace(a,y/x,zz),zz),zz,y/x)=log(x)+C_1; dsolve(x_+y_/x_,y_,x_,1):= C_1*x+x*x; dsolve(x_+x_/y_,y_,x_,1):= -W(C_1*exp(-x*x/2))-1; dsolve(a_+a_*y_,y_,x_,1):=If(isfree(a,y), C_1*exp(integrate(a,x))-1); dsolve(y(p_,x_)^n_+c_,y_,x_,q_):= if(hasnot(c,y),int(dsolve(y^n+c,y,x,q-p),x,p)+gsolution(0,y,x,p) ); dsolve(b_*y(p_,x_)^n_+c_,y_,x_,q_):= if(isfree(b,c,y),if(isfree(b,x),int(dsolve(b*y^n+c,y,x,q-p),x,p)+gsolution(0,y,x,p) )); dsolve(y(p_,x_)+c_,y_,x_,q_):= if(hasnot(c,y), int(dsolve(y+c,y,x,q-p),x,p)+gsolution(0,y,x,p)); dsolve(b_*y(p_,x_)+c_,y_,x_,q_):= if(isconstant(b) and hasnot(c,y), int(dsolve(b*y+c,y,x,q-p),x,p)+gsolution(0,y,x,p) ); dsolve(a_*x_+b_*x_*y(p_,x_), y_,x_,q_) := If(isfree(a,b,x) and isfree(a,b,y), C_1*int(mittag(q-p,b*x^(1+q-p)/(1+q-p)!)-a/b,x,p)); dsolve(y(p_,x_)+xy_, xy_,x_,q_) := gsolution(1,p,1,xy,x,q); dsolve(y(p_,x_)+c_*xy_, xy_,x_,q_) := gsolution(1,p,c,xy,x,q); dsolve(b_*y(p_,x_)+xy_, xy_,x_,q_) := if(hasnot(b,y),gsolution(b,p,1,xy,x,q)); dsolve(b_*y(p_,x_)+c_*xy_, xy_,x_,q_) := if(hasnot(b,y),gsolution(b,p,c,xy,x,q)); dsolve(b_*y(n_,x_)+c_*y(m_,x_),y_,x_,p_):= if(hasnot(b,c,y),gsolution(b,n,c,m,0,y,x,p) ); dsolve(y(p_,x_)+xy_+d_, xy_,x_,q_) := if(isfree(d,xy),if(isfree(d,x), gsolution(1,p,1,xy,x,q)-d, gsolution(1,p,1,xy,x,q)+psolution(1,p,1,d,xy,x,q) )); dsolve(y(p_,x_)+c_*xy_+d_, xy_,x_,q_) := if(isfree(c,d,xy),if(isfree(c,d,x), gsolution(1,p,c,xy,x,q)-d/c, gsolution(1,p,c,xy,x,q)+psolution(1,p,c,d,xy,x,q) )); dsolve(b_*y(p_,x_)+xy_+d_, xy_,x_,q_) := if(isfree(b,d,xy),if(isfree(b,d,x), gsolution(b,p,1,xy,x,q)-d, gsolution(b,p,1,xy,x,q)+psolution(b,p,1,d,xy,x,q) )); dsolve(b_*y(p_,x_)+c_*xy_+d_, xy_,x_,q_) := if(isfree(b,c,d,xy),if(isfree(b,c,d,x), gsolution(b,p,c,xy,x,q)-d/c, gsolution(b,p,c,xy,x,q)+psolution(b,p,c,d,xy,x,q) )); dsolve(f_+b_*y(n_,x_)+c_*y(m_,x_),y_,x_,p_):=if(hasnot(f,x) and hasnot(b,c,f,y), gsolution(b,n,c,m,0,y,x,p)-if(hasnot(c,x),f/c*x^m/m!,0) ); dsolve(y(p_,x_)^n_,y_,x_,q_):= if(n== -1, C_2+1/sqrt(fallingfactorial((p+q)/2,p)*fallingfactorial((p+q)/2,q))*(C_1+x)^((p+q)/2), int(dsolve(y^n,y,x,q-p),x,p)+gsolution(0,y,x,p)); dsolve(b_*y(p_,x_)^n_,y_,x_,q_):= if(isfree(b,y),if(isfree(b,x), if(n== -1, C_2+sqrt(b)/sqrt(fallingfactorial((p+q)/2,p)*fallingfactorial((p+q)/2,q))*(C_1+x)^((p+q)/2), int(dsolve(b*y^n,y,x,q-p),x,p)+gsolution(0,y,x,p))), if(hasnot(b,x) and n<>2, int(((2-n)*int(b,y,q-p)+C_2)^(1/(n-q)),y,p)=(C_1+x) )); dsolve(b_*y(1,x_)^2,y_,x_,2):=if(hasnot(b,y),if(hasnot(b,x),C_1 and C_2 - log(C_1 + b*x)/b, C_1 and -int(1/int(b,x),x)+C_1) ); dsolve(b_/y(p_,x_),y_,x_,q_) := if(has(b,y) and hasnot(b,x), int(1/cbrt(C_2+int(b,y,p)),y)=cbrt(3)*x+c_1, if(hasnot(b,y), if(q-p==1, C_1-int(sqrt(2int(b,x)),x,p) and C_1+int(sqrt(2int(b,x)),x,p), block(g:=int(dsolve(b/y,y,x,q-p),x,p), gsolution(0,y,x,p)+g) ))); #dsolve(b_/y(1,x_),y_,x_,2) := if(has(b,y) and hasnot(b,x), int(1/cbrt(int(b,y)),y)=cbrt(3)*x+c_1, if(has(b,x) and hasnot(b,y), C_1-int(sqrt(2int(b,x)),x) and C_1+int(sqrt(2int(b,x)),x) )); dsolve(b_*y(p_,x_),y_,x_,q_):= gsolution(b,p,0,y,x,q); dsolve(b_*xy_*y(1,x_)^2,y_,x_,2):= if(isconstant(b), (2/b)^0.5* inverseerf(c_1 *x + c_2 ) ); dsolve(xy_*y(1,x_)^2,y_,x_,2):= (2)^0.5* inverseerf( c_1 *x + c_2 ); dsolve(exp(x_)*y(p_,x_)^n_,y_,x_,q_) := (-1)^(q-n*p)*exp(-x)+gsolution(0,y,x,p); dsolve(1/xy_*y(p_,x_)^2,xy_,x_,q_) := C_1*exp(C_2*x); dsolve(xy_^m_/y(p_,x_),xy_,x_,q_) := if(m==2,C_1*exp(x), (fallingfactorial((p+q)/(2-m),p)*fallingfactorial((p+q)/(2-m),q))^(1/(m-2))*(C_1+x)^((p+q)/(2-m)) ); dsolve(xy_/y(p_,x_),xy_,x_,q_) := 1/(fallingfactorial(p+q,p)*fallingfactorial(p+q,q))*(C_1+x)^(p+q); dsolve(exp(y_)/y(p_,x_),y_,x_,q_) :=log(d(-(p+q)*log(C_1+x),x,q)*d(-(p+q)*log(C_1+x),x,p) ); dsolve(exp(x_)/y(p_,x_),y_,x_,q_) := sqrt(2^(p+q))*exp(x/2)+gsolution(0,y,x,p); dsolve(y(n_,x_)*y(p_,x_),xy_,x_,q_) := int(dsolve(xy*y(p-n,x),xy,x,q-n),x,n)+gsolution(0,xy,x,n); #dsolve(y(p_,x_)^n_,y_,x_,q_):= if(n>0,gsolution(0,y,x,min(p,q)) and gsolution(0,y,x,min(p,q))+int(dsolve(y^(n^(sgn(q-p))),y,x,abs(q-p)),x,min(p,q)), gsolution(0,y,x,min(p,q))+int(dsolve(y^(n^(sgn(q-p))),y,x,abs(q-p)),x,min(p,q)) ); #dsolve(y(p_,x_)^n_,y_,x_,p_):= if(n>0,gsolution(0,y,x,p)+(C_2+x)^p/p!, gsolution(0,y,x,p)+(C_2+x)^p/p!); #dsolve(xy_^n_*y(1,x_)^m_,xy_,x_,2):= C_1 and x^((m-2)/(m+n-1)) ; #dsolve(a_*y(p_,x_)^(-1),y_,x_,q_) := if(hasnot(a,y),-int(sqrt(C_1+2int(a,x,q-p)),x,p)+gsolution(0,y,x,p) and int(sqrt(C_1+2int(a,x,q-p)),x,p)+gsolution(0,y,x,p)); dsolve(b_*xy_/y(p_,x_),xy_,x_,q_) := if(isconstant(b), b/(fallingfactorial(p+q,p)*fallingfactorial(p+q,q))*(C_1+x)^(p+q) ); dsolve(b_/xy_*y(1,x_)^2,xy_,x_,2) := if(isconstant(b), (c_2 + c_1 *x)^(1/(1 - b)) ); dsolve(a_*y(n_,x_)*y(p_,x_),xy_,x_,q_) := if(hasnot(a,xy), int(dsolve(a*xy*y(p-n,x),xy,x,q-n),x,n)+gsolution(0,xy,x,n) ); dsolve(x_^n_*xy_^m_/y(p_,x_),xy_,x_,q_) := (fallingfactorial((n+p+q)/(2-m),p)*fallingfactorial((n+p+q)/(2-m),q))^(1/(m-2))*x^((n+p+q)/(2-m)); dsolve(x_^n_*xy_/y(p_,x_),xy_,x_,q_) := 1/(fallingfactorial(n+p+q,p)*fallingfactorial(n+p+q,q))*x^(n+p+q); dsolve(x_*xy_^m_/y(p_,x_),xy_,x_,q_) := (fallingfactorial((1+p+q)/(2-m),p)*fallingfactorial((1+p+q)/(2-m),q))^(1/(m-2))*x^((1+p+q)/(2-m)); dsolve(x_*xy_/y(p_,x_),xy_,x_,q_) := 1/(fallingfactorial(1+p+q,p)*fallingfactorial(1+p+q,q))*x^(1+p+q); dsolve(1/xy_*y(n_,x_)*y(p_,x_),xy_,x_,q_) := C_1*exp(C_2*x); dsolve(exp(x_)*xy_/y(p_,x_),xy_,x_,q_) := exp(x); dsolve(exp(x_)/y(p_,x_)*y(n_,x_),xy_,x_,q_) := exp(x)+gsolution(0,y,x,min(p,n)); dsolve(exp(x_)/y(m_,x_)*y(n_,x_),xy_,x_,q_) := exp(x)+gsolution(0,y,x,min(m,n)); dsolve(exp(x_)/y(m_,x_)/y(n_,x_),xy_,x_,q_) := cbrt(C_2+3^(m+n+q)*exp(x))+gsolution(0,y,x,min(m,n)); dsolve(exp(x_)*y(n_,x_)*y(p_,x_),xy_,x_,q_) := (-1)^(q-p-n)*exp(-x)+gsolution(0,y,x,n); #dsolve(a_*b_*c_*y(p_,x_)^(-1),y_,x_,q_) := if(isconstant(a), a*dsolve(b*c/y(p,x),y,x,q) ); dsolve(a_*exp(x_)*y(n_,x_)*y(p_,x_),y_,x_,q_) := if(isconstant(a), (-1)^(q-p-n)/a*exp(-x)+gsolution(0,y,x,n) ); dsolve(a_*exp(x_)*xy_/y(p_,x_),xy_,x_,q_) := if(isconstant(a), a*exp(x)); dsolve(y(p_,x_),y_,x_,q_):= C_1*exp(x)+gsolution(0,y,x,p); dsolve(y(1,x_),y_,x_,3):= C_1+C_2*exp(x)+C_3*exp(-x); dsolve(y(2,x_),y_,x_,3):= C_1+C_2*exp(x)+C_3*x; #dsolve(y(1,x_)^n_,y_,x_,2) := C_2 - ((1-n)* (C_1 + x))^(1/(1 - n) + 1)/(n - 2); #dsolve(y(1,x_)^2,y_,x_,2):= C_2 - log(C_1 + x) and C_2 - log(C_1 - x); dsolve(y(1,x_)^p_,y_,x_,p_):= C_2 -(p-1)!^(1/(p-1))* log(C_1 + x) and C_2 -(p-1)!^(1/(p-1))* log(C_1 - x); dsolve(1/y(p_,x_),y_,x_,q_) := C_2+1/sqrt(fallingfactorial((p+q)/2,p)*fallingfactorial((p+q)/2,q))*(C_1+x)^((p+q)/2); dsolve((x_+n_)/x_*y(1,x_),y_,x_,2):= if(isconstant(n), C_1*Gamma(1+n,-x)+C_2); dsolve(-(x_+n_)/x_*y(1,x_),y_,x_,2):= if(isconstant(n), C_1*Gamma(1-n,x)+C_2); #dsolve(c_+y(1,x_),y_,x_,2):=if(isfree(c,y),if(isfree(c,x), C_1+C_2*e^x-c*x, C_1+C_2*exp(x)-integrate(exp(x)*int(exp(-x)*c,x),x) )); #dsolve(c_+b_*y(1,x_),y_,x_,2):=if(isfree(b,c,y),if(isfree(b,c,x), C_1+C_2*exp(b*x)-c*x/b, integrate(dsolve(c+b*y,y,x),x)+C_2 )); #dsolve(c_+b_*y(1,x_),y_,x_,2):=if(isfree(b,c,y),if(isfree(b,c,x), C_1+C_2*exp(b*x)-c*x/b, C_1+C_2*exp(b*x)-integrate(exp(b*x)*int(exp(-b*x)*c,x),x) )); #dsolve(c_+b_*y(1,x_),y_,x_,2):=if(isfree(b,c,y),if(isfree(b,c,x), C_1+C_2*exp(b*x)-c*x/b, C_1+C_2*int(exp(int(b,x)),x)+psolution(b,1,0,c,y,x,2) )); #dsolve(b_/x_*y(1,x_)+y(1,x_),y_,x_,2):= if(isconstant(b), C_1*Gamma(1+b,-x)+C_2); #dsolve(a_*y(1,x_)+b_/x_*y(1,x_),y_,x_,2):= if(isconstant(a,b), C_1*(-a)^(-1-b)*Gamma(1+b,-a*x)+C_2); #dsolve(xy_*y(1,x_)+x_, xy_,x_,p_):= (-1)^(p+1)*(2*(p-1))!/(p-1)!/(C_1+x)^(p-1)-i*x and (-1)^(p+1)*(2*(p-1))!/(p-1)!/(C_1+x)^(p-1)+i*x; #dsolve(xy_*y(1,x_)+c_*x_, xy_,x_,p_):= if(c<0,-sqrt(-c)*x and sqrt(-c)*x, 2C_1*tan(C_1*x+C_2)-sqrt(-c)*x and -2C_2/(C_1+C_2*x) +sqrt(-c)*x ); #dsolve(xy_*y(1,x_)+c_*x_, xy_,x_,p_):= if(c<0,-sqrt(-c)*x and sqrt(-c)*x-2/x, -2C_2/(C_1+C_2*x)-sqrt(-c)*x and -2C_2/(C_1+C_2*x) +sqrt(-c)*x ); #dsolve(b_*xy_*y(1,x_)+x_, xy_,x_,p_):= if(b<0,-sqrt(-1/b)*x and sqrt(-1/b)*x-2/b/x, -2/b*C_2/(C_1+C_2*x)-sqrt(-1/b)*x and -2/b*C_2/(C_1+C_2*x) +sqrt(-1/b)*x ); #dsolve(b_*xy_*y(1,x_)+c_*x_, xy_,x_,p_):= if(isconstant(b,c),if(sgn(b)==sgn(c), (-1)^(p-1)*(2*(p-1))!/(p-1)!*(C_2/(C_1+C_2*x))^(p-1)/(b)-sqrt(-c/b)*x and (-1)^(p-1)*(2*(p-1))!/(p-1)!*(C_2/(C_1+C_2*x))^(p-1)/(b)+sqrt(-c/b)*x, -sqrt(-c/b)*x and sqrt(-c/b)*x-(-1)^p*(2*(p-1))!/(p-1)!/b/x^(p-1) )); dsolve(b_*y(1,x_)+c_,y_,x_,q_):=if(isfree(b,c,y),if(isfree(b,c,x), C_1+C_2*exp(b*x)-c*x/b, gsolution(b,1,0,y,x,q)+psolution(b,1,0,c,y,x,q)), if(hasnot(b,x) and hasnot(c,y), dsolve(int(b,y)+int(c,x),y,x,q-1) )); dsolve(y(1,x_)+c_,y_,x_,q_):=if(isfree(c,y),if(isfree(c,x), C_1+C_2*exp(x)-c*x, C_1+C_2*exp(x)+psolution(1,1,0,c,y,x,q) )); dsolve(a_*y(n_,x_)*y(p_,x_)+c_,y_,x_,q_) := if(hasnot(a,c,y), block(g:=int(dsolve(a*y*y(p-n,x)+c,y,x,q-n),x,n),if(hasnot(g,y), gsolution(0,y,x,n)+g) )); dsolve(y(n_,x_)*y(p_,x_)+c_,y_,x_,q_) := if(hasnot(c,y), block(g:=int(dsolve(y*y(p-n,x)+c,y,x,q-n),x,n),if(hasnot(g,y), gsolution(0,y,x,n)+g) )); dsolve(1/x_*y(p_,x_)+c_,y_,x_,q_):= if(hasnot(c,y) and q-p==1, int(int(c/x,x)*x,x,p)+C_1*x^q+C_2 ); dsolve(b_*xy_*y(1,x_)+c_, xy_,x_,2):= if(hasnot(c,y), dsolve(b/2*y^2+int(c,x)+C_2,y,x,1) ); #dsolve(xy_*y(1,x_)+c_, xy_,x_,2):= if(hasnot(c,y), dsolve(1/2y^2+int(c,x)+C_2,y,x,1) ); dsolve(xy_*y(1,x_)+c_, xy_,x_,2):= if(hasnot(c,y), block(u:=gsolution(-int(c,x)/2+C_2,y,x,2), -2d(u,x)/u) ); dsolve(b_*xy_*y(1,x_)+c_*x_, xy_,x_,2):= if(isconstant(b,c), sqrt(-c/b)*x and sqrt(-c/b)*x-2/b/x ); dsolve(b_*xy_*y(1,x_)+x_, xy_,x_,p_):= if(isconstant(b), if(p==2,sqrt(-1/b)*x and sqrt(-1/b)*x-2/b/x, sqrt(-1/b)*x) ); dsolve(xy_*y(1,x_)+c_*x_, xy_,x_,p_):= if(isconstant(c), if(p==2,sqrt(-c)*x and sqrt(-c)*x-2/x, sqrt(-c)*x )); dsolve(b_*xy_*y(1,x_)+c_*x_, xy_,x_,p_):= if(isconstant(b,c), if(p==2,sqrt(-c/b)*x and sqrt(-c/b)*x-2/x, sqrt(-c/b)*x )); dsolve(xy_*y(1,x_)+x_, xy_,x_,p_):= if(p==2,i*x and i*x-2/x, i*x ); dsolve(bb_*y(p_,x_)+y(p_,x_)+d_*xy_, xy_,x_,q_) := gsolution(1+bb,p,d,xy,x,q); dsolve(a_*y(p_,x_)+b_*y(p_,x_)+d_*xy_, xy_,x_,q_) := gsolution(a+b,p,d,xy,x,q); dsolve(a_*y(p_,x_)+b_*xy_+c_*xy_,xy_,x_,q_):= gsolution(a,p,b+c,xy,x,q); dsolve(y(p_,x_)+b_*xy_+c_*xy_,xy_,x_,q_):= gsolution(1,p,b+c,xy,x,q); dsolve(b_*y(1,x_)+xy_,xy_,x_,2):= if(hasnot(b,y),gsolution(b,1,1,xy,x,2) ); dsolve(b_*y(1,x_)+c_*xy_,xy_,x_,2):= if(hasnot(b,y),gsolution(b,1,c,xy,x,2) ); dsolve(y(1,x_)+xy_,xy_,x_,2):= C_1*exp((1-sqrt(5))/2*x)+C_2*exp((1+sqrt(5))/2*x); dsolve(y(1,x_)+c_*xy_,xy_,x_,2):= gsolution(1,1,c,xy,x,2) ; dsolve(y(1,x_)+xy_+d_,xy_,x_,2):= gsolution(1,1,1,xy,x,2)+psolution(1,1,1,d,xy,x,2); dsolve(y(1,x_)+c_*xy_+d_,xy_,x_,2):= gsolution(1,1,c,xy,x,2)+psolution(1,1,c,d,xy,x,2); dsolve(b_*y(1,x_)+xy_+d_,xy_,x_,2):= if(hasnot(d,xy), gsolution(b,1,1,xy,x,2) +psolution(b,1,1,d,xy,x,2)); dsolve(b_*y(1,x_)+c_*xy_+d_,xy_,x_,2):= if(hasnot(d,xy), gsolution(b,1,c,xy,x,2)+psolution(b,1,c,d,xy,x,2)); #dsolve(b_*x_+y_^2, y_,x_,1) := if(isconstant(b), cbrt(b)* AiPrime(cbrt(-b) *x)/Ai(cbrt(-b) *x) and cbrt(b) *BiPrime(cbrt(-b) *x)/Bi(cbrt(-b) *x) ); dsolve(a_+y_^2, y_,x_,1) := if(hasnot(a,y),block(u:=gsolution(-a,y,x,2), -d(u,x)/u) ); dsolve(a_+c_*y_^2, y_,x_,1) := if(hasnot(a,y),block(u:=gsolution(d(c,x)/c,-a*c,y,x,2), -d(u,x)/u/c) ); dsolve(c_+x_*y_^2, y_,x_,1) := if(isconstant(c), -Ai(-cbrt(c)*x)/AiPrime(-cbrt(c)*x)*abs(c)^(2/3) and -Bi(-cbrt(c)*x)/BiPrime(-cbrt(c)*x)*abs(c)^(2/3) ); dsolve(c_+b_*x_*y_^2, y_,x_,1) := if(isconstant(b,c), -Ai(-cbrt(b*c)*x)/AiPrime(-cbrt(b*c)*x)*abs(b*c)^(2/3)/b and -Bi(-cbrt(b*c)*x)/BiPrime(-cbrt(b*c)*x)*abs(b*c)^(2/3)/b ); dsolve(c_*x_^n_+b_*y_^2, y_,x_,1) := if(isconstant(b,c),-sqrt(b*c)*besselJ((-n-1)/(n+2),2/(n+2)*sqrt(b*c)*x^(n/2+1))/besselJ(1/(n+2),2/(n+2)*sqrt(b*c)*x^(n/2+1))*x^(n/2) ); dsolve(y_+b_*y_^n_,y_,x_,1):=If(isfree(b,y), block(p:=(C_1+(1-n)*integrate(b*exp((n-1)*x),x)),exp(x)*p^(1/(1-n)) )); dsolve(a_*y_+y_^n_,y_,x_,1):=If(isfree(a,y), block(dsolve:=integrate(a,x),p:=(C_1+(1-n)*integrate(exp((n-1)*dsolve),x)),exp(dsolve)*p^(1/(1-n)) )); dsolve(a_*y_+b_*y_^n_,y_,x_,1):=If(isfree(a,b,y), block(dsolve:=integrate(a,x),p:=(C_1+(1-n)*integrate(b*exp((n-1)*dsolve),x)),exp(dsolve)*p^(1/(1-n)) )); dsolve(y_+y_^n_,y_,x_,1):= exp(x)*(C_1-exp((n-1)*x))^(1/(1-n)); #dsolve(a_*y_+y_^n_,y_,x_,1):=If(isfree(a,y), exp(integrate(a,x))*(C_1+(1-n)*integrate(exp((n-1)*integrate(a,x)),x))^(1/(1-n)) ); dsolve(exp(x_)+exp(y_),y_,x_,1):= exp(x) - log(C_1 - Ei(exp(x))); dsolve(exp(x_)+y_^2,y_,x_,1):= (C_1* sqrt(exp(x))*besselJ(1,2 sqrt(exp(x))) + 2 sqrt(exp(x))* besselY(1,2 sqrt(exp(x))))/(C_1*besselJ(0,2 sqrt(exp(x))) + 2besselY(0,2 sqrt(exp(x)))); dsolve(x_^n_+y_^2, y_,x_,1) := -besselJ((-n-1)/(n+2),2/(n+2)*x^(n/2+1))/besselJ(1/(n+2),2/(n+2)*x^(n/2+1))*x^(n/2) and besselJ((n+1)/(n+2),2/(n+2)*x^(n/2+1))/besselJ(-1/(n+2),2/(n+2)*x^(n/2+1))*x^(n/2); #dsolve(x_^2+y_^2, y_,x_,p_) := (2p)!/p!/2/(C_1-x)^p-i*x and (2p)!/p!/2/(C_1-x)^p+i*x; #dsolve(x_+y_^2, y_,x_,1) := -besselJ(-2/3,2/3*x^(3/2))/besselJ(1/3,2/3*x^(3/2))*sqrt(x) and besselJ(2/3,2/3*x^(3/2))/besselJ(-1/3,2/3*x^(3/2))*sqrt(x); dsolve(x_+y_^2, y_,x_,1) := AiPrime(-x)/Ai(-x) and BiPrime(-x)/Bi(-x); #dsolve(c_+b_*x_+y_^2, y_,x_,1) := if(isconstant(b,c), cbrt(b)* AiPrime((-b* x - c)/abs(b)^(2/3))/Ai((-b *x - c)/abs(b)^(2/3)) and cbrt(b) *BiPrime((-b *x - c)/abs(b)^(2/3))/Bi((-b *x - c)/abs(b)^(2/3)) ); #dsolve(c_+x_+y_^2, y_,x_,1) := if(isconstant(c), AiPrime(-x-c)/Ai(-x-c) and BiPrime(-x-c)/Bi(-x-c) ); dsolve(x_+b_/y_, y_,x_,1) := if(isconstant(b),(2^(1/3)* x *Ai((x^2 - 2 y)/(2 *2^(1/3) *b^(2/3))) - 2 b^(1/3)* AiPrime((x^2 - 2 y)/(2 *2^(1/3)* b^(2/3))))/(2^(1/3) *x *Bi((x^2 - 2y )/(2 *2^(1/3) *b^(2/3))) - 2 b^(1/3) *BiPrime((x^2 - 2 *y)/(2 *2^(1/3) *b^(2/3)))) + c_1 = 0); dsolve(b_+b_/y_, y_,x_,1) := -W(-exp(-int(b,x) + c_1 - 1)) - 1; dsolve(a_+a_*y_^2, y_,x_,1) := tan(C_1+int(a,x)); dsolve(x_+y_, y_,x_,1) := C_1*exp(x)-x-1; dsolve(y_^2-x_^2+c_, y_,x_,1) := if(isconstant(c), exp(c*x^2)/(C_1 - 1/2 sqrt(pi)* erfi(sqrt(c)*x)/sqrt(c)) + c*x ); dsolve(a_+y_+c_*y_^2, y_,x_,1) := block(u:=gsolution(1+d(c,x)/c,-a*c,y,x,2), -d(u,x)/u/c); dsolve(a_+b_*y_+y_^2, y_,x_,1) := block(u:=gsolution(b,-a,y,x,2), -d(u,x)/u); dsolve(a_+b_*y_+c_*y_^2, y_,x_,1) := block(u:=gsolution(b+d(c,x)/c,-a*c,y,x,2), -d(u,x)/u/c); dsolve(b_*x_+y_+y_^2, y_,x_,1) := if(isconstant(b), AiPrime((-b*x+1/4)/abs(b)^(2/3))/Ai((-b*x+1/4)/abs(b)^(2/3))*cbrt(b)-1/2 and BiPrime((-b*x+1/4)/abs(b)^(2/3))/Bi((-b*x+1/4)/abs(b)^(2/3))*cbrt(b)-1/2 ); dsolve(x_+y_+y_^2, y_,x_,1) := AiPrime(-x+1/4)/Ai(-x+1/4)-1/2 and BiPrime(-x+1/4)/Bi(-x+1/4)-1/2 ; dsolve(c_+x_+y_+y_^2, y_,x_,1) := if(isconstant(c), AiPrime(-x+1/4-c)/Ai(-x+1/4-c)-1/2 and BiPrime(-x+1/4-c)/Bi(-x+1/4-c)-1/2 ); dsolve(c_+b_*x_+y_+y_^2, y_,x_,1) := if(isconstant(b,c), AiPrime((-b*x+1/4-c)/abs(b)^(2/3))/Ai((-b*x+1/4-c)/abs(b)^(2/3))*cbrt(b)-1/2 and BiPrime((-b*x+1/4-c)/abs(b)^(2/3))/Bi((-b*x+1/4-c)/abs(b)^(2/3))*cbrt(b)-1/2 ); dsolve((a_*x_+b_*y_)/(c_*x_+d_*y_),y_,x_,1) := if(isconstant(a,b,c,d), expand(replace(int(expand((c+d*yx)/(a+(b-c)*yx-d*yx^2)),yx),yx,y/x))+C_1-log(x)=0); dsolve((x_-y_)/(x_+y_),y_,x_,1):= -sqrt(C_1+2x^2)-x and sqrt(C_1+2x^2)-x; dsolve((x_+y_)/(x_-y_),y_,x_,1):= log(x^2+y^2)/2-atan(y/x)+C_1=0; dsolve(b_*y_^n_, y_,x_,1) := If(isfree(b,y), block(p:=(C_1-(n-1)*integrate(b,x))^(1/(1-n)), if(isodd(n), -p and p, p))); dsolve(b_*y_, y_,x_,1) := If(isfree(b,y),C_1*exp(integrate(b,x)) ); dsolve(y_^n_, y_,x_,1) := if(isodd(n), -(C_1+(1-n)*x)^(1/(1-n)) and (C_1+(1-n)*x)^(1/(1-n)), (C_1+(1-n)*x)^(1/(1-n)) ); dsolve(x_/y_, y_,x_,1) := -sqrt(C_1+x^2) and sqrt(C_1+x^2); dsolve(x_/(x_+y_), y_,x_,1) := (-1/2-sqrt(5)/2)*x and (-1/2+sqrt(5)/2)*x; dsolve(x_/(a_*x_+b_*y_), y_,x_,1) := if(isconstant(a,b), -(a+sqrt(a*a+4b))/2/b*x and (-a+sqrt(a*a+4b))/2/b*x ); #dsolve(a_+b_*y_,y_,x_):=If(isfree(a,b,y), If(isfree(a,b,x), C_1*exp(b*x)-a/b, block(dsolve:=integrate(b,x), expand(exp(dsolve)*integrate(a*exp(-dsolve),x))+exp(dsolve)*C_1 ) )); dsolve0(a_+b_*y(q_,x_),y_):= dsolve(-a/b,y,x,q); dsolve0(a_+y(q_,x_),y_):= dsolve(-a,y,x,q); #dsolve(a_+b_*y(q_,x_),y_):= if(hasnot(a,y) and hasnot(b,x), d(b,y,-q)=gsolution(0,y,x,q)-d(a,x,-q), if(q<0, dsolve(y+expand(d(a/b,x,-q)),y), dsolve(-expand(a/b),y,x,q) )); #dsolve(y(p_,x_)^n_+b_,y_):= dsolve(solve(replace(b,y(p,x),yy)+yy^n,yy),y,x,p); #dsolve(a_*y(p_,x_)^n_+b_,y_):= dsolve(solve(expand(replace(b,y(p,x),yy)/a)+yy^n,yy),y,x,p); #dsolve(integrate(f_,t_,a_,b_)=z_,y_) := dsolve((replace(f,t,b)-replace(f,t,a)-d(z,x))); dsolve(c_+integrate(f_,t_,a_,b_),y_) := if(hasnot(c,y(x)),solve(replace(f,t,b)-replace(f,t,a)+d(c,x),y(x)), dsolve(replace(f,t,b)-replace(f,t,a)+d(c,x))); dsolve(integrate(f_,t_,a_,b_)+z_,y_) := if(hasnot(z,y(x)),solve(replace(f,t,b)-replace(f,t,a)+d(z,x),y(x)), dsolve(replace(f,t,b)-replace(f,t,a)+d(z,x))); dsolve(c_+integrates(f_,t_,a_,b_),y_) := if(hasnot(c,y(x)),solve(replace(f,t,b)-replace(f,t,a)+d(c,x),y), dsolve(replace(f,t,b)-replace(f,t,a)+d(c,x))); dsolve(integrates(f_,t_,a_,b_)+z_,y_) := if(hasnot(z,y(x)),solve(replace(f,t,b)-replace(f,t,a)+d(z,x),y), dsolve(replace(f,t,b)-replace(f,t,a)+d(z,x))); dsolve(c_+integrates(f_,t_,a_,b_)+z_,y_) := if(hasnot(c,z,y(x)),solve(replace(f,t,b)-replace(f,t,a)+d(c+z,x),y), dsolve(replace(f,t,b)-replace(f,t,a)+d(c+z,x))); dsolve(c_+integrate(f_,t_,a_,b_)+z_,y_) := if(hasnot(c,z,y(x)),solve(replace(f,t,b)-replace(f,t,a)+d(c+z,x),y(x)), dsolve(replace(f,t,b)-replace(f,t,a)+d(c+z,x))); dsolve(y(p_,t)+y(q_,x_)+d_,y_):= if(hasnot(d,y), if(q==2, C_3*exp(t)*(sin(x)+cos(x)),0)+C_1+C_2*(t^p/p!-x^q/q!)+if(has(d,t),if(has(d,x), psolution(1,p,0,-d,y,t,t,p)+psolution(1,q,0,-d,y,t,x,p), -int(d,t,p) ), -int(d,x,q) ), if(hasnot(d,t), dsolve(-d,y,x,q)) ); dsolve(y(p_,t)+a_*y(q_,x_)+d_,y_):= if(hasnot(a,d,y), C_1+C_2*(t^p/p!-int(1/a,x,q))+if(has(d,t),if(has(d,x), psolution(1,p,0,-d,y,t,t,p)+psolution(a,q,0,-d,y,t,x,p), -int(d,t,p) ), -int(d/a,x,q) ), if(hasnot(d,t), dsolve(-d/a,y,x,q)) ); dsolve(f_*y(p_,t)+a_*y(q_,x_)+d_,y_):= if(hasnot(a,d,f,y), C_1+C_2*(int(1/f,t,p)-int(1/a,x,q))+if(has(d,t),if(has(d,x), psolution(1/f,p,0,-d/f,y,t,t,p)+psolution(a/f,q,0,-d/f,y,t,x,p), -int(d/f,t,p) ), -int(d/a,x,q) ), if(hasnot(d,t), dsolve(-d/a,y,x,q)) ); #dsolve(y(p_,t)+a_*y(q_,x_)+d_,y_):= if(hasnot(d,y), if(a<0, C_3*exp(t+x/(-a)^(1/q)),0)+C_1+C_2*(t^p/p!-int(1/a,x,q))-if(has(d,t),if(has(d,x),if(isinteger(q), psolution(-a,1,0,d,y,t,x,p), psolution(0,d,p,x,q)/a), int(d,t,p) ), int(d/a,x,q) )); #dsolve(y(1,t)+a_*y(1,x)+d_,y_):= if(has(d,x) and hasnot(d,t), C_1+C_2*F(t-x/a)+expand(int(replace(-d,t,t-x/a+z/a)*replace(-d,x,z),z,0,x)/a) ); #dsolve(y(p_,t)+y(q_,x_)+b_*y+d_,y):= if(hasnot(d,y), if(isconstant(b), C_3*(exp((-b)^(1/p)*t)+exp((-b)^(1/q)*x))*(t^p/p!-x^q/q!),0)+gsolution(-b,y,t,p)+gsolution(-b,y,x,q)+if(has(d,t), if(has(d,x), psolution(1,-1,q,-b,-d,p,t,x,q),psolution(-b,-d,y,t,p) ), psolution(-b,-d,y,x,q) )); #dsolve(y(p_,t)+a_*y(q_,x_)+b_*y+d_,y):=if(hasnot(d,y), if(isconstant(a,b), C_3*(exp((-b)^(1/p)*t)+exp((-b/a)^(1/q)*x))*(t^p/p!-x^q/q!/a),0)+gsolution(-b,y,t,p)+gsolution(-b/a,y,x,q)+if(has(d,t), if(has(d,x), psolution(a,0,q,-b,-d,p,t,x,q),psolution(-b,-d,y,t,p) ), psolution(-b/a,-d/a,y,x,q) )); dsolve(y(p_,t)+y(q_,x_)+y+d_,y):= if(hasnot(d,y), C_3*(if(p<2,mittag(p,-t^p),0)+if(q<2,mittag(q,-x^q),0))*(t^p/p!-x^q/q!)+gsolution(-1,y,t,p)+gsolution(-1,y,x,q)+if(has(d,t),if(has(d,x), psolution(1,p,-1,-d,y,t,t,p)+psolution(1,q,-1,-d,y,t,x,p),psolution(-1,-d,y,t,p) ), psolution(-1,-d,y,x,q) )); dsolve(y(p_,t)+y(q_,x_)+b_*y+d_,y):= if(hasnot(d,y), if(isconstant(b), C_3*(if(p<2,mittag(p,-b*t^p),0)+if(q<2,mittag(q,-b*x^q),0))*(t^p/p!-x^q/q!),0)+gsolution(-b,y,t,p)+gsolution(-b,y,x,q)+if(has(d,t),if(has(d,x), psolution(1,p,-b,-d,y,t,t,p)+psolution(1,q,-b,-d,y,t,x,p),psolution(-b,-d,y,t,p) ), psolution(-b,-d,y,x,q) )); dsolve(y(p_,t)+a_*y(q_,x_)+y+d_,y):= if(hasnot(a,d,y), if(isconstant(a), C_3*(if(p<2,mittag(p,-t^p),0)+if(q<2,mittag(q,-1/a*x^q),0))*(t^p/p!-x^q/q!/a),0)+gsolution(-1,y,t,p)+gsolution(-1/a,y,x,q)+if(has(d,t),if(has(d,x), psolution(1,p,-1,-d,y,t,t,p)+psolution(a,q,-1,-d,y,t,x,p),psolution(-1,-d,y,t,p) ), psolution(-1/a,-d/a,y,x,q) )); dsolve(y(p_,t)+a_*y(q_,x_)+b_*y+d_,y):=if(hasnot(a,b,d,y), if(isconstant(a,b), C_3*(if(p<2,mittag(p,-b*t^p),0)+if(q<2,mittag(q,-b/a*x^q),0))*(t^p/p!-x^q/q!/a),0)+if(has(b,x),0,gsolution(-b,y,t,p))+gsolution(-b/a,y,x,q)+if(has(d,t),if(has(d,x), psolution(1,p,-b,-d,y,t,t,p)+psolution(a,q,-b,-d,y,t,x,p),psolution(-b,-d,y,t,p) ), psolution(-b/a,-d/a,y,x,q) )); dsolve(y(p_,t)+y(n_,x_)+y(m_,x_)+d_,y_):= if(hasnot(d,y), C_3*(1/p!*t^p-1/m!*x^m)+gsolution(-1,m,0,y,x,n)+if(has(d,t),if(has(d,x), psolution(1,n,1,m,0,d,y,t,x,p), -int(d,t,p)), psolution(-1,m,0,-d,y,x,n)) ); dsolve(y(p_,t)+a_*y(n_,x_)+y(m_,x_)+d_,y_):= if(hasnot(a,d,y), C_3*(1/p!*t^p-1/m!*x^m)+gsolution(-1/a,m,0,y,x,n)+if(has(d,t),if(has(d,x), psolution(a,n,1,m,0,d,y,t,x,p), -int(d,t,p)), psolution(-1/a,m,0,-d/a,y,x,n)) ); dsolve(y(p_,t)+y(n_,x_)+b_*y(m_,x_)+d_,y_):= if(hasnot(b,d,y), if(isconstant(b),C_3*(1/p!*t^p-1/m!*x^m/b),0)+gsolution(-b,m,0,y,x,n)+if(has(d,t),if(has(d,x), psolution(1,n,b,m,0,d,y,t,x,p), -int(d,t,p)), psolution(-b,m,0,-d,y,x,n)) ); dsolve(y(p_,t)+a_*y(n_,x_)+b_*y(m_,x_)+d_,y_):= if(hasnot(a,b,d,y), if(isconstant(b),C_3*(1/p!*t^p-1/m!*x^m/b),0)+gsolution(-b/a,m,0,y,x,n)+if(has(d,t),if(has(d,x), psolution(a,n,b,m,0,d,y,t,x,p), -int(d,t,p)), psolution(-b/a,m,0,-d/a,y,x,n) )); dsolve(y(p_,t)+y(n_,x_)+b_*y(m_,x_)+xy_+d_,xy_):= gsolution(-1,xy,t,p)*(1+exp((-b)^(1/(n-m))*x))+gsolution(-b,m,-1,xy,x,n)+if(has(d,t),if(has(d,x), psolution(1,n,b,m,1,d,y,t,x,p), psolution(-1,-d,xy,t,p)), psolution(-b,m,-1,-d,xy,x,n) ); dsolve(y(p_,t)+y(n_,x_)+y(m_,x_)+c_*xy_+d_,xy_):= gsolution(-c,xy,t,p)*(1+exp(-x))+gsolution(-1,m,-c,xy,x,n)+if(has(d,t),if(has(d,x), psolution(1,n,1,m,c,d,y,t,x,p), psolution(-c,-d,xy,t,p)), psolution(-1,m,-c,-d,xy,x,n) ); dsolve(y(p_,t)+y(n_,x_)+b_*y(m_,x_)+c_*xy_+d_,xy_):= gsolution(-c,xy,t,p)*(1+exp((-b)^(1/(n-m))*x))+gsolution(-b,m,-c,xy,x,n)+if(has(d,t),if(has(d,x), psolution(1,n,b,m,c,d,y,t,x,p), psolution(-c,-d,xy,t,p)), psolution(-b,m,-c,-d,xy,x,n) ); dsolve(y(p_,t)+a_*y(n_,x_)+y(m_,x_)+c_*xy_+d_,xy_):= gsolution(-c,xy,t,p)*(1+exp((-a)^(1/(m-n))*x))+gsolution(-1/a,m,-a,xy,x,n)+if(has(d,t),if(has(d,x), psolution(a,n,1,m,c,d,y,t,x,p), psolution(-c,-d,xy,t,p)), psolution(-1/a,m,-c/a,-d/a,xy,x,n) ); dsolve(y(p_,t)+a_*y(n_,x_)+b_*y(m_,x_)+c_*xy_+d_,xy_):= gsolution(-c,xy,t,p)*(1+exp((-b/a)^(1/(n-m))*x))+gsolution(-b/a,m,-c/a,xy,x,n)+if(has(d,t),if(has(d,x), psolution(a,n,b,m,c,d,y,t,x,p), psolution(-c,-d,xy,t,p)), psolution(-b/a,m,-c/a,-d/a,xy,x,n) ); dsolve(y(p_,t)+y(n_,x_)+b_*y(m_,x_)+xy_,xy_):= gsolution(-1,xy,t,p)*(1+exp((-b)^(1/(n-m))*x))+gsolution(-b,m,-1,xy,x,n); dsolve(y(p_,t)+y(n_,x_)+b_*y(m_,x_)+c_*xy_,xy_):= gsolution(-c,xy,t,p)*(1+exp((-b)^(1/(n-m))*x))+gsolution(-b,m,-c,xy,x,n); dsolve(y(p_,t)+a_*y(n_,x_)+y(m_,x_)+c_*xy_,xy_):= gsolution(-c,xy,t,p)*(1+exp((-a)^(1/(m-n))*x))+gsolution(-1/a,m,-c/a,xy,x,n); dsolve(y(p_,t)+a_*y(n_,x_)+b_*y(m_,x_)+xy_,xy_):= gsolution(-1,xy,t,p)*(1+exp((-b/a)^(1/(n-m))*x))+gsolution(-b/a,m,-1/a,xy,x,n); dsolve(y(p_,t)+a_*y(n_,x_)+b_*y(m_,x_)+c_*xy_,xy_):= gsolution(-c,xy,t,p)*(1+exp((-b/a)^(1/(n-m))*x))+gsolution(-b/a,m,-c/a,xy,x,n); dsolve(y(p_,t)+y(q_,x_),y_):= C_1+C_2*(t^p/p!-x^q/q!)+if(p>1 and q>1, C_3*(t-x),0); dsolve(y(p_,t)+a_*y(q_,x_),y_):= if(hasnot(a,t) and hasnot(a,x), C_1+C_2*(t^p/p!-x^q/q!/a)+if(a<0 or isinteger(q), C_3*exp(t+x/(-a)^(1/q)),0) ); dsolve(y(p_,t)+y(q_,x_)+b_*xy_,xy_):=if(p<2, (1+t^p/p!-x^q/q!),1)*if(hasnot(b,x),gsolution(-b,xy,t,p),0)+if(q<2, (1+t^p/p!-x^q/q!),1)*if(hasnot(b,t),gsolution(-b,xy,x,q),0); dsolve(y(p_,t)+a_*y(q_,x_)+xy_,xy_):=if(hasnot(a,t), if(p<2 and hasnot(a,x), (1+t^p/p!-x^q/q!/a),1)*gsolution(-1,xy,t,p)+if(q<2 and hasnot(a,x), (1+t^p/p!-x^q/q!/a),1)*if(hasnot(a,t),gsolution(-1/a,xy,x,q),0)); dsolve(y(p_,t)+a_*y(q_,x_)+b_*xy_,xy_):=if(hasnot(a,t), if(p<2 and hasnot(a,x), (1+t^p/p!-x^q/q!/a),1)*if(hasnot(b,x),gsolution(-b,xy,t,p),0)+if(q<2 and hasnot(a,x), (1+t^p/p!-x^q/q!/a),1)*if(hasnot(b,t),gsolution(-b/a,xy,x,q),0)); dsolve(y(p_,t)+y(m_,x_)+y(1,x_),y_):= gsolution(-1,1,0,y,x,m)+C_3*(1/p!*t^p-x) ; dsolve(y(p_,t)+y(m_,x_)+b_*y(1,x_),y_):= if(hasnot(b,y), gsolution(-b,1,0,y,x,m)+C_3*(1/p!*t^p+psolution(-b,1,0,-1,y,x,m)) ); dsolve(y(p_,t)+a_*y(m_,x_)+y(1,x_),y_):= if(hasnot(a,y), gsolution(-1/a,1,0,y,x,m)+C_3*(1/p!*t^p+psolution(-1/a,1,0,-1/a,y,x,m)) ); dsolve(y(p_,t)+a_*y(m_,x_)+b_*y(1,x_),y_):= if(hasnot(a,b,y), gsolution(-b/a,1,0,y,x,m)+C_3*(1/p!*t^p+psolution(-b/a,1,0,-1/a,y,x,m)) ); dsolve(y(p_,t_)+b_*y(1,x_)+c_*y(1,u_),y_):= if(isconstant(b,c), C_1+C_2*(2*t^p/p!-u/c-x/b) ); dsolve(y(p_,t_)+b_*y(1,x_)+c_*y(1,u_)+f_,y_):= if(isconstant(b,c), psolution(1,p,0,-f,y,t,t,p)+ psolution(b,1,0,-f,y,t,x,p)+psolution(-c,1,0,-f,y,t,u,p)+C_1+C_2*(2*t^p/p!-u/c-x/b) ); dsolve(y(p_,t_)+b_*y(1,x_)+c_*y(1,u_)+g_*xy_,xy_):= gsolution(-g,xy,t,p)+gsolution(-g/b,xy,x,1)+gsolution(-g/c,xy,u,1); dsolve(y(p_,t_)+b_*y(1,x_)+c_*y(1,u_)+g_*xy_+f_,xy_):= psolution(1,p,-g,-f,xy,t,t,p)+ psolution(b,1,-g,-f,xy,t,x,p)+psolution(-c,1,-g,-f,xy,t,u,p)+gsolution(-g,xy,t,p)+gsolution(-g/b,xy,x,1)+gsolution(-g/c,xy,u,1); dsolve(y(p_,t_)+b_*y(1,x_)+c_*y(1,u_)+d_*y(1,v_),y_):= if(isconstant(b,c,d), C_1+C_2*(3*t^p/p!-u/c-x/b-v/d) ); dsolve(y(p_,t_)+b_*y(1,x_)+c_*y(1,u_)+d_*y(1,v_)+f_,y_):= psolution(1,p,0,-f,y,t,t,p)+ psolution(b,1,0,-f,y,t,x,p)+psolution(-c,1,0,-f,y,t,u,p)+psolution(-d,1,0,-f,y,t,v,p)+if(isconstant(b,c,d), C_1+C_2*(3*t^p/p!-u/c-x/b-v/d),0 ); dsolve(y(p_,t_)+b_*y(1,x_)+c_*y(1,u_)+d_*y(1,v_)+g_*xy_,xy_):= gsolution(-g,xy,t,p)+gsolution(-g/b,xy,x,1)+gsolution(-g/c,xy,u,1)+gsolution(-g/d,xy,v,1); dsolve(y(p_,t_)+b_*y(1,x_)+c_*y(1,u_)+d_*y(1,v_)+g_*xy_+f_,xy_):= psolution(1,p,-g,-f,xy,t,t,p)+psolution(b,1,-g,-f,xy,t,x,p)+psolution(-c,1,-g,-f,xy,t,u,p)+psolution(-d,1,-g,-f,xy,t,v,p)+gsolution(-g,xy,t,p)+gsolution(-g/b,xy,x,1)+gsolution(-g/c,xy,u,1)+gsolution(-g/d,xy,v,1); dsolve(y(p_,t_)+b_*y(2,x_)+c_*y(2,u_),y_):= if(isconstant(b,c), C_1+C_3*(2t^p/p!-x*x/2/b-u*u/2/c)+C_2*exp((b+c)^(1/p)*t)*sin(x)*sin(u) ); dsolve(y(p_,t_)+b_*y(2,x_)+c_*y(2,u_)+f_,y_):= if(isconstant(b,c), psolution(1,p,0,-f,y,t,t,p)+psolution(b,2,0,-f,y,t,x,p)+psolution(-c,2,0,-f,y,t,u,p)+C_1+C_3*(x+u+4*t^p/p!-u^2/c-x^2/b)+C_2*exp((b+c)^(1/p)*t)*sin(x)*sin(u) ); dsolve(y(p_,t_)+b_*y(2,x_)+c_*y(2,u_)+g_*xy_,xy_):= gsolution(-g,y,t,p)+gsolution(-g/b,xy,x,2)+gsolution(-g/c,xy,u,2); dsolve(y(p_,t_)+b_*y(2,x_)+c_*y(2,u_)+g_*xy_+f_,xy_):= psolution(1,p,-g,-f,xy,t,t,p)+psolution(b,2,-g,-f,xy,t,x,p)+psolution(-c,2,-g,-f,xy,t,u,p)+gsolution(-g,y,t,p)+gsolution(-g/b,xy,x,2)+gsolution(-g/c,xy,u,2); dsolve(y(p_,t_)+b_*y(2,x_)+c_*y(2,u_)+d_*y(2,v_),y_):= if(isconstant(b,c,d), C_1+C_3*(x+u+v+6*t^p/p!-u^2/c-x^2/b-v^2/d)+C_2*exp((b+c+d)^(1/p)*t)*sin(x)*sin(u)*sin(v) ); dsolve(y(p_,t_)+b_*y(2,x_)+c_*y(2,u_)+d_*y(2,v_)+f_,y_):= psolution(1,p,0,-f,y,t,t,p)+psolution(b,2,0,-f,y,t,x,p)+psolution(-c,2,0,-f,y,t,u,p)+psolution(-d,2,0,-f,y,t,v,p)+if(isconstant(b,c,d),C_3*(x+u+v+6*t^p/p!-u^2/c-x^2/b-v^2/d),0); dsolve(y(p_,t_)+b_*y(2,x_)+c_*y(2,u_)+d_*y(2,v_)+g_*xy_,xy_):= gsolution(-g,y,t,p)+gsolution(-g/b,xy,x,2)+gsolution(-g/c,xy,u,2)+gsolution(-g/d,xy,v,2); dsolve(y(p_,t_)+b_*y(2,x_)+c_*y(2,u_)+d_*y(2,v_)+g_*xy_+f_,xy_):= psolution(1,p,-g,-f,xy,t,t,p)+psolution(b,2,-g,-f,xy,t,x,p)+psolution(-c,2,-g,-f,xy,t,u,p)+psolution(-d,2,-g,-f,xy,t,v,p)+gsolution(-g,y,t,p)+gsolution(-g/b,xy,x,2)+gsolution(-g/c,xy,u,2)+gsolution(-g/d,xy,v,2); dsolve(y(2,t_)+b_*y(2,x_)+c_*y(1,t_)+d_*y(1,x_)+g_*xy_,xy_):= gsolution(-c,-g,y,t,2)*(1+exp(-d/b*x))+gsolution(-d/b,-g/b,y,x,2)*(1+exp(-c*t)); dsolve(y(2,x_)+b_*y(2,t_)+c_*y(1,x_)+d_*y(1,t_)+g_*xy_,xy_):= gsolution(-c,-g,y,x,2)*(1+exp(-d/b*t))+gsolution(-d/b,-g/b,y,t,2)*(1+exp(-c*x)); dsolve(y(2,x_)+b_*y(2,t_)+c_*y(1,x_)+d_*y(1,t_)+xy_,xy_):= gsolution(-c,-1,y,x,2)*(1+exp(-d/b*t))+gsolution(-d/b,-1/b,y,t,2)*(1+exp(-c*x)); dsolve(y(2,x_)+y(2,t_)+c_*y(1,x_)+d_*y(1,t_)+g_*xy_,xy_):= gsolution(-c,-g,y,x,2)*(1+exp(-d*t))+gsolution(-d,-g,y,t,2)*(1+exp(-c*x)); dsolve(y(2,x_)+y(2,t_)+c_*y(1,x_)+d_*y(1,t_)+xy_,xy_):= gsolution(-c,-1,y,x,2)*(1+exp(-d*t))+gsolution(-d,-1,y,t,2)*(1+exp(-c*x)); dsolve(y(2,t_)+b_*y(2,x_),y_):= if(isconstant(b), C_1+C_3*(t+x+t^2-x^2/b)+C_2*(sin(x)+cos(x))*if(b>0,(exp(-sqrt(b)*t)+exp(sqrt(b)*t)),(sin(sqrt(-b)*t)+cos(sqrt(-b)*t)) ) ); dsolve(y(1,t)+a_*y(1,x_),y_):= if(hasnot(a,y), if(hasnot(a,x), C_1+C_2*(t-x/a), C_1+t-int(1/a,x) )); dsolve(y(1,t)+y(1,x_)+xy_^2,xy_):= 2/(C_1+t+x) and 1/(C_1+t) and 1/(C_1+x); dsolve(y(1,t)+a_*y(2,x_),y_):= if(hasnot(a,y), if(hasnot(a,x), C_1+C_2*(t+x-x^2/2/a)+C_3*exp(a*t)*(sin(x)+cos(x))+C_4*erf(x/2/sqrt(-a*t)), C_1+C_2*x+int(-1/a,x,2)+t )); dsolve(y(1,t)+y(2,x_),y_):= C_1+C_2*(t+x-x^2/2)+C_3*exp(t)*(sin(x)+cos(x))+C_4*erfi(x/2/sqrt(t)); dsolve(y(1,t)+xy_*y(p_,x_),xy_):= 1/(c_1+t)*x^p/p!; dsolve(y(1,t)+b_*xy_*y(p_,x_),xy_):= if(isconstant(b), 1/(c_1+t)*x^p/p!/b ); dsolve(a_*y(1,t)+xy_*y(p_,x_),xy_):= if(isconstant(a), a/(c_1+t)*x^p/p! ); dsolve(a_*y(1,t)+b_*xy_*y(p_,x_),xy_):= if(isconstant(a,b), a/(c_1+t)*x^p/p!/b ); #dsolve(a_/xy_*y(1,t),xy_,x_,p_):= if(isconstant(a), -a/(c_1+t)*x^p/p! ); dsolve(y(1,t_)+a_*y(2,x_)+a_/x_*y(1,x_),y_):= if(hasnot(a,b,x), C_1-C_2*log(x)/a+C_3*(t-1/4/a*x^2)-Ei(x^2/(4a*t)) ); #dsolve(b_+x(n_,t_),d_+y(n_,t_)):= (x=dsolve(-b,x,t,n), y=dsolve(-d,y,t,n)); #dsolve(b_+x(n_,t_),d_+x_+y(n_,t_)):= block(xx:=dsolve(-b,x,t,n), x=xx, y=dsolve(-d-xx,y,t,n)); #dsolve(b_+x(n_,t_),d_+y(m_,t_)):= if(hasnot(b,y(t)) and hasnot(d,x(t)), (x=dsolve(-b,x(t),t,n), y=dsolve(-d,y(t),t,m)), if(hasnot(b,y(t)),block(xx:=dsolve(-b,x(t),t,n), (x=xx, y=dsolve(-replace(d,x(t),xx),y(t),t,m))), if(hasnot(d,x(t)),block(xx:=dsolve(-d,y(t),t,m), (y=xx, x=dsolve(-replace(b,y(t),xx),x(t),t,n))) ))); #dsolve(c_+a_*xy_+b_*y(1,x_),xy_):= if(hasnot(c,xy) and a==d(b,x), C_1/b-int(c,x)/b, dsolve(-expand(c/b+a/b*xy),xy,x,1) ); dsolve(y(n_,x_)^m_+b_,y_):= if(iseven(m),if(hasnot(b,y), -int((-b)^(1/m),x,n)+gsolution(0,y,x,n) and int((-b)^(1/m),x,n)+gsolution(0,y,x,n), block( pp:=dsolve((-b)^(1/m),y,x,n), -pp and pp) ), if(hasnot(b,y),int((-b)^(1/m),x,n)+gsolution(0,y,x,n), dsolve((-b)^(1/m),y,x,n) )); dsolve(a_*y(n_,x_)^m_+b_,y_):= if(iseven(m),if(hasnot(b,y), -int((-b/a)^(1/m),x,n)+gsolution(0,y,x,n) and int((-b/a)^(1/m),x,n)+gsolution(0,y,x,n), block( pp:=dsolve((-b/a)^(1/m),y,x,n), -pp and pp) ), if(hasnot(b,y),int((-b/a)^(1/m),x,n)+gsolution(0,y,x,n), dsolve((-b/a)^(1/m),y,x,n) )); dsolve(a_*y(q_,x_)^m_+b_*y(p_,x_),xy_):=if(hasnot(b,xy),int(dsolve((-b/a*xy)^(1/m),xy,x,q-p),x,p), dsolve((-b/a)^(1/m)*y(p,x)^(1/m),xy,x,q) ); dsolve(y(q_,x_)^m_+b_*y(p_,x_),xy_):= if(hasnot(b,xy),int(dsolve((-b*xy)^(1/m),xy,x,q-p),x,p), dsolve((-b)^(1/m)*y(p,x)^(1/m),xy,x,q) ); dsolve(y(q_,x_)^2+xy_*y(1,x_),xy_):= C_1*exp(-x) and C_1; dsolve(y(n_,x_)^m_+b_*y(n_,x_),y_):=if(hasnot(b,y),if(m>0,gsolution(0,y,x,n) and gsolution(0,y,x,n)+int((-b)^(1/(m-1)),x,n), gsolution(0,y,x,n)+int((-b)^(1/(m-1)),x,n)), dsolve((-b)^(1/(m-1)),y,x,n) ); dsolve(y(n_,x_)^m_+b_*y(n_,x_)+c_,y_):=if(hasnot(b,c,y),C_1+int(solve(y^m+b*y+c,y),x,n)); dsolve(y(p_,x_)^2+b_*y(p_,x_)+c_,y_):= if(hasnot(b,c,y),C_1-int(b+sqrt(b*b-4c),x,p)/2 and C_1+int(-b+sqrt(b*b-4c),x,p)/2, -dsolve(b/2+sqrt(b*b-4c)/2,y,x,p) and dsolve(-b/2+sqrt(b*b-4c)/2,y,x,p) ); dsolve(y(p_,x_)^2+b_*xy_*y(p_,x_)+c_*xy_^2,xy_):= if(b*b==4c, C_1*mittag(p,-p!/2*int(b,x,p)), C_1*mittag(p,p!/2*int((-b+sqrt(b*b-4c)),x,p)) and C_2*mittag(p,-p!/2*int((b+sqrt(b*b-4c)),x,p)) ); dsolve(a_=b_,y_):=dsolve(replace(toy(a-b),y(x),y),y); dsolve(a_=b_,y(x_)):=dsolve(replace(toy(a-b),y(x),y),y); #dsolve(b_=a_*y(n_,x_),y_):=dsolve(b/a,y,x,n); #dsolve(a_*y(n_,x_)=b_,y_):=dsolve(b/a,y,x,n); #dsolve(y(n_,x_)=b_,y_):=dsolve(b,y,x,n); dsolve(x(n_,t_)=a_,x_) := dsolve(tox(a),x,t,n); #dsolve(y(n_,t)=a_,y_) := if(hasnot(a,t), dsolve(a-1,y)+t^n/n!, dsolve(y(n,t)+expand(-(a)),y)); #dsolve(y(n_,t)=a_,y_) := if(hasnot(a,y), if(hasnot(a,t), dsolve(a-1,y)+t^n/n!, if(hasnot(a,x), dsolve(toy(a),y,t,n), dsolve(y(n,t)-(a),y) ) ), if(hasnot(a,t),if(hasnot(a-y,y), dsolve(a,y)+C_3*exp(t),dsolve(a,y)), dsolve(y(n,t)-(a),y) )); #dsolve(y(p_,t)=y(q_,x_)+d_,y_):= if(hasnot(d,y),if(hasnot(a,t), dsolve(1-d,y,x,q)+t^p/p!, if(has(d,t), if(has(d,x), psolution(0,-d,p,x,q), int(d,t,p) ),-int(d,x,q) )), if(hasnot(a,t), dsolve(-d,y,x,q),dsolve(y(p,t)-y(q,x)-d,y) )); #dsolve(y(p_,t)=a_*y(q_,x_)+d_,y_):= if(isconstant(a) and hasnot(d,y), C_1+C_2*(a*t^p/p!+x^q/q!)+if(has(d,t),if(has(d,x), psolution(a,-d,p,x,q), int(d,t,p) ), -int(d/a,x,q) )); #dsolve(y(p_,t)=y(q_,x_),y_):= C_1+C_2*(t^p/p!+x^q/q!)+if(q>=2,C_3*x,0); #dsolve(y(p_,t)=a_*y(q_,x_),y_):= if(isconstant(a), C_1+C_2*(t^p/p!+x^q/q!/a)+if(q>=2,C_3*x,0), if(hasnot(a,y), int(1/a,x,q)+t^p/p!+C_1, dsolve(y(p,t)-a*y(q,x),y) )); dsolve(a_=b_,c_=d_):= dsolve(tox(a=b),toyt(c=d),x,y); dsolve(ds(x_,t_)=f_,ds(y_,t_)=g_):= dsolve(x(1,t)=f,y(1,t)=g,x,y); dsolve(x(n_,t_)=b_,d_+y(m_,t_),x_,y_):= block(bb:=replace(replace(b,x(t),x),y(t),y),dd:= replace(replace(-d,x(t),x),y(t),y), if(hasnot(bb,y),block(xx:=dsolve(bb,x,t,n), (x=xx, y=dsolve(replace(dd,x,xx),y,t,m))), if(hasnot(dd,x),block(xx:=dsolve(dd,y,t,m), (y=xx, x=dsolve(replace(bb,y,xx),x,t,n))), if(hasnot(a,c,t), m==n,y=dsolve(c/a,y,x,n) )))); dsolve(x(m_,t_)=a_,y(n_,t_)=c_,x_,y_):= if(hasnot(a,y), block(xx:=solve(dsolve(a,x,t,m),x), (x=xx, y=dsolve(replace(c,x,xx),y,t,n))), if(hasnot(c,x), block(yy:=solve(dsolve(c,y,t,n),y), (y=yy, x=dsolve(replace(c,y,yy),x,t,m))), if(hasnot(a,c,t), m==n, (x=dsolve(replace(a,y,dsolve(c/a,y,x,n)),x,t,m),y=dsolve(c/a,y,x,m)) ))); dsolve(x(m_,t_)=c1_+y_,y(n_,t_)=c2_+x_,x_,y_):= if(isconstant(c1,c2), (x=exp(t)-c2, y=exp(t)-c1)); dsolve(x(m_,t_)=a_*x_+b_*y_,y(m_,t_)=c_*x_+d_*y_,x_,y_):= if(isconstant(a,b,c,d), (a+d)^2==4*(a*d-b*c),(x=C_1*mittag(m,(a+d)/2*t^m), y=C_1*mittag(m,(a+d)/2*t^m))); dsolve(x(m_,t_)=a_*x_+y_,y(m_,t_)=x_+a_*y_,x_,y_):= if(isconstant(a),(x=C_1*mittag(m,(a+1)*t^m), y=C_1*mittag(m,(a+1)*t^m))); dsolve(x(m_,t_)=x_+b_*y_,y(m_,t_)=b_*x_+y_,x_,y_):= if(isconstant(b),(x=C_1*mittag(m,(1+b)*t^m), y=C_1*mittag(m,(1+b)*t^m))); dsolve(x(m_,t_)=a_*x_+b_*y_,y(m_,t_)=b_*x_+a_*y_,x_,y_):= if(isconstant(a,b),(x=C_1*mittag(m,(a+b)*t^m), y=C_1*mittag(m,(a+b)*t^m))); dsolve(a_):=dsolve(replace(toy(a),y(x),y),y);