from sympy import Symbol
s = Symbol('s');
#Applying KVL equation to the two loops we get
#V1 = 2*I1+s*(I1+I2)
#V2 = 3*I2+s*(I1+I2)
#On solving we get
#(s+2)*I1+s*I2 = V1 (1)");
#s*I1+(s+3)*I2 = V2 (2)");
#The equations which contain Z parameters are
#V1 = Z11*I1+Z12*I2
#V2 = Z21*I1+Z22*I2
#On comparing (1) and (2) with above equations
Z11 = s+2;
Z12 = s;
Z21 = s;
Z22 = s+3;
print "Z11 = ",Z11
print "Z12 = ",Z12
print "Z21 = ",Z21
print "Z22 = ",Z22
import math
from sympy import Symbol
s = Symbol('s')
#Applying KVL equation to the two loops we get
#V1 = 2*I1+s*(I1+I2)-I2
#V2 = 3*I2+s*(I1+I2)
#On solving we get
#(s+2)*I1+(s-1)*I2 = V1 (1)");
#s*I1+(s+3)*I2 = V2 (2)");
#The equations which contain Z parameters are
#V1 = Z11*I1+Z12*I2
#V2 = Z21*I1+Z22*I2
#On comparing (1) and (2) with above equations
Z11 = s+2;
Z12 = s-1;
Z21 = s;
Z22 = s+3;
print "Z11 = ",Z11
print "Z12 = ",Z12
print "Z21 = ",Z21
print "Z22 = ",Z22
from sympy import Symbol
s = Symbol('s')
Ya = 3/(5*s+6);
Yb = 2/(5*s+6);
Yc = s/(5*s+6);
#Writing KCL equations
#I1 = (Ya+Yc)*V1-Yc*V2 (1)")
#I2 = -Yc*V1+(Yb+Yc)*V2 (2)")
#The equations which contain Y parameters are
#I1 = Y11*V1+Y12*V2
#I2 = Y21*V1+Y22*V2
#On comparing (1) and (2) with above equations
#Y11 = Ya+Yc")
#Y12 = -Yc = Y21")
#Y22 = Yb+Yc")
#Substituting Ya , Yb and Yc
Y11 = Ya+Yc
Y12 = -Yc
Y21 = -Yc
Y22 = Yb+Yc
print "Y11 = ",Y11
print "Y12 = ",Y12
print "Y21 = ",Y21
print "Y22 = ",Y22
from sympy import Symbol
s = Symbol('s')
#From example 14.4
Y11 = (3 + s)/(5*s+6)
Y12 = - s/(6 + 5*s)
Y21 = - s/(6 + 5*s)
Y22 = (2+s)/(6+5*s)
DYY = Y11*Y22-Y12*Y21
Z11 = Y22/DYY;
Z12 = -Y12/DYY;
Z21 = -Y21/DYY;
Z22 = Y11/DYY;
print "Z11 = ",Z11
print "Z12 = ",Z12
print "Z21 = ",Z21
print "Z22 = ",Z22
#From figure 14.9
#V1 = 50*I1 (1)");
#I2 = 300*I1 (2)");
#The equations which contain h parameters are
#V1 = h11*I1+h12*V2
#I2 = h21*I1+h22*V2
#On comparing (1) and (2) with above equations
print "h11 = %d"%(50);
print "h12 = %d"%(0);
print "h21 = %d"%(300);
print "h22 = %d"%(0);
#From figure 14.10
#By inspection
#V1 = 10**9*I1
#V2 = 10(I2-10**-3*V1)
#On solving we get
#I1 = 10**-9*V1 (1)");
#V2 = 10*I2-10**-2*V1 (2)");
#The equations which contain g parameters are
#I1 = g11*V1+g12*I2
#V2 = g21*V1+g22*I2
#On comparing (1) and (2) with above equations
print "g11 = %2.1e"%(10**-9);
print "g12 = %d"%(0);
print "g21 = %2.1e"%(-10**-2);
print "g22 = %d"%(10);
from sympy import Symbol
s = Symbol('s')
#Applying KVL equation to the two loops we get
#V1 = 3*I1+3*(I1+I2)
#V2 = 7*I1+3*(I1+I2)+2*I2
#On solving we get
#6*I1+3*I2 = V1 (1)");
#10*I1+5*I2 = V2 (2)");
#The equations which contain Z parameters are
#V1 = Z11*I1+Z12*I2
#V2 = Z21*I1+Z22*I2
#On comparing (1) and (2) with above equations
Z11 = 6;
Z12 = 3;
Z21 = 10;
Z22 = 5;
print "Z11 = ",Z11
print "Z12 = ",Z12
print "Z21 = ",Z21
print "Z22 = ",Z22
#As DZZ results in zero(0) therefore Y parameters are not defined ")