Differentiation and Integration
| > | diff(sin(cos(x)*exp(x)),x); |
| > | diff(sin(cos(x)*exp(x)),[x,x]); |
| > | int(sin(x)^4*cos(x)^5,x); |
Form a differential equation (note that we write y(t) consistently!)
| > | de:=diff(y(t),t)=2*(1-y(t)/3)*y(t); |
Load packages used for differential equations and plots (trailing colon leaves out output)
| > | with(plots):with(DEtools): |
Warning, the name changecoords has been redefined
plot a direction field. (The plot is a data structure we do not want to see immediately)
| > | fplot:=dfieldplot(de,y(t),t=0..10,y=-3..5,arrows=SLIM): |
| > | display(fplot); |
Solve a differential equation using `dsolve'
| > | sol:=dsolve(de); |
Solve an IVP symbolically
| > | sol:=dsolve({de,y(0)=0.1}); |
Numerical solution of an IVP
| > | sol:=dsolve({de,y(0)=0.1},numeric,range=0..10); |
and plot the result
| > | display(odeplot(sol,t=0..10)); |
Plot together with directionfield
| > | display(odeplot(sol,color=blue,thickness=4),fplot); |
Evaluate the solution
| > | sol(5); |