kill(all)$

appendix : system odes ,desolve & laplacetransform,version 1.0
peter.vlasschaert@gmail.com,06/01/2023

rem : based on the laplace transformation "see:below"
why : typical laplace transformation ,you can put in initial condition

load :packages
-----------------

load(lrats)$

eq1:3*diff(x(t),t)+x(t) =1;
eq2:5*diff(y(t),t)+4*y(t)-3*x(t)+4=1;

use : initial condition.
---------------------------

→ solve :system differential equations

ode1:desolve([eq1,eq2],[x(t),y(t)]);

initial : condition ,@t=0
-------------------------------

q1a:[x(0)=1,y(0)=2];

q1b:expand(lratsubst(q1a,ode1));

q1b1:map(rhs,q1b);

check : solution → back substitution

q1c1:ev(lratsubst(q1b,lhs(eq1) =rhs(eq1)),nouns);
q1c2:lratsubst(q1b,lhs(eq2) =rhs(eq2));
q1c2a:expand(q1c2);
q1c2b:ev(q1c2a,nouns);

→ plot x(t),y(t)

wxplot2d([1,3-%e^(-4*t)], [t,0,10])$

rem : laplacetransform
----------------------------

step : 1→ convert odes , laplace

eql1:laplace(eq1, t, s);
eql2:laplace(eq2, t, s);

step : 2 → X(s),Y(s)

v1:[X(s)=laplace(x(t),t,s),Y(s)=laplace(y(t),t,s)];

v1a:makelist(rhs(v1[i]) =lhs(v1[i]) ,i,1,length(v1));

step : 3 →subst {eqli,i=1,2}

eql1a:subst(v1a,eql1);
eql2a:subst(v1a,eql2);

step : 3 →solve {eqlia,i=1,2} :{X(s),Y(s)}

eqlb:solve([eql1a,eql2a],[X(s),Y(s)])[1];

step :4 → s domain → t domain

eqlc1:x(t) = ilt(rhs(eqlb[1]), s, t);
eqlc2:y(t) = ilt(rhs(eqlb[2]), s, t);

eqlc:[eqlc1,eqlc2];

step:5 →use initial condition:use q1a

eqld:subst(q1a,eqlc);

eqld1:map(rhs,eqld);

step:6 → check :eqld1 & q1b1

eqle:makelist(is(rhs(eqld1[i])=rhs(q1b1[i])),i,1,length(eqld));

--------------------------------------------------------------------------------------

rem : desolve easy way to solve  system equations symbolic.
rem : in python you need , use : sympy ,dsolve.