Tải bản đầy đủ - 0 (trang)
Chapter 2. First-Order Ordinary Differential Equations

Chapter 2. First-Order Ordinary Differential Equations

Tải bản đầy đủ - 0trang

42



Chapter 2 First-Order Ordinary Differential Equations



containing the point x0 , y0 , there exists an interval x x0 < h centered at x0 on which

there exists one and only one solution to the differential equation that satisfies the initial

condition.

Often, we can use the command

DSolve[{y’[x]==f[x,y[x]],y[x0]==y0},y[x],x]

to solve the initial-value problem (2.1);

DSolve[y’[x]==f[x,y[x]],y[x],x]

f x, y .



attempts to find a general solution of y



EXAMPLE 2.1.1: Solve the initial-value problem

dy/ dx

y 0



x/ y

0.



Does this result contradict the Existence and Uniqueness Theorem?



SOLUTION: This equation is solved with DSolve to determine the

family of solutions y2 x2 C.

In[74]:= Clear x, y

DSolve y x



Out[74]=



y x



x

,y x ,x

y x

x2



2C 1



, y x



x2



2C 1



We note that the graph of y2 x2

C for various values of C is the

same as the graph of the level curves of f x, y

y2 x2 . Members of

this family corresponding to C

40, 38, . . . , 38, 40 are graphed with

ContourPlot in Figure 2-1.

In[75]:= cvals



Table i, i, 40, 40, 2



In[76]:= ContourPlot y2 x2 , x, 6, 6 , y, 6, 6 ,

PlotPoints 120, Contours > cvals,

ContourShading False



Application of the initial condition yields 02 02 C, so C 0. There0, so there

fore, solutions that pass through 0, 0 , satisfy y2 x2



2.1 Theory of First-Order Equations: A Brief Discussion



43



6



4



2



0



-2



-4



-6

-6



-4



-2



Figure 2-1 Plot of f x, y



0



2



4



6



C for various values of C



are two solutions, y x and y

x, that satisfy the differential equation and the initial condition. Although more than one solution satisfies

this initial-value problem, the Existence and Uniqueness Theorem is not

contradicted because the function f x, y

x/ y is not continuous at the

point 0, 0 ; the requirements of the theorem are not met.



EXAMPLE 2.1.2: Verify that the initial-value problem dy/ dx

1 has a unique solution.



y, y 0



SOLUTION: In this case, f x, y

y, x0

0, and y0

1. Hence, both

f and f / y 1 are continuous on all rectangular regions containing

0, 1 . Therefore by the Existence and Uniqueness

the point x0 , y0

Theorem, there exists a unique solution to the differential equation that

satisfies the initial condition y 0

1.

We can verify this by solving the initial-value problem. The unique

solution is y ex , which is computed with DSolve and then graphed



44



Chapter 2 First-Order Ordinary Differential Equations



2.5

2

1.5

1

0.5



-1



-0.5



0.5



Figure 2-2 Plot of y



1



ex



with Plot in Figure 2-2. Notice that the graph passes through the point

0, 1 , as required by the initial condition.

In[77]:= Clear x, y, sol



Out[77]=



sol DSolve

x

y x



y x



y x ,y 0



1 ,y x ,x



In[78]:= Plot y x /. sol, x, 1, 1



EXAMPLE 2.1.3: Show that the initial-value problem

dy

dx

y 0

x



y



x2 cos x



0



has infinitely many solutions.

SOLUTION: Writing xy



y

dy

dx



x2 cos x in the form y

x2 cos x

x



f x, y results in



y



and because f x, y

x2 cos x y / x is not continuous on an interval

containing x 0, the Existence and Uniqueness Theorem does not guarantee the existence or uniqueness of a solution. In fact, using DSolve

we see that a general solution of the equation is y x sin x Cx and for

every value of C, y 0

0.



2.1 Theory of First-Order Equations: A Brief Discussion



45



10

7.5

5

2.5



-10



-5



5



10



-2.5

-5

-7.5

-10

Figure 2-3



Every solution satisfies y 0



0



In[79]:= Clear y



Out[79]=



y x

sol DSolve x y x

y x

xC 1

x Sin x



xˆ2 Cos x , y x , x



We confirm this graphically by graphing several solutions. First, we use

Table to define toplot to be a set of functions obtained by replacing

the arbitrary constant in y x by 4, 3, . . . , 3, 4.

In[80]:= toplot Table sol 1, 1, 2 /.C 1

i, 4, 4

