kill(all)$

electro(chem) , measurement with bridge ' Weathstone Bridge',part 3:version 1.0
peter.vlasschaert@gmail.com,12/01/2020

load packages 
============

load(lrats)$

1e) definition : j : sqrt(-1)
===================

j:%i;

General :complex impedance
=======================

a) cartesian form
------------------------

p1:Z= R+j*X;

b) polar form
------------------

p1a:Z=abs(Z)*exp(%i*θ);

p1b:lhs(p1a) = polarform(rhs(p1));

atan2: include sign for the geometric (= circle),quadrant :'sin,cos'
I,II,III,VI
------------------------------------------------------------------------------------------
tan = sin/cos

p1c:rhs(p1a) = rhs(p1b);

find : θ
=====

p2:solve (p1c,θ)[1];

p2a:radcan(p2);

p2b:lhs(p2a) = realpart(rhs(p2a));

find :abs(Z)
=========

p3:subst([p2b],p1c);

p3a:ratcoef(lhs(p3),abs(Z));

p3b:p3/p3a,expand;

rem : simplification with radcan works :exponentials,log ,'structure'

general representation : voltage , current
===============================

c1)  voltage
=========
phase : φ[v],ω =2*π*f

p4a:V = abs(V)*exp(j*(ω*t+φ[v]));

c2)  current
=========
phase : φ[i],ω =2*π*f

p4b:I = abs(I)*exp(j*(ω*t+φ[i]));

c3) impedance
============

p4c: Z = V/I;

p4c1:[p4a,p4b];
p4c2:lhs(p4c) = subst(p4c1,rhs(p4c));

p4c3:lhs(p4c)=radcan(rhs(p4c2));

general form: 'see',p1a
==================

p5:rhs(p1a);
p5a:rhs(p4c3);
p5b:p5a = p5;

find : general 'θ'
----------------------

p5c:solve(p5b,θ)[1];

p5c1:lhs(p5c)=radcan(rhs(p5c));

p5c2: lhs(p5c1) = realpart(rhs(p5c1));

find : general 'abs(Z)'
-----------------------------

p6:subst([p5c2],p5c1);

p6a:rhs(p6)-lhs(p6)=0;

p6b:gfactor(lhs(p6a)) = rhs(p6a);

rem :  % i ≠ 0 then  (log(abs(Z))-log(abs(V))+log(abs(I))) = 0

p6c :part(lhs(p6b),2)= rhs(p6b);

p6c1:logcontract(%);

p6c2:exp(lhs(p6c1))= exp(rhs(p6c1));

p6c3:solve(p6c2,abs(Z))[1];

find :complex impedance (V,I):Z, to general form.
=====================================

p7:p1a;
p7a:[p5c2,p6c3];
p7b:subst(p7a,p1a);

rem : Wet Ohm 'Impedance'
======================

p8:p6c3*abs(I);

p8a:p5c2+φ[i];

when : θ = ω*t =2*π*f*t

p8b:[θ = ω*t ,θ=2*π*f*t];

p8b1:p8b[1];
p8b2:p8b[2];

find :t , time
====

p9:subst([p8b1],p8a);

p9a:solve(p9,t)[1];

find :f,frequency
====

p10:subst([p8b2],p8a);
p10a:solve(p10,f)[1];

rem : no angle = θ=0 : for circuit with only R > 0 => abs(Z) =R
===============================================

assume(R >0);

Wet Ohm : resistance
=================

p11:Z = abs(Z) *exp(%i*θ);

p11a : [Z = R,θ=0];
p11b:lhs(p11)=subst(p11a,rhs(p11));

because : R > 0,abs(R) = R

p11c:abs(p11b);

p11d:subst([p11c],p6c3);

p11e: solve(p11d,abs(V))[1];