Solution Exam 1 (MATH246, Spring 2024)
clearvars; format short g
Problem 1(a)
separable, constant solution 
syms y(t) % defines symbolic variable t and symbolic function y(t)
dsolve(ode)
ans =

We get two solutions: one from separation (for
), and the constant solution
. dsolve(ode,y(2)==-1)
ans =

solution does not exist for
, solution exists for 
solution exists for all 
Problem 1(b)
ODE
is exact: 
ode = -4*y+16*t+(2*y-4*t)*Dy==0;
dsolve(ode,'Implicit',true) % solution in implicit form
ans = 
dsolve(ode)
ans =

dsolve(ode,y(0)==-1)
ans = 
solution exists for
, i.e., 
Problem 2(a)
stationary points:
0 (neg to pos), hence unstable
1 (pos to neg), hence stable
3 (neg to pos), hence unstable
y<0: negative
0<y<1: positive
1<y<3: negative
y>3: positive
Problem 2(b)
(i) for
we get
as
,
as
, solution exists for all 
(ii) for
we get
as
(solution does not exist for
since improper integral is finite) Problem 3(a)
denotes total amount of water in tank at time t, 
volume of water in tank at time t is 
average concentration in tank is 
ODE
, initial condition 
Problem 3(b)
linear ODE
,
,
, integrating factor 
dsolve(ode)
ans =

dsolve(ode,y(0)==50)
ans =

Problem 4
yE = y0 + h*s1 % Euler approximation