MATH528Due date: 08/29/18

Homework 01 Solution

Follow this model when solving your homework.

8 exercises x .25 = 2 points, 4 problems x .5 = 2 points, 1 project x 1 points = 1 point

1Exercises

Exercise 1. PS1.1.4

Solution. y'=-1.5y is: 1st-order, explicit, linear, separable ODE

dydx=-1.5ydyy=-1.5dxdyy=-1.5dx+lnAlny=-1.5x+lnAy(x)=Ae-1.5x

In[19]:=

ODE = y'[x]==1.5y[x]

y'(x)=1.5y(x)

In[20]:=

DSolve[ODE,y[x],x]

{{y(x)c1e1.5x}}

In[21]:=

Exercise 2. PS1.1.6

Solution. y''=-y is: 2nd-order, explicit, linear, solve by finding roots of characteristic equation r2+1=0

r1,2=±iy(x)=aeix+be-ix=Asin(x)+Bcos(x)

In[21]:=

ODE = y”[x]==-y[x]

y''(x)=-y(x)

In[22]:=

DSolve[ODE,y[x],x]

{{y(x)c2sin(x)+c1cos(x)}}

In[23]:=

Exercise 3. PS1.1.7

Solution. y'=cosh(5.13x) is: 1st-order, explicit, linear, separable ODE

In[23]:=

ODE = y'[x]==Cosh[5.13x]

y'(x)=cosh(5.13x)

In[24]:=

DSolve[ODE,y[x],x]

{{y(x)c1+0.194932sinh(5.13x)}}

In[25]:=

Exercise 4. PS1.1.8

