Section 1.5 First-Order Linear ODEs

We want to solve: y' + p(x) y = r(x)

For example: y' - y = (e^(2x))

DSolve[y'[x]-y[x]==Exp[2 x], y[x], x]

Compare this result with your text book

Solve: y’ + y tan x = sin 2x, y(0) = 1

DSolve[{y'[x]+ y[x] Tan[x]==Sin [2x],y[0]==1},y[x],x]

DSolve[y'[x]==4 y[x]+ x,y,x]

Let’s try to solve the kineitcs system: A --> (k1) B --> (k2) --> C

Clear[A0, k1,k2]

eqn=y'[t] + k2 y[t] - k1 A0 Exp[-k1 t]==0

DSolve[{eqn, y[0]==0},y[t],t]

Simplify[%]

We can manually simplify it to y(t) = ((A0 k1)/(k2 - k1)) ((e^(-k1 t)) - (e^(-k2 t)))

sol=DSolve[{eqn, y[0]==0},y,t]

CA[t_]:=A0 Exp[-k1 t]

CB[t_]:= y[t] /. sol

CC[t_]:=A0 - A[t] - B[t]

A0=1; k1=1;k2=2;

Plot[{CA[t],CB[t],CC[t]} , {t,0,5},PlotLegends->"Expressions"]

when k1 = k2

Clear[A0, k1,k2]

eqn1=y'[t] + k1 y[t] - k1 A0 Exp[-k1 t]==0

DSolve[{eqn1, y[0]==0},y[t],t]

Clear[A0, k1,k2]

Take out the solution for further analysis
A --> (k1) B --> (k2) --> C

eqn=y'[t] + k2 y[t] - k1 A0 Exp[-k1 t]==0

sol=DSolve[{eqn, y[0]==0},y,t]

A0=1; k1=1;k2=2;

sol=DSolve[{eqn, y[0]==0},y,t]

m=sol[[1]]

eqn1=y'[t] ==0 /. m

FindRoot[eqn1,{t,1}]

A⇔B ((Subscript[k, 1]),(Subscript[k, 2]))

Clear[A0,k1,k2]

eqn=y'[t]+(k1+k2)y[t]==k2 A0

DSolve[{eqn, y[0]==A0},y[t],t]

Sol=DSolve[{eqn, y[0]==A0},y,t]

y[0] /. Sol

CA[t_]:= y[t] /. Sol

CB[t_] :=A0-CA[t]

k1=1.0;k2=1.0;A0=1.0;

Plot[{CA[t],CB[t]} , {t,0,3},PlotRange->{{0,3},{0,1}},PlotLegends->"Expressions"]

CA[t]

Lake Erie has a water volume of about 450 (km^3) and a flow rate (in and out) of about 175 (km^3) per year. If at some instant the lake has pollution concentration p = 0.04%, how long, approximately, will it take to decrease it to p/2, assuming that the inflow is much cleaner, say, it has pollution concentration p/4, and the mixture is uniform (an assumption that is only very imperfectly true)? First, guess.

We try to write p as a function of t, and we expect p to decrease (from 0.04%) with time and reach a value of 0.01% after a long time.

d p / dt = ( - 175 * p + 175 * 0.25 * p) / 450

eqn=pol'[t]==(-175*pol[t]+175*0.25*pol[t])/450

sol=DSolve[{eqn, pol[0]==0.0004}, pol,t]

Plot[pol[t] /. sol, {t,0,10}]

Log[2]/0.291667

pol[2.3765] /. sol