Out[80]=

4 x x Sin x , 3 x x Sin x , 2 x

x x Sin x , x Sin x , x x Sin x

2 x x Sin x , 3 x x Sin x , 4 x x



> i,

x Sin x ,

,

Sin x



These functions are then graphed with Plot in Figure 2-3.

In[81]:= Plot Evaluate toplot , x, 10, 10 ,

PlotRange > 10, 10 , AspectRatio > 1



46



Chapter 2 First-Order Ordinary Differential Equations



2.2 Separation of Variables

Definition 5 (Separable Differential Equation). A differential equation that can be

f x or g y dy

f x dx is called a separable differential

written in the form g y y

equation.

Separable differential equations are solved by collecting all the terms involving

y on one side of the equation, all the terms involving x on the other side of the

equation, and integrating:

g y dy



f x dx



g y dy



f x dx



C,



where C is a constant.



EXAMPLE 2.2.1: Show that the equation

dy

dx



2 y 2y

x



is separable, and solve by separation of variables.



SOLUTION: The equation y

be written in the form



2 y



1

dy

2 y 2y



2y / x is separable because it can

1

dx.

x



To solve the equation, we integrate both sides and simplify. Observe

that we can write this equation as

1

1

dy

2 y1

y



1

dx

x



C.



To evaluate the integral on the left-hand side, let u

1

dy. We then obtain

2 y

1

du

u

so that



ln u



ln x



1

dx

x



C1 . Recall that

ln



1

u



ln x



ln u

C1 .



1



y so du



C1

ln u



1



, so we have



2.2 Separation of Variables



47



Using Mathematica, we have

1

y

2 y 2y



In[82]:=

2



1



y

2



Out[82]=



y Log

y 2y



1



y



which we then simplify with Simplify.

2



In[83]:= Simplify

Out[83]=



Log



y



1



y Log



2



1



y



1



y



2y



Note that Log[x]

represents the natural

logarithm function,

y ln x.



y



The integral on the right-hand side of the equation is computed in the

same way.

1

x

x

Out[84]= Log x



In[84]:=



Simplification yields

1

u

where C2



eln x



C1



C2 x



eC1 . Resubstituting we find that

1

1



y



or



C2 x



x



C3

1



y



.



Solving for y shows us that

y



1

y

y



C

x

x C

x

x C

x



2



is a general solution of the equation y

same results with Mathematica,

In[85]:= Solve

Log

1

y

cons, y //Simplify

2 cons

cons

1

x

y

Out[85]=

2

x



2 y



2y / x. We obtain the



Log x

2



where E cons represents the arbitrary constant in the solution. We obtain

an equivalent result with DSolve. Entering



We use cons to represent

the arbitrary constant C to

avoid ambiguity with the

built-in symbol C.



48



Chapter 2 First-Order Ordinary Differential Equations



In[86]:= Clear x, y

y x



2



DSolve y x



gensol



2y x



,



x



y x ,x

Solve

ifun

Inverse functions are being used by Solve, so some solutions may not be

found.

2



C 1

2



Out[86]=



y x



x



x2



finds a general solution of the equation which is equivalent to the one

we obtained by hand and names the result gensol. The formula for

the solution, which is the second part of the first part of the first part

of gensol, is extracted from gensol with gensol[[1,1,2]]. Alternatively, if you are using Version 5, you can select, copy, and paste the

result to any location in the notebook.

In[87]:= gensol 1, 1, 2 //Simplify

2



C 1

2



Out[87]=



x



x2



To graph the solution for various values of C[1], which represents

the arbitrary constant in the formula for the solution, we use Table

together with ReplaceAll (/.) to generate a set of functions obtained

by replacing C[1] in the formula for the solution by i for i

3, 2.50,

. . . , 2.50, and 3, naming the resulting set of functions toplot. We view

an abbreviation of toplot with Short.

In[88]:= toplot Table gensol

i , i , 3, 3, 1/ 2



1, 1 , 2



/.C 1



Short toplot, 4

1



Out[88]=



2



x



3/2



1



,



x2



x



5/4



2



1



,



x2



x



2



1



,



x2



x



3/4



2



,



x2



2

1



x



1



,



x2

x



x2



x



2



x2



2



,



x2

3/ 4



,



x2

3/ 2



2



x



1/4



x



1



x

x2



2



,



x

x2



1/ 4



2



,



,



x2



2



,



x2

5/ 4



2



x



x



2



,



2.2 Separation of Variables



49



10



8



6



