from __future__ import division
R1=2
R2=4
R3=5
R4=7
R_eq=R1+R2+R3+R4
v=6#in v
print "Solution a"
print "Equivalent resistance = %0.2f ohm"%R_eq
print "Solution b"
I=v/R_eq
print "Current = %0.2f Amps"%I
delta_V=18#in volt
R1=3#in ohm
R2=6#in ohm
R3=9#in ohm
I1=delta_V/R1
I2=delta_V/R2
I3=delta_V/R3
print "solution a"
print "Current = %0.2f amps"%I1
print "Current = %0.2f amps"%I2
print "Current = %0.2f amps"%I3
P1=(I1**2)*R1
P2=(I2**2)*R2
P3=(I3**2)*R3
print "solution B"
print "Power = %0.2f watt"%P1
print "Power = %0.2f watt"%P2
print "Power = %0.2f watt"%P3
delta_Vac=42#in volt
R_eq=14#in ohm
I=delta_Vac/R_eq
print "solution b"
print "Current = %0.2f amps"%I
from numpy import mat
#formula used x=inv(a)*b
I=mat([[1 ,-1, -1],[-4, 0 ,-9],[0, -5, 9]])
V=mat([[0],[6],[0]])
X=(I**-1)
a=X*V
print "Current value I1 = %0.2f, I2 = %0.2f & I3 = %0.2f amps"%(a[0],a[1],a[2])
from numpy import mat
#prob
#formula used x=inv(a)*b
I=mat([[8, 2, 0],[-3, 2, 0],[1, 1, -1]])
V=mat([[10],[-12],[0]])
X=I**-1
a=X*V
print "Current value I1 = %0.2f, I2 = %0.2f & I3 = %0.2f amps"%(a[0],a[1],a[2])
R=8*10**5#in ohms
C=5*10**-6#in Farad
t=R*C
print "Constant of the circuit = %0.2f s"%t
Q=C*12
print "Charge = %0.2e columb"%Q
q=0.632*Q
print "Charge = %0.2e columb when capacitance 63.2%%"%q
from math import log
x=log(4)
print "time = %0.2f s "%x