(%i1) | kill(all)$ |
ode : part5,intro: ricatti
[email protected],05/02/2017
Theory Ricatti : ODE (reaction kinetics)
(dy/dx) = p(x)*y^2+q(x)*y+r(x)
Why: Consecutive Reactions and Ricatti
k1 k2
reaction kinetics : A → B → C
dCA/dt = - k1*CA^n (1)
dCB/dt = k1*CA^n-k2*CB^m (2)
dCC/dt = k2*CC^l (3)
integer values : n,m,l
concentration : CA,CB,CC
(%i2) |
load('contrib_ode)$ assume(t>0,CA>0,CB>0)$ |
equation (2) n=1,m=2, by 't=0 → CA=CA0'
(%i4) |
eq1: CA = CA0*%e^(-k1*t); eq2:'diff(CB,t)=k1*CA^1-k2*CB^2; |
method1:
(%i7) |
eq3:subst(rhs(eq1),CA,eq2); eq4:part(eq3,2,2); eq5: lhs(eq3)-eq4=rhs(eq3)-eq4; |
(%i9) |
eq6:contrib_ode(eq5,CB,t)[1]; method; |
check : solution n=1,m=2
(%i11) |
eq7:part(eq6,1); eq8:part(eq6,2); |
eq7 : What subst. to use → linear second order
equation with nonconstant coefficients.
(%i12) | depends([%u],[t]); |
(%i13) | dependencies; |
(%i14) | eq9:subst(eq7,eq5); |
(%i15) | eq10:ev(part(eq9,1),nouns)=ev(part(eq9,2),nouns); |
(%i16) | eq11:part(eq10,1,2); |
(%i17) | eq12:eq10*eq11; |
(%i18) | dependencies; |
(%i19) | eq13:lhs(eq12)-rhs(eq12)=0; |
(%i20) | eq14:ratsubst(lhs(eq1),rhs(eq1),eq13); |
try to solve:eq12: d/dt(d%u/dt)=f(t)*%u
(%i23) |
eq14:part(eq12,1,1); eq15:part(eq12,1,2); eq16:part(eq12,1,3); |
convert : 'two' first order ODE's
Numerical Solution find with 4th Order Runge-Kutta.
(%i25) |
eq17:'diff(%u,eq15,eq16-1)=h; eq18:'diff(rhs(eq17),eq15,eq16-1)=rhs(eq12); |