Derivatives 215 problem 02.mws

1. Plotting slope fields and solution curves.

If we consider a differential equation of the form D(y)(x) = f(x,y) , this information tells you a slope at each point in the x*y -plane, so one way to visualize solutions to the differential equation is to plot a small line segment at various points in the plane, whose slope is equal to f(x,y) . A solution to the differential equation will have the property that the line segments will be tangent to the curves. While this procedure could, in principle, be carried out by hand, we can draw hundreds of such tiny line segments quickly with the computer, and they guide our eye in visualizing what solution curves look like. For example, consider the following differential equation.

> deq:=D(y)(x)=x*y+2*x;

deq := D(y)(x) = x*y+2*x

Let us plot the slope fields to this curve over a region given by x = -3 .. 3 , y = -3 .. 3 . For simplicity let us give these ranges names.

> xrange:=-3..3;yrange:=-3..3;

xrange := -3 .. 3

yrange := -3 .. 3

We need to load the package DEtools . Then we can use the dfieldplot command to plot solutions to the differential equation.

> with(DEtools):

> dfieldplot(deq,y(x),x=xrange,y=yrange);

Warning, y is present as both a dependent variable and a name. Inconsistent specification of the dependent variable is deprecated, and will be removed in the next release.

[Maple Plot]

It is very easy to get an impression of what the solution curves look like from the picture. We can also plot solution curves corresponding to certain initial conditions on the same plot. For example, suppose we want to specify curves satisfying the following initial conditions.

> initcond:=[[y(1)=1],[y(1)=2],[y(1)=-1],[y(1)=-2],[y(1)=-2.2]];

initcond := [[y(1) = 1], [y(1) = 2], [y(1) = -1], [...

We have specified 4 different choices of initial conditions, and given the list of these choices a name. We can use this name to plot the solutions satisfying these conditions on the same plot. We use the DEplot command to do this.

> DEplot(deq,y(x),x=xrange,y=yrange,initcond,linecolor=blue);

Warning, y is present as both a dependent variable and a name. Inconsistent specification of the dependent variable is deprecated, and will be removed in the next release.

[Maple Plot]

Submission:

For each of the differential equations below, plot the slope fields and some representative solution curves on the same plot. Determine whether the differential equation is separable.

1) D(y)(x) = y-x^2 .

2) D(y)(x) = -2*x*y/(1+x^2) .

3) D(y)(x) = (1-x)*y+x/2 .

Submission worksheet:

 

2. Solving differential equations with initial conditions:

Although this section is mainly about separable differential equations, these are not the only kind of differential equations that can be solved. For example, consider the first order differential equation D(y)(x) = 1-y/x . In order to write this differential equation in a form in which Maple can solve it, it is necessary to express y as a function y(x) on the right hand side of the equation. Thus we ask Maple to solve the following.

> deq:=D(y)(x) = 1-y(x)/x;

deq := D(y)(x) = 1-y(x)/x

> dsolve(deq,y(x));

y(x) = 1/2*x+1/x*_C1

Maple has found the general solution to this differential equation in terms of the unknown constant _C1 . (Recall that Maple names the constants it introduces beginning with the underscore symbol, as this is unlikely to interfere with variables that you have named in your problem.) What if we wanted to solve this differential equation subject to the initial condition y(2) = 3/2 ? Then we would type in

> dsolve({deq,y(2)=3/2},y(x));

y(x) = 1/2*x+1/x

Of course, given the general solution, we could have solved for the unknown constant _C1 directly as follows.

> solve(subs(x=2,y(2)=3/2,y(x) = 1/2*x+_C1/x));

1

Submission:

Consider the differential equation D(y)(x) = x^2*sqrt(1-y^2) .

1) From the form of the differential equation, there is a natural restriction on the y values. State and explain this restriction.

2) Use Maple to solve this differential equation in general.

3) Explain how the general solution to this differential equation is consistent with your restriction in 1).

4) Find the solution to the differential equation which satisfies y(1) = 1/2 .

Submission worksheet:

 

3. Solving separable differential equations.

Consider the differential equation D(y)(x) = x^2*sqrt(1-y^2) of activity 3. This differential equation is separable, and we can rewrite it in the form dy/sqrt(1-y^2) = x^2*dx . We can then integrate the left and right hand sides of this equation.

> int(1/sqrt(1-y^2),y);

arcsin(y)

> int(x^2,x);

1/3*x^3

Thus we obtain the solution arcsin(y) = x^3/3+C . This solution is implicit, but we can solve for y explicitly to obtain the solution y = sin(x^3/3+C) . This example was very simple, because we could easily have done both integrals without the help of Maple.

Submission:

Consider the differential equation D(y)(x) = exp(2*x-y)/exp(x+y) .

1) Rewrite the differential equation by separating the variables.

2) Solve the separated differential equation by integrating the left and right hand sides. Then solve for y.

3) Solve the differential equation directly in Maple, using the dsolve command.

Submission worksheet:

 

4. Newton's Law of Cooling.

Let us state the differential equation for Newton's Law of cooling. Let H represent the temperature of an object at time t , and Hs represent the ambient temperature. (We assume that the effect of the cooling or heating of the object on the temperature of the surroundings is negligible.) Then the temperature is governed by the differential equation

D(H)(t) = -k*(H(t)-Hs) ,

where k is a constant (which is usually determined by experiment). Let us solve the differential equation subject to the initial condition H(0) = Ho .

> dsolve({D(H)(t) = -k*(H(t)-Hs),H(0)=Ho},H(t));

H(t) = Hs+exp(-k*t)*(-Hs+Ho)

Note that Hs and Ho are constants representing the ambient temperature and the temperature at time t = 0 . Therefore if we know the temperature of the object at some other time, we can solve for the constant of proportionality k , and then we can use this value to solve for the temperature of the object at any time.  

Let us suppose that a cake has temperature of 210 degrees F when it is removed from an oven, and that the room has an ambient temperature of 70 degrees F. After 30 minutes, the temperature of the cake is 140 degrees F. Let us use Maple to solve for the value of k , and then use this value to determine when the temperature of the cake will be 90 degrees F.

We have the following data. Ho = 210 , Hs = 70 , H(30) = 140 . If we substitute this information into the equation, we can solve for k. Note that in making the substitutions, the order of substitution is left to right, so you must make the substitution t=30 before the substitution H(30)=140.)

> subs(Ho=210,Hs=70,t=30,H(30)=140,H(t) = Hs+exp(-k*t)*(-Hs+Ho));

140 = 70+140*exp(-30*k)

> fsolve(%,k);

.2310490602e-1

Then we can substitute this value of k into the original equation to obtain the correct formula.

> subs(Ho=210,Hs=70,k=.2310490602e-1,H(t) = Hs+exp(-k*t)*(-Hs+Ho));

H(t) = 70+140*exp(-.2310490602e-1*t)

Then we can substitute H(t) = 90 in this equation to solve for t .

> subs(H(t)=90,%);

90 = 70+140*exp(-.2310490602e-1*t)

> fsolve(%,t);

84.22064766

Therefore, we have determined that it will take about 84 minutes before the cake has cooled to 84 degrees.

Submission:

Suppose that a cup of soup cooled from 90 degrees C to 60 degrees C after 10 minutes in a room whose temperature was 20 degrees C. Use Newton's Law of Cooling to answer the following questions.

1) How much longer would it take the soup to cool to 35 degrees C?

2) If instead of being left to stand in the room, the cup of soup is put in a freezer whose temperature is -15 degrees C, how long would it take the soup to cool to 35 degrees C? (Assume that the constant k you determined in part (1) is still valid.)

Submission worksheet: