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(D^2-2*D-8); |
Or I could solve the auxiliary equation.
> | solve({m^2-2*m-8=0},{m}); |
Thus two linearly independent solutions to the complementary equation (solutions to the corresponding homogeneous equation) are y[i] =
.
The form for a particular solution would be y[p] =
.
Assign this the name f.
> | f:=A*exp(x)+B*exp(-x); |
Substitute f in for y in the left side of the original differentail equation.
> | diff(f,x,x)-2*diff(f,x)-8*f; |
Set the expression above equal to the right side of the differential equation and equate coefficients of like terms to get
-9A = 2 and -5B = -1.
Solve this system of equations.
> | solve({-9*A=2,-5*B=-1},{A,B}); |
The general solution would be
y = C[1]*e^(-2*x) + C[2]*e^(4*x) - (2/9)*e^x + (1/5)*e^(-x).
Below is Maple's solution to the ODE.
Can you see that it agrees with the solution given above?
> | ode1:={diff(y(x),x,x)-2*diff(y(x),x)-8*y(x)=2*exp(x)-exp(-x)}; |
> | dsolve(ode1); |
Here we put in some initial conditions.
> | ic:={y(0)=0,D(y)(0)=1}; |
> | dsolve(ode1 union ic,y(x)); |
Here is some alternative syntax for solving the same differential equation along with initial conditions.
> | ode2:=diff(y(x),x$2)-2*diff(y(x),x)-8*y(x)=2*exp(x)-exp(-x); |
> | ic2:=y(0)=0,D(y)(0)=1; |
> | dsolve({ode2,ic2},{y(x)}); |
> |