Solution Assignment 1 (MATH246, Spring 2024)

Problem 1(a):

This is a linear ODE:
with (assuming ), multiply by integrating factor :
integrate:
(assuming )
initial condition gives and
This solution exists for . This justifies in retrospect the above assumptions.

Problem 1(b): and (i) , (ii)

This is a separable ODE with .
Find all y such that : is stationary (constant) solution.
Separate variables and integrate:
gives (assuming ).
initial condtion(i): and gives , hence
This solution exists for .
initial condition (ii): we get the constant solution , solution exists for
interval is also okay, but it is not clear what ODE means for .

Problem 1(c):

We can write this as , hence .
Check whether this is exact ODE: we need
We have and , hence ODE is exact, and we can find with .
gives where we still have to find the function .
gives (note that this does not depend on t), hence (no need for constant, we just need to find one function H). We obtain
Note: we could also first use and then , this gives the same result. Just "guessing" and then showing that it works is not acceptable.
We obtain the solution in implicit form . The initial condition gives gives .
Solution of IVP in implicit form: . This is a quadratic equation for y:
yielding
Plugging in gives , hence we need "+":
solution of IVP is , interval of existence is

Problem 1(d): ,

This is an ODE with and
Check whether this ODE is exact: need :
,
Hence this ODE is not exact.
Check whether integrating factor exists: we need that is independent of y.
Here we obtain which does depend on y. Hence no integrating factor exists.
Check whether integrating factor exists: we need that is independent of t.
Here we obtain which does not depend on t. Hence we can find an integrating factor by solving , i.e., yielding , , .
We now multiply the original ODE by the integrating factor and obtain
where we now have and
We now check :
, , hence this ODE is exact, and we can find with , .
gives where we still have to find the function .
gives (note that this does not depend on t), hence (no need for constant, we just need to find one function H). We obtain
Note: we could also first use and then , this gives the same result. Just "guessing" and then showing that it works is not acceptable.
The general solution in implicit form is . We plug in the initial condition and yielding .
Hence the solution of the IVP in implicit form is .
This is a quadratic equation for y: , the quadratic formula gives
Plugging in the initial condition gives , hence we need "+" for our initial condition.
Hence the solution of the IVP is . This solution exists as long as .
For large the term dominates, hence as or . We can find the local extrema of by solving : gives , yielding and . At these points we have the function values and . Therefore we have for all , hence the interval of existence is .

Problem 2(a)

We have for . These are the stationary (constant) solutions of the ODE.
g = @(y) y*(y-1)*(y-3);
fplot(g,[-.4,3.2]);
set(gca,'XAxisLoc','origin','YAxisLoc','origin'); box off % draw axes thru origin
xlabel('y'); title('function g(y) = y(y-1)(y-3)')
f = @(t,y) g(y);
dirfield(f,0:.2:2,-.4:.2:3.4)
xlabel('t'); ylabel('y'); title('direction field for y''=y(y-1)(y-3)')

Problem 2(b)

The function is zero for . These are the stationary points.
Note that the derivative exists at the stationary points . We can therefore use the theorem from class for and .
For we get ,
For we get ,
For we get . For increasing t the solution will tend to . There are two possibilities:
As explained in the hint on the ELMS page we have to check the improper integral . If this is infinite we have Case 1. If this is finite we have Case 2 with .
Here we get is finite, hence we have Case 2.
For we get . For increasing t the solution will tend to , this may either happen for (Case 1), or for (Case 2). For this we have to check the improper integral . With a similar argument as above we get that this integral is also finite, hence we have Case 2: the solution only exists for , and .

Problem 3(a)

We are given the ODE with and .
Check whether the ODE is exact:
,
We have , hence the ODE is exact, and we can find with , .
gives where we still have to find the function .
gives (note that this does not depend on x), hence (no need for constant, we just need to find one function H). We obtain
The general solution in implicit form is with .

Problem 3(b)

H = @(x,y) x^2*y^3+x+y^2;
Plot the general solution in implicit form using fcontour:
fcontour(H,[-2 2 -2.5 1.5],'LevelStep',.4); colorbar

Problem 3(c): initial conditions (i) , (ii)

We plug in
c1 = H(0,1)
c1 = 1
We plug in
c2 = H(0,-1)
c2 = 1
For both initial value problems we obtain the solution in implicit form . We can plot this using
fcontour(H,[xl,xr yl yr],'LevelList',c):
fcontour(H,[-2 2 -2.5 1.5],'LevelList',1); hold on
plot(0,1,'bo');
plot(0,-1,'bo');
hold off; grid on; xlabel('x'); ylabel('y')
We can see that the point is on this curve:
The gradient vector at the point is is horizontal. Since the gradient vector is orthogonal on the contour, the contour at this point is vertical.
By looking at this graph:

Problem 3(d)

We have , hence
with .
f = @(x,y) -(2*x*y^3+1)/(3*x^2*y^2+2*y);
dirfield(f,-2:.2:2,-2.5:.2:1.5);
hold on; xlabel('x'); ylabel('y'); title('(2xy^3+1)+(3x^2y^2+2y)y''=0, initial conditions y(0)=1 and y(0)=-1')

First initial condition:

x0 = 0
x0 = 0
y0 = 1;
plot(x0,y0,'bo')
[xs,ys] = ode15s(f,[0,2],y0); % solve from x=0 to 2
Warning: Failure at t=9.960806e-01. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.776357e-15) at time t.
[xs(end),ys(end)]
ans = 1×2
0.996080587990067 3.24120871110623e-08
The solution ends close to and . Note that ode15s approximates the solution, so the computed values are not exact.
plot(xs,ys,'b')
[xs,ys] = ode15s(f,[0,-2],y0); % solve from x=0 to -2
plot(xs,ys,'b')

Second initial condition:

y0 = -1;
plot(x0,y0,'go')
[xs,ys] = ode15s(f,[0,2],y0); % solve from x=0 to 2
Warning: Failure at t=9.969657e-01. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.776357e-15) at time t.
[xs(end),ys(end)]
ans = 1×2
0.996965720062025 2.28142222526999e-08
The solution ends close to and .
plot(xs,ys,'g')
[xs,ys] = ode15s(f,[0,-2],y0); % solve from x=0 to -2
Warning: Failure at t=-5.532179e-01. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.776357e-15) at time t.
[xs(end),ys(end)]
ans = 1×2
-0.553217912479215 -2.1782929853872
The solution ends close to and .
plot(xs,ys,'g')
hold off