MATH528Due date: 09/05/18
Exercise. PS1.4.1
In[1]:=
df = 2 x y dx + x^2 dy
In[4]:=
{P[x_,y_],Q[x_,y_]} =
{Coefficient[df,dx,1],Coefficient[df,dy,1]}
In[5]:=
ExactDF = D[P[x,y],y] == D[Q[x,y],x]
In[6]:=
Exercise. PS1.4.2
In[6]:=
df = x^3 dx + y^3 dy;
{P[x_,y_],Q[x_,y_]} =
{Coefficient[df,dx,1],Coefficient[df,dy,1]};
ExactDF = D[P[x,y],y] == D[Q[x,y],x];
{P[x,y],Q[x,y],ExactDF}
In[7]:=
Exercise. PS1.4.3
In[7]:=
df = Sin[x] Cos[y] dx + Cos[x] Sin[y] dy;
{P[x_,y_],Q[x_,y_]} =
{Coefficient[df,dx,1],Coefficient[df,dy,1]};
ExactDF = D[P[x,y],y] == D[Q[x,y],x];
{P[x,y],Q[x,y],ExactDF}
In[8]:=
Exercise. PS1.4.4
In[8]:=
df = Exp[3y](dx + 3x dy);
{P[x_,y_],Q[x_,y_]} =
{Coefficient[df,dx,1],Coefficient[df,dy,1]};
ExactDF = D[P[x,y],y] == D[Q[x,y],x];
{P[x,y],Q[x,y],ExactDF} /. {x->r, y->theta}
In[9]:=
Exercise. PS1.5.3
which gives
Verify:
In[23]:=
ODE = y'[x] - y[x] == 5.2;
sol[t] = y[x] /. DSolve[ODE,y[x],x][[1,1]]
In[25]:=
Integrate[-4 x Exp[-2x],x]
In[26]:=
Exercise. PS1.5.4
by integration by parts. Verify:
In[24]:=
ODE = y'[x] == 2y[x] -4x;
sol[t] = y[x] /. DSolve[ODE,y[x],x][[1,1]]
In[25]:=
Exercise. PS1.5.5
In[27]:=
ODE = y'[x] + k y[x] == Exp[-k x];
sol[t] = y[x] /. DSolve[ODE,y[x],x][[1,1]]
In[28]:=
Exercise. PS1.5.6
In[29]:=
ODE = y'[x] + 2 y[x] == 4 Cos[2x];
iCond = y[Pi/4]==3;
sol[t] = Expand[y[x] /. DSolve[{ODE,iCond},y[x],x][[1,1]]]
In[30]:=
Problem. PS1.5.31 Newton's law of cooling
and also written
with , with solution , or
In[20]:=
ODE = T'[t] == -r (T[t]-60);
sol[t_] = Expand[T[t] /.
DSolve[{ODE,T[0]==300},T[t],t][[1,1]]]
In[21]:=
Find the decay rate by imposing the condition
In[21]:=
rsol = FindRoot[sol[10.] == 200., {r,0.1}][[1]]
In[22]:=
Find time at which cake temperature reaches 61 degrees
In[22]:=
tsol = FindRoot[sol[t]==61 /. rsol,{t,20}][[1]]
In[23]:=
Verify the solution
In[14]:=
sol[t] /. {rsol,tsol}
Problem. PS1.5.32 Heating and cooling of a building
In[1]:=
Ta[t_] = A - c Cos[2 Pi t/24]
In[2]:=
ODE = T'[t] == Subscript[k,1] (T[t]-Ta[t]) +
Subscript[k,2] (T[t] - Subscript[T,w]) + P
In[3]:=
The above is a linear ODE of form , with
The general solution is
In[3]:=
h[t_]=-(Subscript[k,1]+Subscript[k,2])t
In[4]:=
r[t_]=Subscript[k,1]Ta[t]-Subscript[k,2] Subscript[T,w]+P
In[5]:=
T[t_] = FullSimplify[Exp[-h[t]](Integrate[Exp[h[t]]
r[t],t]+B)]
In[6]:=
The above terms are, in order:
temperature balance between ambient, wanted, occupant temperatures
decay of initial temperature
4. variation due to change in ambient temperature
A more detailed investigation is presented in mLab03.
Problem. PS1.5.33 Drug injection
with the injection rate and the removal rate per unit of drug in bloodstream. This is a linear ODE
In[6]:=
ODE = d'[t] == A - r d[t];
sol[t] = d[t] /. DSolve[ODE,d[t],t][[1,1]]
In[7]:=
Problem. PS1.5.35 Lake Erie
In[7]:=
V=450; Q=175; p0=0.04; p1=p0/4; ODE = p'[t] == Q/V
(p1-p[t]); iCond = p[0]==p0;
sol[t] = p[t] /. DSolve[{ODE,iCond},p[t],t][[1,1]]
In[8]:=
FindRoot[sol[t]==p0/2,{t,1}]
In[10]:=
2.825*175
In[11]:=
The sum is a solution of .
Proof. Compute