Systems with External Driving Force
>
Example 2. The first thing you should know about nonhomogeneous equations and Maple is the following: Maple uses a different algorithm to find particular solutions of nonhomogeneous equations than the method of undetermined coefficients that we are familiar with. More specifically, it uses the so called method of variation of parameters. Hence, often you will see a solution to a nonhomogeneous ODE that looks different from what you would obtain by hand.
> ODE2:=diff(y(t),t$2)+9*y(t)=cos(2*t);
>
> dsolve(ODE2,y(t)); nexpr1:=rhs(%);
>
The solution looks different, and actually is more complicated than the solution that can be obtained by the method of undetermined coefficients. We can often simplify the solution a great deal with the combine(expression,trig); command. Here is how it works.
> snexpr1:=combine(nexpr1,trig);
>
The combine(expression,trig); command tells Maple to combine terms of a given expression using trigonometric identities. The simplification gave us the solution that we would have obtained by undetermined coefficients.
>
Example 3. Actually you can find a particular solution of a nonhomogeneous equation by the method of undetermined coefficients "by hand", using Maple to perform algebraic operations.
In this example, we derive a general formula for a particular solution to the following equation, which we label ODEP:
(ODEP) my''(t)+cy'(t)+ky(t)=Fcos(wt) .
The equation describes a system, for example a mass-spring system, subject to a sinusoidal external driving force Fcos(wt). (For simplicity's sake, we use "w" instead of the more customary omega "
".) Assume that the constants m, c, k, F, and w are given, c > 0. We know that the equation has a particular solution in the form
parsol(t) = Acos(wt)+Bsin(wt)
for some constants A, B. We shall derive formulas for A and B in terms of m, c, k, F and w. You are supposed to use these formulas for A and B in Problem 3 of your homework set in the next section.
> ODEP:=m*diff(y(t),t$2)+c*diff(y(t),t)+k*y(t)=F*cos(w*t);
>
First, we substitute parsol(t) into ODEP and simplify.
> pexpr1:=simplify(subs(y(t)=A*cos(w*t)+B*sin(w*t),ODEP));
>
Now, we group terms containing sine and cosine, respectively.
> collect(pexpr1,{cos(w*t),sin(w*t)});
>
We set and solve the corresponding equations for coefficients A, B.
> solve({-m*B*w^2-c*A*w+B*k=0,-m*A*w^2+c*B*w+k*A=F},{A,B});
>
We define A and B and parsol according to the solutions for A and B that we have obtained.
> A:=-F*(m*w^2-k)/(m^2*w^4-2*m*w^2*k+c^2*w^2+k^2);
>
> B:=F*c*w/(m^2*w^4-2*m*w^2*k+c^2*w^2+k^2);
>
Hence, the particular solution to ODEP that we obtained by the method of undetermined coefficients is
> parsol:=A*cos(wt)+B*sin(wt);
>
The formula can be used, for example, to determine the input frequency
that causes the so called practical resonance. Again, rather complicated algebraic operations necessary to accomplish that (see our text, p. 116) can be easily performed by Maple.