kill(all)$

electrical (3) ,How to find differential equations 'rlc circuit' in general. "version 1.0",part 2
peter.vlasschaert@gmail.com,23/12/2019

see :
electrical (3) ,How to find differential equations 'rlc circuit' in general. "version 1.0",part 1

load packages

load(lrats)$

rlc 'circuit'

1e)  form to use for ' Laplace Transform =LT'
===============================

p1:diff(V(t),t,1)=L*(diff(i(t),t,2))+R*(diff(i(t),t,1))+i(t)/C;

2e) form to use for 'ode2'
===================
no confusuion  V(t) = U  here i(t) = I

p2:'diff(U,t)=L*'diff(I,t,2)+R*'diff(I,t,1)+I/C;

We use 2e) form to solve.
-----------------------------------

U = constant , DC source 

declare(U,constant)$

p2a:ev(lhs(p2),diff) = rhs(p2);

A\ solve : 'p2a' with ode2
-------------------------------

rem : C*(C*R^2-4*L)  ?
==================
part 1 :positive
part 2 :negative
part 3 : zero
==================
Maxima ask this : question.
=> ode2 not good way .

p2b:ode2(p2a,I,t);

B\ solve : 'p1' with LT
----------------------------------
DC : source U = constant

p3:0 = rhs(p1);

1e)  LT (t domin => s domain)
=======================

p3a:laplace(p3,t,s);

by definition  I(s) = laplace(i(t),t,s)

p3b:  [laplace(i(t),t,s) = I(s)];
p3c:subst(p3b,p3a);
p3d:solve(p3c,I(s));
p3e:p3d[1];

rem :  i(t) not known here when aren't known (C,R,L) => method one.

from : positiv solution they are of the form.
================================

What about: AA,m
-------------------------

p4:p3;

p4a:i(t) = AA*exp(m*t);

p4b:diff(p4a,t);

p4c:diff(p4b,t);

p4d:subst([p4a,p4b,p4c],p4);

evaluation : 'p4d'

p4e:ev(p4d,nouns);

p4f: lhs(p4e) = factor(rhs(p4e));

find roots : characteristic equations ' in m'
---------------------------------------------------------

p4g:num(rhs(p4f)) = lhs(p4f);

p4h:p4g/rhs(p4a);

roots : m

p4i:solve(p4h,m);

p4i1:m1=expand(rhs(p4i[1]));
p4i2:m2=expand(rhs(p4i[2]));

we see : condition ode2, to solve the ode , see  : p2b

from : electrical (3)  part 1

resonance frequency : fr (part 1)
--------------------------------------------

find :ω0
-----------

p5:fr=sqrt(1/(C*L))/(2*%pi);
p5a: ω0=rhs(p5)*(2*%pi);

p5a1:rhs(p5a) = lhs(p5a);

p5a2:radcan(p5a1);

set  : α
----------

p5b: α = part(rhs(p4i1),2);

p5b1:rhs(p5b) =lhs(p5b);

How to bring : ω0,α  in 'p4i1,p4i2'
==========================

assume(C>0,L>0,R>0);

p6:radcan(lratsubst([p5b1],p4i1));

p6a:lhs(p6) =expand(rhs(p6));

intermezo ( find q : ? ,dummie variable here.)
---------------------------------------------------------------------

p6b: part(rhs(p6a),2)  = sqrt(α^2-q^2);

p6b1:p6b^2;

because : f > 0 , fr > 0,ω0> 0

p6b2:solve(p6b1,q)[2];

because : C> 0 ,L > 0  

p6b3: q= 1/sqrt(C*L);

find relation : ω0,see 'p5a,p5a1'

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

elements : rlc  'circuit' 
================

α     = damping factor
ω0  = natural frequency

p7a: m1=α - sqrt(α^2-(ω0)^2);
p7b: m2=α +sqrt(α^2-(ω0)^2);

relation between α & ω0
==================

if  α > ω0  =>  overdamping      (1)
if  α = ω0  =>  critical damping  (2)
if  α < ω0  =>  underdamping     (3)

(1)  overdamping
------------------------

p8a :i(t) = k1*%e^(m1*t) + k2*%e^(m2*t);

(2) critical damping
--------------------------

p8b :i(t) = (k2+t*k1)*%e^(α*t);

(3) underdamping
-------------------------
ωd = damped natural frequency

p8c:ωd = part(rhs(p7b),1);

p8c1:i(t) =%e^(α*t)*(kk1*cos(ωd*t)+%i*kk2*sin(ωd*t));

p8c2:subst([p8c],p8c1);

unknowns : k1,k2,kk1,kk2 we get them  IC =Initial Conditions
==============================================
=>    i(0)                  ?  
=>    di(t)/dt @ t =0 ?

studie : critical damping 
===================
=>  to put :'α,ω0' into 'p4'

α  => p4
-----------

p9:p4;

p9a:expand(rhs(p9)/L)= lhs(p9);

p9b:lratsubst([p5b1],lhs(p9a)) = 0;

p9b1:expand(p9b);

ω0 => p4
-------------

p9:p5a1^2;

p9c:lratsubst([p9],lhs(p9b1)) = 0;

properties :ω0 =α,see above.

p10:subst([ω0=α],p9c);

How to solve : i(t) , p10;
---------------------------------

set  u = diff(i(t),t)-α*i

p10a:[u = diff(i(t),t)-α*i(t)];

convert : second order ode2 => ode new var.
--------------------------------------------------------------

p10b:'diff(u,t)-α*u = 0;

check :

p10c:subst(p10a,p10b);

p10c1:ev(p10c,nouns);

p10c2:expand(p10c1);

solve : first order ode in u
-----------------------------------

p10d:ode2(p10b,u,t);

p10d1:subst([%c = k1],p10d);

find : %c
------------
two definitions : u

p10e1: p10d1;
p10e2:p10a[1];

result : ode
----------------

p10f:rhs(p10e2) = rhs(p10e1);

take other symbol: i(t) = I

p10f1:'diff(I,t)-I*α = rhs(p10f);

solve : ode .
--------------

p10f2:ode2(p10f1,I,t);

p10f3:subst([I=i(t)],p10f2);

p10f4:subst([%c =k2],p10f3);

check : p10f4 ? p8b
----------------------------

p10f5:is(rhs(p10f4) = rhs(p8b));

studie :under damping 
===================
discriminant  < 0  : complex value

set : complex value , 'electrical'

j:sqrt(-1);

p11a:%e^(j*θ) = cos(θ) +j*sin(θ);
p11b:subst([j=-j],p11a);

use : ωd , ' above'

p12a:m1= α + j*ωd;
p12b:m2 =α - j*ωd;

use :'p8a'

p13:p8a;
p13a:p8c;
p13b:subst([p12a,p12b],p13);

expand : euler 'cos,sin'

p13c:lhs(p13b) =demoivre(rhs(p13b));

p13c1:lhs(p13c) = factor(rhs(p13c));

complex number :  Z = a*%i + b

p13c2a:b=factor(realpart(rhs(p13c1)));
p13c2b:a=factor(imagpart(rhs(p13c1)));

find relation:

p14:p8c2;
p14a:k2+k1= kk1;
p14b:k1-k2=kk2;
p14c1:subst([p14a],rhs(p13c2a));
p14c2:lratsubst([p14b],rhs(p13c2b));
p14d : lhs(p13c1) =factor( p14c1+j*p14c2);

check result :p8c1 ? p4d

p14e:is(rhs(p8c1)= rhs(p14d));

part 3: TF = Transfer Function , differential equations.