Solution. y'''=e-0.2x is: 3rd-order, explicit, linear, separable ODE

In[25]:=

ODE = y”'[x]==Exp[-0.2x]

y(3)(x)=e-0.2x

In[26]:=

DSolve[ODE,y[x],x]

{{y(x)c3x2+c2x+c1-125.e-0.2x}}

In[27]:=

Exercise 5. PS1.3.3

Solution. y'=sec2y is: 1st-order, explicit, non-linear, separable ODE

dysec2y=cos2ydy=dxcos2ydy=x+c

From trigonometric identity cos(2y)=cos2y-sin2y=2cos2y-1cos2y=12(cos(2y)+1), so

cos2ydy=14sin(2y)+y2=x+c.

In[63]:=

ODE = y'[x]==Sec[y[x]]^2

y'(x)=sec2(y(x))

In[64]:=

DSolve[ODE,y[x],x]

{{y(x)InverseFunction[2(#12+14sin(2#1))&][c1+2x]}}..

In[65]:=

Integrate[Cos[y]^2,y]

y2+14sin(2y)

In[66]:=

Exercise 6. PS1.3.4

Solution. y'sin2πx=πycos2πx is: 1st-order, explicit, non-linear, separable ODE

y'y=πcos2πxsin2πx=πcot2πxdyy=πcot2πxdx=12d(log(sin2πx))logy=12log(sin2πx)+logc
y(x)=csin2πx.

In[67]:=

ODE = y'[x]==Pi y[x] Cos[2Pi x]/Sin[2 Pi x]

y'(x)=πy(x)cot(2πx)

In[68]:=

DSolve[ODE,y[x],x]

{{y(x)c1sin(2πx)}}

Exercise 7. PS1.3.5

Solution. yy'+36x=0 is: 1st-order, explicit, non-linear, separable ODE

12dy2=-36xdxy22=-18x2+c

In[69]:=

ODE = y[x] y'[x]+36 x ==0

y(x)y'(x)+36x=0

In[70]:=

DSolve[ODE,y[x],x]

{{y(x)-2c1-18x2},{y(x)2c1-18x2}}

In[71]:=

Exercise 8. PS1.3.5

Solution. yy'+36x=0 is: 1st-order, explicit, non-linear, separable ODE

12dy2=-36xdxy22=-18x2+c

In[69]:=

ODE = y[x] y'[x]+36 x ==0

y(x)y'(x)+36x=0

In[70]:=

DSolve[ODE,y[x],x]

{{y(x)-2c1-18x2},{y(x)2c1-18x2}}

In[71]:=

2Problems

Problem 1. PS1.2.2

Solution. F(x,y,y')=yy'+4x=0, is 1st-order, non-linear, separable, trivially implicit since F=0 can easily be solved to find y'=f(x,y)=-4x/y. Note that f(x,y) is not Lipschitz continuous, hence existence of a unique solution is not guaranteed.

In[15]:=

f[x_,y_]=-4x/y

-4xy

In[16]:=

ODE = y'[x]==f[x,y[x]]

y'(x)=-4xy(x)

In[17]:=

DSolve[ODE,y[x],x]

{{y(x)-2c1-2x2},{y(x)2c1-2x2}}

In[18]:=

From Slide8Lesson01

In[18]:=

Off[DSolve::bvnul];

sol1[x_] = y[x] /. DSolve[{ODE,y[1]==1},y[x],x][[1,1]];

sol2[x_] = y[x] /. DSolve[{ODE,y[0]==2},y[x],x][[1,1]];

{sol1[x],sol2[x]}

{5-4x2,21-x2}

In[19]:=

From Slide8Lesson01:

In[20]:=

DirectionField = VectorPlot[{1,f[x,y]},{x,0,1.25},{y,0,2.5},Axes->True,Frame->False,ImageSize->Large,VectorScale->.3,VectorMarkers->None];

SolutionPlot = Plot[{sol1[x],sol2[x]},{x,0,1.25},ImageSize->Large];

plots=Show[{SolutionPlot,DirectionField}];

Export["/home/student/courses/MATH528/HW01Fig01.pdf",plots]

/home/student/courses/MATH528/HW01Fig01.pdf

In[21]:=

Figure 1. PS1.2.2 direction field and solutions passing through (1,1),(0,2)

Problem 2. PS1.2.3

Solution. y'=f(y)=1-y2 is: 1st-order, explicit, non-linear

In[21]:=

f[x_,y_]=1-y^2;

ODE = y'[x]==f[x,y[x]]

y'(x)=1-y(x)2

In[22]:=

DSolve[ODE,y[x],x]

{{y(x)e2x-e2c1e2c1+e2x}}

In[23]:=

Off[Solve::ifun];

sol1[x_] = y[x] /. DSolve[{ODE,y[0]==0},y[x],x][[1,1]];

sol2[x_] = y[x] /. DSolve[{ODE,y[2]==1/2},y[x],x][[1,1]];

{sol1[x],sol2[x]}

{e2x-1e2x+1,3e2x-e43e2x+e4}

In[24]:=

Direction field and solutions

In[24]:=

DirectionField = VectorPlot[{1,f[x,y]},{x,0,2},{y,-1,1},Axes->True,Frame->False,ImageSize->Large,VectorScale->.051,VectorMarkers->None,VectorStyle->Pink];

SolutionPlot = Plot[{sol1[x],sol2[x]},{x,0,2},ImageSize->Large];

plots=Show[{SolutionPlot,DirectionField}];

Export["/home/student/courses/MATH528/HW01Fig02.pdf",plots]

/home/student/courses/MATH528/HW01Fig02.pdf

In[25]:=

Figure 2. PS1.2.2 direction field and solutions passing through (1,1),(0,2)

Problem 3. PS1.1.16

Solution. y'2-xy'+y=0 is 1st-order, non-linear, implicit. Verify solutions y(x)=c(x-c), y(x)=x2/4

In[1]:=

ODE = y'[x]^2 - x y'[x] + y[x] == 0

y'(x)2-xy'(x)+y(x)=0

In[5]:=

sol1[x_]=c(x-c)

c(x-c)

In[6]:=

Simplify[ODE /. y->sol1]

True

In[7]:=

sol2[x_]=x^2/4

x24

In[8]:=

Simplify[ODE /. y->sol2]

True

In[9]:=

DSolve[ODE,y[x],x]

{{y(x)c1x-c12}}

In[10]:=

DSolve[{ODE,y[0]==0},y[x],x]

{{y(x)0}}

In[11]:=

Singular solution y(x)=x2/4 is the envelope of all particular solutions.

Problem 4. PS1.1.18

Solution. Decay follows law y'=-ky with solution y(t)=e-kty(0), The half-life τ satisfies equation

y(τ)y(0)=12=e-kτ-kτ=-log2k=log23.6[1day]

After 1 day y(1)=exp[-log23.6×1]×1[gram]=.825[gram]. After 1 year y3×10-31[gram], undetectable since a single atom would weigh 224amu=224×1.66×10-24gram

In[11]:=

k=Log[2.]/3.6; y[t_,y0_]=Exp[-k t] y0

e-0.192541ty0

In[12]:=

y[1.,1.]

0.824861

In[13]:=

y[365.25,1.]

2.870769718761845`*^∧-31

In[14]:=

224 1.66 10^(-24)

3.7184`*^∧-22

In[15]:=

3Projects

3.1PS2.1.16

(a) The larger field suggests a pole in quadrant II

In[28]:=

f[x_,y_] = x + y;

DirectionField = VectorPlot[{1,f[x,y]},{x,-5,2},{y,-1,5},Axes->True,Frame->False,ImageSize->Large,VectorScale->.051,VectorMarkers->None,VectorStyle->Pink];

Export["/home/student/courses/MATH528/HW01Fig03.pdf",DirectionField]

/home/student/courses/MATH528/HW01Fig03.pdf

In[29]:=

Figure 3. Direction field of ODE y'=x+y

(b) From x2+9y2(x)=c differentiation by x gives x+9yy'=0y'=-x/(9y)

In[35]:=

f[x_,y_] = -x/(9y);

DirectionField = VectorPlot[{1,f[x,y]},{x,-3,3},{y,0,3},Axes->True,Frame->False,VectorMarkers->None,VectorScale->.051,VectorStyle->Pink,AspectRatio->Automatic];

Export["/home/student/courses/MATH528/HW01Fig04.pdf",DirectionField]

/home/student/courses/MATH528/HW01Fig04.pdf

In[36]:=

Figure 4. Direction field of ODE y'=-x/(9y)

Figure Implicit equation ODE
circles x2+y2=c x+yy'=0
hyperbolas xy=c y+xy'=0
parabolas y=x2+c y'=2x

Table 1. ODEs corresponding to conics

(c) From Table 1, solutions to y'=-x/y are circles. Confirm by drawing direction field

In[38]:=

f[x_,y_] = -x/y;

DirectionField = VectorPlot[{1,f[x,y]},{x,-2,2},{y,0,2},Axes->True,Frame->False,VectorMarkers->None,VectorScale->.1,VectorStyle->Pink,AspectRatio->Automatic];

Export["/home/student/courses/MATH528/HW01Fig05.pdf",DirectionField]

/home/student/courses/MATH528/HW01Fig05.pdf

In[39]:=

Figure 5. Direction field of ODE y'=-x/(9y)

(d) Solutions to y'=-y/2 are exponentials. Confirm by drawing direction field

In[39]:=

f[x_,y_] = -y/2;

DirectionField = VectorPlot[{1,f[x,y]},{x,-2,2},{y,-2,2},Axes->True,Frame->False,VectorMarkers->None,VectorScale->.1,VectorStyle->Pink,AspectRatio->Automatic];

Export["/home/student/courses/MATH528/HW01Fig06.pdf",DirectionField]

/home/student/courses/MATH528/HW01Fig06.pdf

In[40]:=

Figure 6. Direction field of ODE y'=-x/(9y)