>> loadlib("ode"): # firstord1 # >> ode((x^4-x^3)*diff(u(x),x) + 2*x^4*u(x) = x^3/3 + C,u(x)): >> solve(%); -- 1 x C C1 -- | - ---------- + ---------- + ------------- + ---------------- | | 2 2 2 2 2 2 | -- 4 (x - 1) 6 (x - 1) 2 x (x - 1) exp(x) (x - 1) -- # firstord2 # >> ode(-1/2*diff(u(x),x)+u(x)=sin(x),u(x)): >> solve(%); -- 2 cos(x) 4 sin(x) -- | -------- + -------- + C2 exp(2 x) | -- 5 5 -- # firstord3 # >> ode(diff(y(x),x)=y(x)/(y(x)*ln(y(x))+x),y(x)): >> solve(%); [] # firstord4 # >> ode(2*y(x)*diff(y(x),x)^2-2*x*diff(y(x),x)-y(x)=0,y(x)): >> solve(%); [] # bernoulli # >> ode(diff(y(x),x)+y(x)=y(x)^3*sin(x),y(x)): >> solve(%); [] # bernoulli2 # >> ode(diff(y(x),x)+P(x)*y(x)=Q(x)*y(x)^(2/3),y(x)): >> solve(%); [] # clairaut # >> ode((x^2-1)*diff(y(x),x)^2-2*x*y(x)*diff(y(x),x)+y(x)^2-1,y(x)): >> solve(%); [] # clairaut2 # >> ode(f(x*diff(y(x),x)-y(x))=g(diff(y(x),x)),y(x)): >> solve(%); Error: not an ordinary differential equation in the given variable [ode::solve_eq_irred] # exact1st # >> ode(diff(y(x),x)=(3*x^2-y(x)^2-7)/(exp(y(x))+2*x*y(x)+1),y(x)): >> solve(%); [] # homogeneous # >> ode(diff(y(x),x)=(2*x^3*y(x)-y(x)^4)/(x^4-2*x*y(x)^3),y(x)): >> solve(%); [] # factor # >> ode(diff(y(x),x)*(diff(y(x),x)+y(x))=x*(x+y(x)),y(x)): >> solve(%); -- 2 -- | x | | C3 + --, - x + C4 exp(-x) + 1 | -- 2 -- # interchange # >> ode(diff(y(x),x)=x/(x^2*y(x)^2+y(x)^5),y(x)): >> solve(%); [] # lagrange # >> ode(y(x)=2*x*diff(y(x),x)-a*diff(y(x),x)^3,y(x)): >> solve(%); [] # lagrange2 # >> ode(y(x)=2*x*diff(y(x),x)-diff(y(x),x)^2,y(x)): >> solve(%); [] # riccati # >> ode(diff(y(x),x)=exp(x)*y(x)^2-y(x)+exp(-x),y(x)): >> solve(%); [] # riccati2 # >> ode(diff(y(x),x)=y(x)^2-x*y(x)+1,y(x)): >> solve(%); [] # separable # >> ode(diff(y(x),x)=(9*x^8+1)/(y(x)^2+1),y(x)): >> solve(%); -- | | / 9 9 2 1/2 \1/3 | | 3 x 3 C5 3 x ((- 3 x - 3 C5 - 3 x ) + 4) | | | --- + ---- + ---- + ------------------------------- | | \ 2 2 2 2 / | | -- ... -- | | 1 | ------------------------------------------------------------ | / 9 9 2 1/2 \1/3 | | 3 x 3 C5 3 x ((- 3 x - 3 C5 - 3 x ) + 4) | | 2 | --- + ---- + ---- + ------------------------------- | | \ 2 2 2 2 / -- # solvablex # >> ode(2*x*diff(y(x),x)+y(x)*diff(y(x),x)^2-y(x),y(x)): >> solve(%); [] # solvabley # >> ode(x-y(x)*diff(y(x),x)+x*diff(y(x),x)^2,y(x)): >> solve(%); [] # SecOrderChangevar # >> eq:=(a*x+b)^2*diff(y(x),x,x)+4*a*(a*x+b)*diff(y(x),x)+2*a^2*y(x): >> ode(eq,y(x)); >> solve(%); [] # adjoint # >> ode((x^2-x)*diff(u(x),x,x)+(2*x^2+4*x-3)*diff(u(x),x)+8*x*u(x)=1,u(x)): >> solve(%); -- 1 x C7 C8 -- | - ---------- + ---------- - ------------- + ---------------- | | 2 2 2 2 2 2 | -- 4 (x - 1) 6 (x - 1) 2 x (x - 1) exp(x) (x - 1) -- # secondord1 # >> ode((x^2-x)*diff(w(x),x,x)+(1-2*x^2)*diff(w(x),x)+(4*x-2)*w(x),w(x)): >> solve(%); 2 [x C9] # autonomous # >> ode(diff(y(x),x,x)-diff(y(x),x)=2*y(x)*diff(y(x),x),y(x)): >> solve(%); 1/2 1/2 [C11, (C10 - 1/4) tan((x + C12) (C10 - 1/4) ) - 1/2] # autonomous2 # >> ode(diff(y(x),x,x)/y(x)-diff(y(x),x)^2/y(x)^2-1+1/y(x)^3=0,y(x)): >> solve(%); 1/2 1/2 [1, 1/2 I 3 - 1/2, (- 1/2 I) 3 - 1/2] # ymissing # >> ode(diff(y(x),x,x)+2*x*diff(y(x),x)=2*x,y(x)): >> solve(%); [C13] # diff # >> ode(2*y(x)*diff(y(x),x,x)-diff(y(x),x)^2= &> 1/3*(diff(y(x),x)-x*diff(y(x),x,x))^2,y(x)): >> solve(%); [] # equidimx # >> ode(x*diff(y(x),x,x)=2*y(x)*diff(y(x),x),y(x)): >> solve(%); [] # equidimy # >> ode((1-x)*(y(x)*diff(y(x),x,x)-diff(y(x),x)^2)+x^2*y(x)^2,y(x)): >> solve(%); [] # exact2nd # >> ode(x*y(x)*diff(y(x),x,x)+x*diff(y(x),x)^2+y(x)*diff(y(x),x)=0,y(x)): >> solve(%); [] # factoring # >> ode(diff(y(x),x\$2)^2 - 2*diff(y(x),x)*diff(y(x),x\$2) + 2*y(x)*diff(y(x),x) - y(x)^2 = 0, y(x)): >> solve( % ); [C1 exp(x) + C2 exp(-x), C3 exp(x) + C4 x exp(x)] # liouvillian # >> ode((x^3/2-x^2)*diff(y(x),x,x)+(2*x^2-3*x+1)*diff(y(x),x) +(x-1)*y(x),y(x)): >> solve(%); -- / / 1 \ 2 1/2 \ -- | | C2 exp| - | (- 2 x + x ) | | | | \ x / | | | int| - ---------------------------, x | | | | 2 3 | | | C3 \ - 2 C1 x + C1 x / | | ------------------------ + --------------------------------------- | | / 1 \ 2 1/2 / 1 \ 2 1/2 | | exp| - | (- 2 x + x ) exp| - | (- 2 x + x ) | -- \ x / \ x / -- # reduction # >> ode(diff(y(x),x,x)-2*x*diff(y(x),x)+2*y(x)=3,y(x)): >> solve(%); [C2 x] # intfactors # >> ode(sqrt(x)*diff(y(x),x,x)+2*x*diff(y(x),x)+3*y(x)=0,y(x)): >> solve(%); [] # scaleinv # >> ode(x^2*diff(y(x),x,x)+3*x*diff(y(x),x)+2*y(x)-1/y(x)^3/x^4,y(x)): >> solve(%); [] # undet # >> ode(diff(y(x),x,x)-2/x^2*y(x)=7*x^4+3*x^3,y(x)): >> solve(%); 2 [C3 x ] # variation # >> ode(diff(y(x),x,x)+y(x)=csc(x),y(x)): >> solve(%); [] # constantcoeff # >> ode(diff(y(x),x\$7)-14*diff(y(x),x\$6)+80*diff(y(x),x\$5)-242*diff(y(x),x\$4) +419*diff(y(x),x\$3)-416*diff(y(x),x\$2)+220*diff(y(x),x)-48*y(x)=0,y(x)): >> solve(%); [C8 exp(x) + x C9 exp(x) + C4 exp(3 x) + C6 exp(2 x) + C5 exp(4 x) + 2 x C7 exp(2 x) + x C10 exp(x)] # euler # >> ode(diff(y(x),x\$4)-4/x^2*diff(y(x),x,x)+8/x^3*diff(y(x),x)-8*y(x)/x^4,y(x)): >> solve(%); Error: Illegal argument [array] # exactnth # >> ode((1+x+x^2)*diff(y(x),x\$3)+(3+6*x)*diff(y(x),x,x)+6*diff(y(x),x) =6*x,y(x)): >> solve(%); [C13] # circle # >> solve( ode( (diff(y(x),x)^2+1)*diff(y(x),x\$3) - 3*diff(y(x),x)*diff(y(x),x\$2)^2=0, y(x) ) ); Segmentation Fault - core dumped # transfBernoulli # >> solve(ode(3*diff(y(x),x\$2)*diff(y(x),x\$4)-5*diff(y(x),x\$3)^2=0,y(x))); Error: Recursive definition # delay # >> ode(diff(y(t),t)+a*y(t-1)=0,y(t)): >> solve(%); Error: not an ordinary differential equation in the given variable [ode::solve_eq_irred] # several # >> solve(ode(diff(y(x,a),x)=a*y(x,a),y(x,a))); [C1 exp(a x)] # nthorder # >> ode({diff(y(x),x\$4)=sin(x),y(0)=0,D(y)(0)=0, D(D(y))(0)=0,D(D(D(y)))(0)=0},y(x)): >> solve(%); -- 3 -- | x | | - x + sin(x) + -- | -- 6 -- # besselJ # >> ode({x*diff(y(x),x,x)+diff(y(x),x)+2*x*y(x),y(0)=1,D(y)(0)=0},y(x)): >> solve(%); [] # separ # >> solve(ode({x*diff(y(x),x)^2-y(x)^2+1,y(0)=1},y(x))); [] # ic2 # >> ode({diff(y(x),x,x)+y(x)*diff(y(x),x)^3,y(0)=0,D(y)(0)=2},y(x)): >> solve(%); Error: Domain attribute "diff" missing # intcomb # >> ode({diff(x(t),t)=-3*y(t)*z(t), diff(y(t),t)=3*x(t)*z(t), diff(z(t),t)=-x(t)*y(t)},{x(t),y(t),z(t)}): >> solve(%); solve({diff(x(t), t) = - 3 y(t) z(t), diff(y(t), t) = 3 x(t) z(t), diff(z(t), t) = - x(t) y(t)}, {x(t), y(t), z(t)}) # mriccati # >> ode({diff(x(t),t)-a(t)*(y(t)^2-x(t)^2)-2*b(t)*x(t)*y(t)-2*c*x(t), diff(y(t),t)-b(t)*(y(t)^2-x(t)^2)+2*a(t)*x(t)*y(t)-2*c*y(t)},{x(t),y(t)}): >> solve(%); solve({- 2 c x(t) - 2 b(t) x(t) y(t) + diff(x(t), t) 2 2 - a(t) (- x(t) + y(t) ), - 2 c y(t) + 2 a(t) x(t) y(t) + diff(y(t), t) 2 2 - b(t) (- x(t) + y(t) )}, {x(t), y(t)}) # vector # >> ode({diff(x(t),t)=9*x(t)+2*y(t),diff(y(t),t)=x(t)+8*y(t)},{x(t),y(t)}): >> solve(%); [[x(t) = - C18 exp(7 t) + 2 C19 exp(10 t), y(t) = C18 exp(7 t) + C19 exp(10 t)]] # triangular # >> ode({diff(x(t),t)=x(t)*(1+cos(t)/(2+sin(t))),diff(y(t),t)=x(t)-y(t)}, {x(t),y(t)}): >> solve(%); / { / cos(t) \ solve| { diff(x(t), t) = x(t) | ---------- + 1 |, \ { \ sin(t) + 2 / } \ diff(y(t), t) = x(t) - y(t) }, {x(t), y(t)} | } / # Higher order # >> solve( ode( { diff(x(t),t)-x(t)+2*y(t)=0,diff(x(t),t\$2)-2*diff(y(t),t)=2*t-cos(2*t)}, {x(t),y(t)} ) ); solve({- x(t) + 2 y(t) + diff(x(t), t) = 0, - 2 diff(y(t), t) + diff(x(t), t, t) = 2 t - cos(2 t)}, {x(t), y(t)}) # Inhomogeneous system # >> eq:= {diff(y1(x),x)=-1/(x*(x^2+1))*y1(x)+1/(x^2*(x^2+1))*y2(x)+1/x, diff(y2(x),x)=-x^2/(x^2+1)*y1(x) + (2*x^2+1)/(x*(x^2+1))*y2(x)+1}: >> solve( ode( eq,{y1(x),y2(x)} ) ); / { | { 1 y1(x) y2(x) solve| { diff(y1(x), x) = - - ---------- + -----------, | { x 2 2 2 \ { x (x + 1) x (x + 1) 2 2 } \ x y1(x) y2(x) (2 x + 1) } | diff(y2(x), x) = - -------- + ---------------- + 1 }, {y1(x), y2(x)} | 2 2 } | x + 1 x (x + 1) } / # bronstein # >> a0:=104/25*x^10+(274/25-22/15*sqrt(-222))*x^8+(7754/75-68/15*sqrt(-222))*x^6 +(11248/75-194/15*sqrt(-222))*x^4+(29452/75-296/5*sqrt(-222))*x^2 -10952/5-148/3*sqrt(-222): >> a2:=x^12+2*x^10+151/3*x^8+296/3*x^6+5920/9*x^4+10952/9*x^2+5476/9: >> eq:=a2*diff(y(x),x,x)-a0*y(x)=0: >> solve(ode(eq,y(x))); []