# Math 2250 # Fall 2000 Project 1 # Hints # # This file can be downloaded from # http://www.math.utah.edu/~korevaar/2250proj1hints.txt. After # downloading it you can open it from Maple, using File/Open from the # menu options, specifying the file type in the bottom dialog box to be # "Maple Text." The file will not contain the Maple output which you # see in the hard copy. You will recover the output as you go through # the document, by executing the commands. (Execute commands by moving # the cursor into the command field and hitting return.) # This file contains the Maple commands corresponding to the # equations and text on page 43 of Edwards-Penney. We label equations # consistently with their numbering there, so for example, we denote # equation (2) on page 43 by eqtn2. For example, the ``colon equals'' # command below defines eqtn2 to be the equation dx/dt = .01x - # .0001x^2. Notice that when you write a differential equation in Maple # you must denote the unknown function as a function of its variable, # e.g. x(t) below rather than just x, and that you must multiply using # "*". You should execute the commands below to see what they do, and # follow along with your textbook. # For further information about syntax and options use the help # menu button at the upper right corner of your Maple window. # > with(DEtools); #load diffeq tools, for later. If you don't want > #to see the list of possible commands in the DEtools > # package, end your command with ":" rather than ";" > eqtn2:= diff(x(t),t) = 0.01*x(t) - 0.0001*(x(t))^2; > d 2 eqtn2 := -- x(t) = .01 x(t) - .0001 x(t) dt > rhs(eqtn2); #extract the right hand side of eqtn2 > lhs(eqtn2); #left hand side of eqtn2 2 .01 x(t) - .0001 x(t) d -- x(t) dt > eqtn3:= Int(1/(x*(100-x)),x) = Int(1/10000,t); > #(capital) Int is the inert form of integration, i.e. > #it writes the integral but doesn't evaluate it. / / | 1 | eqtn3 := | ----------- dx = | 1/10000 dt | x (100 - x) | / / > eqtn4:=int(1/(x*(100-x)),x)=int(1/10000,t) + C; > #(lower case) int evaluates the integral, but doesn't > #put in the constant of integration, so we do# > . eqtn4 := 1/100 ln(x) - 1/100 ln(-100 + x) = 1/10000 t + C # # Digression: If you were doing this problem by hand you would need # to use partial fractions to evaluate the left hand side of eqtn3. # Maple can also do partial fractions, using the convert command: # > convert(1/(x*(100-x)),parfrac,x); > #convert 1/(x*(100-x) to partial fractions > int(%,x); #then integrate what you have, with respect to x 1 1/100 1/x - 1/100 -------- -100 + x 1/100 ln(x) - 1/100 ln(-100 + x) # # To figure out the constant C in eqtn4 in terms of initial # condition x(0)=x0, we use the substitution command "subs", and the # algebraic equation solver "solve". In a few steps this leads to # eqtn5: # > eqtn4a:=subs({t=0,x=x0}, eqtn4); eqtn4a := 1/100 ln(x0) - 1/100 ln(-100 + x0) = C > C1:=solve(eqtn4a,C); C1 := 1/100 ln(x0) - 1/100 ln(-100 + x0) > eqtn4b:=subs(C=C1,eqtn4); eqtn4b := 1/100 ln(x) - 1/100 ln(-100 + x) = 1/10000 t + 1/100 ln(x0) - 1/100 ln(-100 + x0) > eqtn5:= x=solve(eqtn4b,x); #equation (5) on page 43 x0 exp(1/100 t) eqtn5 := x = 100 -------------------------- 100 - x0 + x0 exp(1/100 t) # Maple can solve the initial value problem we began with in a # single command "dsolve". However, there are times when you need to # guide MAPLE towards a solution by breaking the problem into smaller # pieces, as we have done above. If you loaded the DEtools library # (the first command in this file), then try these commands: (the answer # doesn't look exactly the same as eqtn5 but you should convince # yourself it actually is.) > diffeq:=diff(x(t),t)=.01*x(t) - .0001*(x(t))^2; > dsolve({diffeq, x(0)=x0},x(t)); d 2 diffeq := -- x(t) = .01 x(t) - .0001 x(t) dt 1 x(t) = 100 ------------------------------ exp(- 1/100 t) (-100 + x0) 1 - -------------------------- x0 # From eqtn5, or equivalently from the output of dsolve, we see # that x(t) approaches 100 as t goes to infinity, as the book suggests # on the top of page 44. Do you see this? # Here is a sample problem of the sort you might make up in part C # of the INVESTIGATION: How long it would take an initial population of # 10 to reach a size of 90? (Depending on our population units, the # number 10 could be standing for 10 thousand people, or 10 grams of # mold etc.) # Here would be one way to solve the sample problem on the # computer: # > eqtn6:=subs(x0=10,eqtn5); #set initial value = 10 > eqtn7:=subs(x=90,eqtn6); #set x equal to 90 > ans:=solve(eqtn7,t); #solve for t when x=90 > evalf(ans); #get decimal value of ans. # # Final comment: To generate the direction field and some # trajectories in part (a) of the investigation use the "DEplot" # command, as demonstrated in the last page of the 2250tutorial # (http://www.math.utah.edu/~korevaar/2250tutorial.txt). For example, # try this to get an idea of the possibilities: > DEplot(diffeq,x(t),t=0..1000, {[x(0)=10],[x(200)=150]}, > x=0..200, color=`black`, linecolor=`black`, > arrows=`line`, dirgrid=[30,30]);