A DE Example
Second order, nonhomogeneous, constant coefficient
Here are some maple commands to assist you in solving a second order, constant coefficient, nonhomogeneous differential equation. The equation being solved is
First I will factor the operator.
> | factor(2*D^2+7*D+6); |
Or I could solve the auxiliary equation.
> | solve({2*m^2+7*m+6=0},{m}); |
Thus the general solution to the corresponding homogeneous equation would be
.
The form for a particular solution would be y[p] =
.
Assign this the name f.
> | f:=A*sin(t)+B*cos(t); |
Substitute f in for y in the left side of the original differentail equation.
> | 2*diff(f,t,t)+7*diff(f,t)+6*f; |
Set the expression above equal to the right side of the differential equation and equate coefficients of like terms to get
4A - 7B = 2 and 7A + 4B = 0.
Solve this system of equations.
> | solve({4*A-7*B=2,7*A+4*B=0},{A,B}); |
The general solution would be
.
Below is Maple's solution to the ODE.
Can you see that it agrees with the solution given above?
> | ode1:={2*diff(y(t),t,t)+7*diff(y(t),t)+6*y(t)=2*sin(t)}; |
> | dsolve(ode1); |
Here we put in some initial conditions.
> | ic:={y(0)=3,D(y)(0)=0}; |
> | dsolve(ode1 union ic,y(t)); |
Here is some alternative syntax for solving the same differential equation along with initial conditions.
> | ode2:=2*diff(y(t),t$2)+7*diff(y(t),t)+6*y(t)=2*sin(t); |
> | ic2:=y(0)=3,D(y)(0)=0; |
> | dsolve({ode2,ic2},{y(t)}); |
Here are the graphs of the transient solution (in green), steady state solution (in blue), and the solution (in red).
> | with(plots): |
> | Transient:=plot((-47/5)*exp(-2*t)+(164/13)*exp(-3*t/2),t=0..4*Pi,y=-2..4,thickness=3,color=green): |
> | SteadyState:=plot((8/65)*sin(t)-(14/65)*cos(t),t=0..4*Pi,y=-2..4,thickness=3,color=blue): |
> | Solution:=plot((-47/5)*exp(-2*t)+(164/13)*exp(-3*t/2)+(8/65)*sin(t)-(14/65)*cos(t),t=0..4*Pi,y=-2..4,thickness=3,color=red): |
> | display(Transient,SteadyState,Solution); |
> |