<Text-field layout="Heading 1" style="Heading 1">An example of solving differential equations and graphing their solutions.</Text-field>The following two commands load necessary packages. The colon instead of a semi-colon suppresses the output.with(DEtools):with(plots):Define your equation:eq:=diff(y(t),t)=t^2;Find the general solution:dsolve(eq,y(t));Define initial conditions:init:=y(1)=1;Find the particular solution:dsolve({eq,init},y(t));You can solve an equation numerically rather than analytically. solut:=dsolve({eq,init},y(t),numeric);The output you have just seen says that a procedure was created that can evaluate the solution you are looking for at any point you need. Try it:solut(1);solut(3);This is how you can draw the direction field that corresponds to your equation:DEplot(eq,y(t),t=-3..3,y=-3..3);If you want to see a specific integral curve (graph of a solution), incorporate the initial condition:DEplot(eq,y(t),t=-3..3,[[init]],y=-3..3,linecolor=black);or several initial conditions:DEplot(eq,y(t),t=-3..3,[[y(1)=1],[y(2)=0]],y=-3..3,linecolor=black);
<Text-field layout="Heading 1" style="Heading 1">Here you can play with explicit and implicit differentiations. Notice also the effects of a different syntax.</Text-field>diff(sin(x),x);implicitdiff(x-sin(x*y)=1,y,x);implicitdiff(x-sin(x*y)=1,y,x):diff(y(x),x)=%;implicitdiff(x-sin(x*y)=1,y,x): diff(y(x),x)=%;
<Text-field layout="Heading 1" style="Heading 1">Here you have an example of cheking whether a given function satisfies the equation: </Text-field>deq:=diff(p(y),y)-p(y)=y^2;p:=y->y^3-1;simplify(deq);
<Text-field layout="Heading 1" style="Heading 1">An example on numeric dsolve solution, including using a range, so odeplot defaults to that range: </Text-field>de:=D(y)(x) = x*y(x);p:= dsolve({D(y)(x) = y(x), y(0)=1},type=numeric, range=-5..2):odeplot(p);
<Text-field layout="Heading 1" style="Heading 1">An example of solving a problem from the Lab Manual, page 26, pr. 5 c: </Text-field> dsolve. Find x>0 where the solution has value 1 and evaluate NiMtSSJ5RzYiNiNJI3BpR0Yl. de:=x*diff(y(x),x)+(x+1)*y(x)=x;sol:=dsolve({de,y(ln(2))=1},y(x)); simplify(sol);subs(x=Pi,rhs(sol));evalf(%);solve(rhs(sol)=1);