\( \DeclareMathOperator{\abs}{abs} \newcommand{\ensuremath}[1]{\mbox{$#1$}} \)
(%i1) kill(all)$
load(eigen)$

module 3:cooling law 'system differential equations'.
[email protected] ,           25/03/2017

cooling law :Newton.
T0 = initial temperature ( initial state ),see below
Te = ambient temperature ( final   state ),see below
T  = temperature ' function of time ' = T( time ) = T(t)

(%i2) assume(k>0);
\[\tag{\%{}o2}\label{o2} [k\mbox{\ensuremath{\ensuremath{>}}}0]\]
(%i3) pT1:'diff(T,t)=-k*(T-Te);
\[\tag{pT1}\label{pT1}\frac{d}{dt}T=-\left( T-\mathit{Te}\right) k\]
(%i4) p1:ode2(pT1,T,t);
\[\tag{p1}\label{p1}T={{\%{}e}^{-kt}}\,\left( \mathit{Te}\,{{\%{}e}^{kt}}+\mathit{\%{}c}\right) \]

How to get '%c' ⇒ t=0 → T=T0

(%i7) p2:ev(p1,t=0);
p3:solve(p2,%c)[1];
p4:ev(p3,T=T0);
\[\tag{p2}\label{p2}T=\mathit{Te}+\mathit{\%{}c}\] \[\tag{p3}\label{p3}\mathit{\%{}c}=T-\mathit{Te}\] \[\tag{p4}\label{p4}\mathit{\%{}c}=\mathit{T0}-\mathit{Te}\]
(%i8) p5:ev(p1,p4);
\[\tag{p5}\label{p5}T={{\%{}e}^{-kt}}\,\left( \mathit{Te}\,{{\%{}e}^{kt}}-\mathit{Te}+\mathit{T0}\right) \]

check : of the initial state of the cooling process.

find initial state 'p5' ' t→ 0 ',time domain
( Laplace transformation , s domain )

(%i9) p6:limit(part(p5,2), t, 0);
\[\tag{p6}\label{p6}\mathit{T0}\]
(%i10) p7:T=ratsimp(part(p5,2));
\[\tag{p7}\label{p7}T={{\%{}e}^{-kt}}\,\left( \mathit{Te}\,{{\%{}e}^{kt}}-\mathit{Te}+\mathit{T0}\right) \]

find steady state 'p7' ' t→ infinity ',time domain
( Laplace transformation , s domain )

(%i11) p8:limit(p7,t,inf);
\[\tag{p8}\label{p8}T=\mathit{Te}\]
(%i12) kill(all);
\[\tag{\%{}o0}\label{o0} \mathit{done}\]

three zones cooling : Te = put in egg in boiling water = 'Te' of 'Te=100*e^(-kt)'
                     T2 = egg white ( = Albumen)      = T[1]
                     T1 = yolk                        = T[2]
-----------------------------------------------------------------------------------------------------
http://www.ltz.de/en/news/lohmann-information/An-egg-a-day-the-physiology-of-egg-formation.php ,'fig'
-----------------------------------------------------------------------------------------------------
temperature range : Te(t) or constant , T2(t) , T1(t)
-----------------------------------------------------------------------------------------------
egg model :
-----------------------------------------------------------------------------------------------
mitopencourseware :
Instructor/speaker: Prof. Arthur Mattuck
Home » Courses » Mathematics » Differential Equations » Video Lectures »
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
https://ocw.mit.edu/courses/mathematics/18-03-differential-equations-spring-2010/video-lectures
/lecture-24-introduction-to-first-order-systems-of-odes/
-----------------------------------------------------------------------------------------------

a,b : no physical meaning, 'different conductions = different regios'
Te = 0    (ice bad,course mit use this)
Te = 100  (boiling egg)

edit : Te:0  (course mit) → Te:100

(%i1) Te :0;
\[\tag{Te}\label{Te}0\]
(%i2) depends(T,t);
\[\tag{\%{}o2}\label{o2} [\operatorname{T}(t)]\]
(%i4) pT1:'diff(T[1],t)=a*(T[2]-T[1]);
pT2:'diff(T[2],t)=a*(T[1]-T[2])+b*(Te-T[2]);
\[\tag{pT1}\label{pT1}\frac{d}{dt}{{T}_{1}}=\left( {{T}_{2}}-{{T}_{1}}\right) a\] \[\tag{pT2}\label{pT2}\frac{d}{dt}{{T}_{2}}=\left( {{T}_{1}}-{{T}_{2}}\right) a-{{T}_{2}}b\]
(%i6) a:2;
b:3;
\[\tag{a}\label{a}2\] \[\tag{b}\label{b}3\]
(%i8) pT11:'diff(T[1],t)=a*(T[2]-T[1]);
pT22:'diff(T[2],t)=-a*(T[1]-T[2])+b*(Te-T[2]);
\[\tag{pT11}\label{pT11}\frac{d}{dt}{{T}_{1}}=2\left( {{T}_{2}}-{{T}_{1}}\right) \] \[\tag{pT22}\label{pT22}\frac{d}{dt}{{T}_{2}}=-3{{T}_{2}}-2\left( {{T}_{1}}-{{T}_{2}}\right) \]

eliminate : T2

(%i11) p9:solve(pT1,T[2])[1];
a:2;
b:3;
\[\tag{p9}\label{p9}{{T}_{2}}=\frac{{{T}_{1}}a+\frac{d}{dt}{{T}_{1}}}{a}\] \[\tag{a}\label{a}2\] \[\tag{b}\label{b}3\]
(%i12) p10:ratsimp(ev(pT2,p9));
\[\tag{p10}\label{p10}\frac{d}{dt}\frac{\frac{d}{dt}{{T}_{1}}+2{{T}_{1}}}{2}=-\frac{5\left( \frac{d}{dt}{{T}_{1}}\right) +6{{T}_{1}}}{2}\]
(%i13) p11:ratsimp(ev(lhs(p10)-rhs(p10)=0,nouns));
\[\tag{p11}\label{p11}\frac{\frac{{{d}^{2}}}{d{{t}^{2}}}{{T}_{1}}+7\left( \frac{d}{dt}{{T}_{1}}\right) +6{{T}_{1}}}{2}=0\]

find : T
       1

rem : characsteristic eq: r^2+7*r+6=0,roots = -1,6

(%i14) p12:ode2(p11,T[1],t);
\[\tag{p12}\label{p12}{{T}_{1}}=\mathit{\%{}k1}\,{{\%{}e}^{-t}}+\mathit{\%{}k2}\,{{\%{}e}^{-6t}}\]

intial conditions T[1](t=0)=40
                 T[2](t=0)=45

find : T
       2

(%i15) p13:ev(p12,%k1=c1,%k2=c2);
\[\tag{p13}\label{p13}{{T}_{1}}=\mathit{c1}\,{{\%{}e}^{-t}}+\mathit{c2}\,{{\%{}e}^{-6t}}\]

T[1](t=0)=40,initial temperature (yolk)

(%i16) p131:ev(p13,T[1]=40,t=0);
\[\tag{p131}\label{p131}40=\mathit{c2}+\mathit{c1}\]
(%i17) p14:ev(p9,p13);
\[\tag{p14}\label{p14}{{T}_{2}}=\frac{\frac{d}{dt}\left( \mathit{c1}\,{{\%{}e}^{-t}}+\mathit{c2}\,{{\%{}e}^{-6t}}\right) +2\left( \mathit{c1}\,{{\%{}e}^{-t}}+\mathit{c2}\,{{\%{}e}^{-6t}}\right) }{2}\]
(%i18) p15:ev(p14,nouns);
\[\tag{p15}\label{p15}{{T}_{2}}=\frac{2\left( \mathit{c1}\,{{\%{}e}^{-t}}+\mathit{c2}\,{{\%{}e}^{-6t}}\right) -\mathit{c1}\,{{\%{}e}^{-t}}-6\mathit{c2}\,{{\%{}e}^{-6t}}}{2}\]
(%i19) ratsimp(ev(p14,nouns));
\[\tag{\%{}o19}\label{o19} {{T}_{2}}=\frac{{{\%{}e}^{-6t}}\,\left( \mathit{c1}\,{{\%{}e}^{5t}}-4\mathit{c2}\right) }{2}\]

T[2](t=0)=45,initial temperature (egg white)

(%i20) p151:ev(p15,T[2]=45,t=0);
\[\tag{p151}\label{p151}45=\frac{2\left( \mathit{c2}+\mathit{c1}\right) -6\mathit{c2}-\mathit{c1}}{2}\]

how to do this :menu
Equations → solve linear system → ask questions
2 → first   field : p131
     second  field : p151
     third   field : c1,c2

(%i21) p16:linsolve([p131, p151], [c1,c2]);
\[\tag{p16}\label{p16}[\mathit{c1}=50,\mathit{c2}=-10]\]
(%i23) p17:p16[1];
p18:p16[2];
\[\tag{p17}\label{p17}\mathit{c1}=50\] \[\tag{p18}\label{p18}\mathit{c2}=-10\]

T (t) = temperature 'yolk with time'.
1

(%i24) p19:ev(p13,p17,p18);
\[\tag{p19}\label{p19}{{T}_{1}}=50{{\%{}e}^{-t}}-10{{\%{}e}^{-6t}}\]

T (t) = temperature 'white of the egg with time'.
2

(%i25) p20:ratsimp(ev(p15,p17,p18));
\[\tag{p20}\label{p20}{{T}_{2}}={{\%{}e}^{-6t}}\,\left( 25{{\%{}e}^{5t}}+20\right) \]
(%i26) kill(all);
\[\tag{\%{}o0}\label{o0} \mathit{done}\]

solve : the above problem again ,with eigenvectors
                                with eigenvalues.
general method :solving system of differential equations.
X = T[1]
Y = T[2]
mit course:
https://ocw.mit.edu/courses/mathematics/18-03-differential-equations-spring-2010/video-lectures
/lecture-25-homogeneous-linear-systems-with-constant-coefficients/

(%i2) depends(X,t);
depends(Y,t);
\[\tag{\%{}o1}\label{o1} [\operatorname{X}(t)]\] \[\tag{\%{}o2}\label{o2} [\operatorname{Y}(t)]\]
(%i4) pd1:'diff(X,t) = -2*X+2*Y;
pd2:'diff(Y,t) = 2*X-5*Y;
\[\tag{pd1}\label{pd1}\frac{d}{dt}X=2Y-2X\] \[\tag{pd2}\label{pd2}\frac{d}{dt}Y=2X-5Y\]

what with : general 'solution'
lambda = parameter
X= a1*e^(lambda*t)
Y= a2*e^(lambda*t)

(%i6) p21:X=a1*%e^(lambda*t);
p22:Y=a2*%e^(lambda*t);
\[\tag{p21}\label{p21}X=\mathit{a1}\,{{\%{}e}^{t\,\mathit{lambda}}}\] \[\tag{p22}\label{p22}Y=\mathit{a2}\,{{\%{}e}^{t\,\mathit{lambda}}}\]
(%i8) p23:ev(pd1,p21,p22);
p24:ev(pd2,p21,p22);
\[\tag{p23}\label{p23}\frac{d}{dt}\left( \mathit{a1}\,{{\%{}e}^{t\,\mathit{lambda}}}\right) =2\mathit{a2}\,{{\%{}e}^{t\,\mathit{lambda}}}-2\mathit{a1}\,{{\%{}e}^{t\,\mathit{lambda}}}\] \[\tag{p24}\label{p24}\frac{d}{dt}\left( \mathit{a2}\,{{\%{}e}^{t\,\mathit{lambda}}}\right) =2\mathit{a1}\,{{\%{}e}^{t\,\mathit{lambda}}}-5\mathit{a2}\,{{\%{}e}^{t\,\mathit{lambda}}}\]
(%i10) p231:ev(p23,nouns)/%e^(t*lambda);
p241:ev(p24,nouns)/%e^(t*lambda);
\[\tag{p231}\label{p231}\mathit{a1}\,\mathit{lambda}={{\%{}e}^{-t\,\mathit{lambda}}}\,\left( 2\mathit{a2}\,{{\%{}e}^{t\,\mathit{lambda}}}-2\mathit{a1}\,{{\%{}e}^{t\,\mathit{lambda}}}\right) \] \[\tag{p241}\label{p241}\mathit{a2}\,\mathit{lambda}={{\%{}e}^{-t\,\mathit{lambda}}}\,\left( 2\mathit{a1}\,{{\%{}e}^{t\,\mathit{lambda}}}-5\mathit{a2}\,{{\%{}e}^{t\,\mathit{lambda}}}\right) \]
(%i12) p25:ratsimp(p231);
p26:ratsimp(p241);
\[\tag{p25}\label{p25}\mathit{a1}\,\mathit{lambda}=2\mathit{a2}-2\mathit{a1}\] \[\tag{p26}\label{p26}\mathit{a2}\,\mathit{lambda}=2\mathit{a1}-5\mathit{a2}\]
(%i14) p27:rhs(p25)-lhs(p25)=0;
p28:rhs(p26)-lhs(p26)=0;
\[\tag{p27}\label{p27}-\mathit{a1}\,\mathit{lambda}+2\mathit{a2}-2\mathit{a1}=0\] \[\tag{p28}\label{p28}-\mathit{a2}\,\mathit{lambda}-5\mathit{a2}+2\mathit{a1}=0\]
(%i18) p29:coeff(part(p27,1),a1);
p30:coeff(part(p27,1),a2);
p31:coeff(part(p28,1),a1);
p32:coeff(part(p28,1),a2);
\[\tag{p29}\label{p29}-\mathit{lambda}-2\] \[\tag{p30}\label{p30}2\] \[\tag{p31}\label{p31}2\] \[\tag{p32}\label{p32}-\mathit{lambda}-5\]

build matrix M1 ' coefficient matrix '

(%i19) M1:zeromatrix(2,2);
\[\tag{M1}\label{M1}\begin{pmatrix}0 & 0\\ 0 & 0\end{pmatrix}\]
(%i23) M1[1,1]:p29$
M1[1,2]:p30$
M1[2,1]:p31$
M1[2,2]:p32$

coefficient matrix,p27,p28

(%i24) M1;
\[\tag{\%{}o24}\label{o24} \begin{pmatrix}-\mathit{lambda}-2 & 2\\ 2 & -\mathit{lambda}-5\end{pmatrix}\]

call :characteristics polynomial of a matrix
module 1 : charpoly form ' load(eigen)'

(%i25) p33:ratsimp(determinant(M1))=0;
\[\tag{p33}\label{p33}{{\mathit{lambda}}^{2}}+7\mathit{lambda}+6=0\]

lambda-sum*lambda+product  = 0 'quadratic equation '
sum     = lambda1+lambda2
product = lambda1*lambda2
------------------------------
example: lambda1=-6,lambda2=-1

(%i26) p34:solve(p33,lambda);
\[\tag{p34}\label{p34}[\mathit{lambda}=-6,\mathit{lambda}=-1]\]
(%i28) p35:p34[1];
p36:p34[2];
\[\tag{p35}\label{p35}\mathit{lambda}=-6\] \[\tag{p36}\label{p36}\mathit{lambda}=-1\]
(%i30) p351:part(p35,2);
p361:part(p36,2);
\[\tag{p351}\label{p351}-6\] \[\tag{p361}\label{p361}-1\]

find eigenvector corresponding to 'lambda=-1'

(%i32) p37:a1*M1[1,1]+a2*M1[1,2]=0;
p38:a1*M1[1,1]+a2*M1[1,2]=0;
\[\tag{p37}\label{p37}\mathit{a1}\,\left( -\mathit{lambda}-2\right) +2\mathit{a2}=0\] \[\tag{p38}\label{p38}\mathit{a1}\,\left( -\mathit{lambda}-2\right) +2\mathit{a2}=0\]

subst : lambda = -1 'p36' in to p37,p38

(%i34) p39:ev(p37,p36);
p40:ev(p38,p36);
\[\tag{p39}\label{p39}2\mathit{a2}-\mathit{a1}=0\] \[\tag{p40}\label{p40}2\mathit{a2}-\mathit{a1}=0\]

menu :equations →solve linear system 'p39,p40' for a1,a2

eigenvectors (  lambda = -1)
module 1 : eigenvectors ,uniteigenvectors

(%i35) p41:linsolve([p39, p40], [a1,a2]);
\[\mbox{}\\\mbox{solve: dependent equations eliminated: (2)}\] \[\tag{p41}\label{p41}[\mathit{a1}=2\mathit{\%{}r1},\mathit{a2}=\mathit{\%{}r1}]\]
(%i36) p42:ev(p41,%r1=1);
\[\tag{p42}\label{p42}[\mathit{a1}=2,\mathit{a2}=1]\]
(%i38) p43:p42[1];
p44:p42[2];
\[\tag{p43}\label{p43}\mathit{a1}=2\] \[\tag{p44}\label{p44}\mathit{a2}=1\]

subst : lambda = -6 'p35' in to p37,p38

(%i40) p45:ev(p37,p35);
p46:ev(p38,p35);
\[\tag{p45}\label{p45}2\mathit{a2}+4\mathit{a1}=0\] \[\tag{p46}\label{p46}2\mathit{a2}+4\mathit{a1}=0\]

menu :equations →solve linear system 'p45,p46' for a1,a2

eigenvectors (  lambda = -6)
module 1 : eigenvectors ,uniteigenvectors

(%i41) p47:linsolve([p45, p46], [a1,a2]);
\[\mbox{}\\\mbox{solve: dependent equations eliminated: (2)}\] \[\tag{p47}\label{p47}[\mathit{a1}=-\frac{\mathit{\%{}r2}}{2},\mathit{a2}=\mathit{\%{}r2}]\]
(%i42) p48:ev(p47,%r2=-2);
\[\tag{p48}\label{p48}[\mathit{a1}=1,\mathit{a2}=-2]\]
(%i44) p49:p48[1];
p50:p48[2];
\[\tag{p49}\label{p49}\mathit{a1}=1\] \[\tag{p50}\label{p50}\mathit{a2}=-2\]

superposition principle :C1,C2
before : C11 = c1/2,C22 = c2

(%i46) p51:X=C11*part(p43,2)*%e^(p361*t)+C22*part(p49,2)*%e^(p351*t);
p52:Y=C11*part(p44,2)*%e^(p361*t)+C22*part(p50,2)*%e^(p351*t);
\[\tag{p51}\label{p51}X=2\mathit{C11}\,{{\%{}e}^{-t}}+\mathit{C22}\,{{\%{}e}^{-6t}}\] \[\tag{p52}\label{p52}Y=\mathit{C11}\,{{\%{}e}^{-t}}-2\mathit{C22}\,{{\%{}e}^{-6t}}\]

general system : without values. 'appendix'


Created with wxMaxima.