4



2



-4

Figure 2-4



-2

Various solutions of y



4



2

2 y



2y / x



We then graph the set of functions toplot with Plot in Figure 2-4.

In[89]:= Plot Evaluate toplot , x, 5, 5 ,

PlotRange > 0, 10 , AspectRatio



1



An initial-value problem involving a separable equation is solved through the

following steps.

1. Find a general solution of the differential equation using separation of

variables.

2. Use the initial condition to determine the unknown constant in the general

solution.



EXAMPLE 2.2.2: Solve (a) y cos x dx 1 y2 dy 0 and (b) the initial1.

value problem y cos x dx 1 y2 dy 0, y 0



SOLUTION: (a) Note that this equation can be rewritten as dy/ dx

y cos x / 1 y2 . We first use DSolve to solve the equation.



50



Chapter 2 First-Order Ordinary Differential Equations



In[90]:= sol1 DSolve y x

y x ,x



y x Cos x / 1



y x ˆ2 ,



InverseFunction

ifun

Inverse functions are being used. Values may be lost for multivalued

inverses.

Solve

ifun

Inverse functions are being used by Solve, so some solutions may not be

found.



Out[90]=



y x



ProductLog



y x



ProductLog



2C 1

2C 1



2 Sin x



,



2 Sin x



In this case, we see that DSolve is able to solve the nonlinear equation,

although the result contains the ProductLog function. Given z, the

Product Log function returns the principal value of w that satisfies z

wew . A more familiar form of the solution is found using traditional

techniques. Separating and integrating gives us

y2



1



dy



cos x dx



1

y



y dy



cos x dx



ln y



1 2

y

2



y



sin x



C.



We can also use Mathematica to implement the steps necessary to solve

the equation by hand. To solve the equation, we must integrate both

the left and right-hand sides which we do with Integrate, naming

the resulting output lhs and rhs, respectively.

In[91]:= lhs

rhs



Integrate



1



yˆ2 /y, y



Integrate Cos x , x



2



y

Log y

2

Out[91]= Sin x



Out[91]=



1 2

Therefore, a general solution to the equation is ln y

sin x C.

2y

1 2

sin x C in Figure 2-5

We now use ContourPlot to graph ln y 2 y

for various values of C by observing that the level curves of f x, y

1 2

1 2

sin x correspond to the graph of ln y

sin x C for

ln y

2y

2y

various values of C.



2.2 Separation of Variables



51



10



8



6



4



2



0

0



4



2



1 2

y

2



Figure 2-5 Plot of ln y



6



sin x



8



10



C for various values of C



In[92]:= ContourPlot lhs rhs, x, 0, 10 , y, 0, 10 ,

Contours > 30, PlotPoints > 150,

ContourShading > False



By substituting y 0

1 into this equation, we find that C

implicit solution is given by ln y 12 y2 sin x 1/ 2.



1/ 2, so the



In[93]:= Clear x, y, c

In[94]:= Solve Evaluate lhs

x > 0, y > 1 , c

1

Out[94]=

c

2



rhs



c /.



We can also use DSolve to solve the initial value problem as well. The

solution is then graphed in Figure 2-6 with Plot.

In[95]:= sol2

Out[95]=



y x



DSolve

y 0



y x

y x Cos x / 1

1 ,y x ,x



ProductLog



1 2 Sin x



In[96]:= Plot y x /.sol2, x, 0, 10



y x ˆ2 ,



52



Chapter 2 First-Order Ordinary Differential Equations



1.4



1.2



4



2



6



8



10



0.8



0.6



Figure 2-6 Plot of the solution that satisfies y 0



1



EXAMPLE 2.2.3: Solve each of the following equations: (a) y

0; (b) y Αy 1 K1 y , K, Α > 0 constant.



y2 sin t



SOLUTION: (a) The equation is separable:

1

dy

y2

1

dy

y2

1

y

y



sin t dt

sin t dt

cos t



C



1

.

cos t C



We check our result with DSolve.

In[97]:= sola

Out[97]=



DSolve y t

y t ˆ2 Sin t

1

y t

C 1

Cos t



0, y t , t



Observe that the result is given as a list. The formula for the solution is

the second part of the first part of the first part of sola.

In[98]:= sola

Out[98]=



C 1



1, 1, 2

1

Cos t



We then graph the solution for various values of C with Plot in

Figure 2-7.



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Chapter 2. First-Order Ordinary Differential Equations

Tải bản đầy đủ ngay(0 tr)

×