#finding voltage current resistance
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
R1=1000.0;
R2=1000.0;
Rl=500.0#load resistance
V=1.0#input voltage
#calculation
Vo=(R2/(R1+R2))*V;
Rll=1/((1/R2)+(1/Rl))#lower loaded resistance
Vol=(Rll/(R2+Rll))*V;
#result
print "open output voltage is",round(Vo,3),"V"
print "resistance lower loaded is",round(Rll,3),"ohm"
print "loaded output voltage is",round(Vol,3),"V"
#finding voltage current resistance
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
Rf=100000.0#resistance
Acl=100.0#amplifier gain
#calculation
Ri=Rf/(Acl-1);
#result
print "input resistance is",round(Ri/1000,2), "Kohm"
#finding voltage current resistance
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
Vni=0.0#non inverting voltage
Vinv=0.0;#inverting voltage
Vri1=1.0;
Vri2=15.0;
Ri1=5600.0#resistance
Ri2=470000.0;
Rf=10000.0#load resistance
#calculation
Ir1=Vri1/Ri1;
Ir2=Vri2/Ri2;
Irf=(Vri1/Ri1)+(Vri2/Ri2);
Vr=Irf*Rf;
Vo1=-Vr;
Vo=Irf*Rf;
#result
print "current through Ri1 is",round(Ir1*1e6,3), "microAmp"
print "current through Ri2 is",round(Ir2*1e6,3), "microAmp"
print "current through Ri2 is",round(Ir2*1e6,3),"microAmp"
print "current through Rf is",round(Irf*1e6,3), "microAmp"
print "voltage dropped is",round(Vr,3), "V"
print "output voltage 1 is",round(Vo1,3), "V"
print "output voltage is",round(Vo,3), "V"
#finding voltage current resistance
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
Ri1=950.00;#ohm
Ri2=1050.00;
Rf1=105000.00;#resistance
Rf2=95000.00;
Vin=5.00;#voltage
#calculation
Vinv=(Rf1/(Rf1+Ri1))*Vin;
Vni=Vinv;
Irf2=(Vin-Vinv)/Ri2;
Iri2=Irf2;
Vrf2=Irf2*Rf2;
Vo=Vinv-Vrf2-.014;
#result
print "inverting voltage is",round(Vinv,3), "V"
print "non inverting voltage is",round (Vni,3), "V"
print "current through Rf2 is",round(Irf2*1e6,3), "microA"
print "current through Ri2 is",round(Iri2*1e6,3), "microA"
print "voltage dropped is",round(Vrf2,3), "V"
print "output voltage is",round(Vo*1000,3), "mV"
#finding voltage current resistance
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
Vniu1=2.45;#V
Vniu2=2.55;#V
Vinvu1=2.45;
Vinvu2=2.55;
Ri1=9000.0;#ohm
Ri2=1000.0;#ohm
Rf1=1000.0;
Rf2=9000.0;
Rg=200.0;#load resistance
#calculation
Iri1=Vniu1/Ri1;
Irg=(Vniu2-Vniu1)/Rg;
Irf1=Irg-Iri1;
Vrf1=Irf1*Rf1;
Vou1=Vniu1-Vrf1;
Iri2=(Vniu2-Vou1)/Ri2;
Irf2=Iri2+Irg;
Vrf2=Irf2*Rf2#feedback resistor voltage
Vo=Vrf2+Vniu2;
#result
print "input resistor current is",round(Iri1*1e6,3), "microA"
print "input resistor current is",round(Irg*1e6,3), "microA"
print "feedback resistor current is",round(Irf1*1e6,3), "microAmp"
print "resistor voltage is",round(Vrf1*1000,3), "mV"
print "1st output voltage is",round(Vou1,3), "V"
print "input resistor current is",round(Iri2*1e6,3), "microA"
print "input resistor current is",round(Irf2*1e6,3),"microA"
print "feedback resistor voltage is",round(Vrf2,3), "V"
print "2nd output voltage is",round(Vo,3), "V"
#finding voltage current resistance
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
Vniu1=0;#V
Vinvu2=0;#V
Vref=2.56;
Rl=10000.0;#ohm
Rf=39200.0;#ohm
Ro=10.0;#resistance
Vdc1=5.0;
Vdc2=15.0;
Idc=0.5;#current
#calculation
Iu1=(Vref/Rl)*.5;
Irf=Iu1;
Vrf=Irf*Rf;
Vout=Vrf+Vinvu2;
Eo=Vout-1.2;
Iload=Vdc1/Ro;
Pload=Vdc1**2/Ro;
Plm317=(Vdc2-Vdc1)*Idc;
#result
print "input resistor current is",round(Iu1*1e6,3), "microA"
print "feedback resistor current is",round(Irf*1e6,3), "microA"
print "feedback resistor voltage is",round(Vrf,3), "V"
print "output resistor voltage is",round(Vout,3), "V"
print "output voltage is",round(Eo,3), "V"
print "load current is",round(Iload,3), "A"
print "load power is",round(Pload,3), "W"
print "power dissipated in LM317 is",round(Plm317,3), "W"
#finding voltage current resistance
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
Vin=4;#V
Vs=1.8;#V
Rf=10000.0;#ohm
Ri=1100.0;#ohm
Rl=2.0;#ohm
Rs=0.1;#ohm
#calculation
Irf=Vin/(Rf+Ri);
Vni=Irf*Ri;
Ir=Vni/Rs;
Ve=Ir*(Rl+Rs);
Vo=Ve+Vs;
#result
print "input resistor current is",round(Irf*1e6,3),"microamp"
print "inverting voltage 1 & 2 is",round(Vni*1000,3), "mV"
print "current across Rs is",round(Ir,3), "A"
print "emitter voltage is",round(Ve,3), "V"
print "output voltage is",round(Vo,3), "V"
#finding voltage and power
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
Vs=18.0;#V
Rl=8.0;#load resistance
Pll=100.0;#power
#calculation
Vlp=Vs-4;
Vlr=Vlp/(2**(.5));
Pl=(Vlr**2)/Rl;
Vl=(Pll*Rl)**(.5);
#result
print "rms voltage is",round(Vlr,3), "V"
print "power delivered is",round(Pl,3), "W"
print "load voltage is",round(Vl,3), "V"
#finding output volatage and range
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
import numpy as np
Vp=6.0;#V
Ra=10.0;#Kohm
Rb=1800.0;#ohm
V=8.0;
#solving for Ir & Vo
a=np.array([[1.0,-124.6e-6],[7800.0,-1.0]])
b=np.array([134.6e-6,0.0])
#calculation
x=np.linalg.solve(a,b);
Vo=x[1];
Va=Vo+V;
Vb=Vo-V;
#result
print "output voltage is",round(Vo,2), "V"
print "V+ is",round(Va,2), "V ;V- is",round(Vb,2), "V"
#finding output voltage and gain output voltage
#initialisation of variable
from math import pi,tan,sqrt,sin,cos,acos,atan
Vin=4.5;
R1=1100.0;
R2=10000.0;
G1=3.4#gain 1
G2=120.0#gain 2
#calculation
Ir=Vin/R1;
Vo=Ir*(R1+R2);
Vuo1=Vo/G1;
Vuo2=Vo/G2;
#result
print "output current is",round(Ir*1000,3),"mA"
print "output voltage is",round(Vo,3), "V"
print "gain output voltage 1 is",round(Vuo1,3), "V"
print "gain output voltage 2 is",round(Vuo2,2),"V"