Chapter 8: DC TRANSIENTS

Example 8.1,Page number: 207

In [1]:
#Question:
"""Finding the current i(0+)=I0."""

#Variable Declaration:
V=24                 #Supply voltage(in Volts)


#Calculations:
Req=20+(1.0/((1.0/20)+(1.0/10)))
I=V/Req
I_L=I*(20.0/(20+10))
Io=I_L
i_0_plus=Io
R=20
v_R=(-Io)*R
R1=(20+10)
v_L=Io*R1


#Result:
print "(a)The current i(0+)=Io=%.2f A." %(i_0_plus)
print "(b)The magnitude of v_R across the 20 Ohms resistor at the instant just after the switch is opened is %.2f V." %(v_R)
print "(c)The magnitude of v_L across the inductor immediately after the switch is opened is %.2f V." %(v_L)
(a)The current i(0+)=Io=0.60 A.
(b)The magnitude of v_R across the 20 Ohms resistor at the instant just after the switch is opened is -12.00 V.
(c)The magnitude of v_L across the inductor immediately after the switch is opened is 18.00 V.

Example 8.2,Page number: 208

In [3]:
#Question:
"""Finding i(0),the power being absorbed by the inductor at t=1 s."""

from math import e,pow,sqrt,log

#Variable Declaration:
L=1.6                #Self-inductance of the inductor(in Henry)
R=0.8                #Resistance of the resistor(in Ohms)
t=-1.0               #Instant of time(in seconds) 
i_minus_1=20.0       #Current at t=1 seconds(in Amperes)


#Calculations:
time_const=L/R
Io=i_minus_1/pow(e,(-t/time_const))
t=1
i_t=Io*pow(e,(-t/time_const))
p_t=i_t*i_t*R
W=100.0
i_t1=sqrt((2*W)/L)
t=-(log(i_t1/Io))*time_const


#Result:
print "(a)i(0) = %.3f A." %(Io)
print "(b)The power absorbed by the resistor is %.2f W. " %(p_t)    
print "   The inductor by virtue of the emf induced in it,supplies this power to the resistor."
print "   Therefore,the power absorbed by the inductor is %.2f W." %(-p_t)
print "(c)The time at which the energy stored in the inductor is 100J is %.5f seconds." %(t)
(a)i(0) = 12.131 A.
(b)The power absorbed by the resistor is 43.31 W. 
   The inductor by virtue of the emf induced in it,supplies this power to the resistor.
   Therefore,the power absorbed by the inductor is -43.31 W.
(c)The time at which the energy stored in the inductor is 100J is 0.16315 seconds.

Example 8.3,Page number: 210

In [13]:
#Question:
"""Finding the value of current in the circuit at an instant 0.4 s after the switch has been closed."""

from math import e,pow,log

#Variable Declaration:
L=14.0                #Self-inductance of the inductor(in Henry)
R=10.0                #Resistance of the resistor(in Ohms)
V=140.0               #Supply Voltage(in Volts)


#Calculations:
time_const=L/R
t=0.4
Io=V/R
i=Io*(1-pow(e,(-t/time_const)))
i_t=8
t=-time_const*log(i_t/Io)


#Result:
print "(a)The value of current in the circuit at an instant 0.4 s after the switch has been closed is %.3f A." %(i)
print "(b)The time taken for the current to drop to 8 A after the switch is opened is %.4f seconds." %(t)
(a)The value of current in the circuit at an instant 0.4 s after the switch has been closed is 3.479 A.
(b)The time taken for the current to drop to 8 A after the switch is opened is 0.7835 seconds.

Example 8.4,Page number: 210

In [14]:
#Question:
"""Finding the magnitude of the inductor current at t=0- and at t=0+."""

from math import pow,e

#Variable Declaration:
L=40e-03              #Self-inductance of the inductor(in Henry)
R=80.0                #Resistance of the resistor(in Ohm) 
V1=20.0               #Supply voltage-1(in Volts) 
V2=40.0               #Supply voltage-2(in Volts)


#Calculations:
time_const=L/R
I_01=V1/R
i_0_minus=I_01
i_0_plus=I_01
I_02=(V1+V2)/R
t=1e-03
i_t=I_01+(I_02-I_01)*(1-pow(e,(-t/time_const)))


#Result:
print "(a)The magnitude of inductor current at t=0- is %.2f A." %(i_0_minus)
print "(b)The magnitude of inductor current at t=0+ is %.2f A." %(i_0_plus)
print "(c)As  t tends to infinity,the current approaches its final steady-state value given as %.2f A." %(I_02)
print "(d)The magnitude of inductor current at t=1 ms is %.3f A." %(i_t)
(a)The magnitude of inductor current at t=0- is 0.25 A.
(b)The magnitude of inductor current at t=0+ is 0.25 A.
(c)As  t tends to infinity,the current approaches its final steady-state value given as 0.75 A.
(d)The magnitude of inductor current at t=1 ms is 0.682 A.

Example 8.5,Page number: 211

In [11]:
#Question:
"""Finding i_L(0-),i2(0-),i_L(0+),i_L(20 ms) and i_2(20 ms)."""

from math import e,pow

#Variable Declaration:
V=20.0                #Source Voltage(in Volts)
R1=20.0               #Resistance of resistor-1(in Ohms)
R2=40.0               #Resistance of resistor-2(in Ohms)
R3=30.0               #Resistance of resistor-3(in Ohms)
R4=25.0               #Resistance of resistor-4(in Ohms)
R5=5.0                #Resistance of resistor-5(in Ohms)
L=2.0                 #Self-inductance of inductor(in Henry)


#Calculations:
Io=V/(R4+R5)
i_L_0_minus=Io
i_2_0_minus=V/R3
i_L_0_plus=Io
R_45=R4+R5
R_12=R1+R2
Req=R_45+(1/((1/R_12)+(1/R3)))
time_const=L/Req
t=20e-03
i_L_t=Io*pow(e,(-t/time_const))
i_2_t=-i_L_t*(R_12/(R_12+R3))


#Result:
print "(a)i_L(0-) = %.3f A." %(i_L_0_minus)
print "(b)i_2(0-) = %.3f A." %(i_2_0_minus)
print "(c)i_L(0+) = %.3f A." %(i_L_0_plus)
print "(d)i_L(20 ms) = %.3f A." %(i_L_t)
print "(e)i_2(20 ms) = %.3f A." %(i_2_t)
(a)i_L(0-) = 0.667 A.
(b)i_2(0-) = 0.667 A.
(c)i_L(0+) = 0.667 A.
(d)i_L(20 ms) = 0.404 A.
(e)i_2(20 ms) = -0.270 A.

Example 8.6,Page number: 215

In [6]:
#Question:
"""Finding v(0+),i(0+) and time constant."""

from  math import e,pow

#Variable Declaration:
R=1.5e03              #Resistance of the resistor(in Ohms) 
C=5e-06               #Capacitance of the capacitor(in Farad)
Vo=3.0                #Source Voltage(in Volts)
v_0_plus=0            #Voltage across capacitor at t=0+(in Volts)  
v_0_minus=0           #Voltage across capacitor at t=0-(in Volts)


#Calculations:
Io=Vo/R
i_0_plus=Io
time_const=R*C
t=15e-03
v=Vo*(1-pow(e,(-t/time_const)))  
i=Io*pow(e,(-t/time_const))


#Result:
print "(a)Since the voltage across a capacitor cannot change instantaneously, we have, v(0+)=%d V." %(v_0_plus)
print "(b)i(0+)= %.3f mA." %(i_0_plus*1000)
print "(c)The time constant is %.2f ms." %(time_const*1000)
print "(d)At t=15 ms, \n   v=%.5f V.   \n   i=%.4f mA." %(v,(i*1000))
(a)Since the voltage across a capacitor cannot change instantaneously, we have, v(0+)=0 V.
(b)i(0+)= 2.000 mA.
(c)The time constant is 7.50 ms.
(d)At t=15 ms, 
   v=2.59399 V.   
   i=0.2707 mA.

Example 8.7,Page number: 216

In [7]:
#Question:
"""Finding v(0+),i(0+) and time constant."""

from  math import e,pow

#Variable Declaration:
R=100                 #Resistance of the resistor(in Ohms)
C=5e-06               #Capacitance of the capacitor(in Farads) 
Vo=3.0                #Source Voltage(in Volts)


#Calculations:
v_0_plus=Vo
v_0_minus=Vo
Io=Vo/R
i_0_plus=-Io
time_const=R*C
t=1.2e-03
v=Vo*pow(e,(-t/time_const))  
i=-Io*pow(e,(-t/time_const))


#Result:
print "(a)Since the voltage across a capacitor cannot change instantaneously, we have, v(0+)=%d V." %(v_0_plus)
print "(b)At t=0+, the capacitor behaves as a voltage source of emf Vo. Hence, i(0+)= -Io = %.3f mA." %(i_0_plus*1000)
print "(c) The time constant is %.2f ms." %(time_const*1000)
print "(d)At t=1.2 ms, \n   v=%.5f V.   \n   i=%.4f mA." %(v,(i*1000))
(a)Since the voltage across a capacitor cannot change instantaneously, we have, v(0+)=3 V.
(b)At t=0+, the capacitor behaves as a voltage source of emf Vo. Hence, i(0+)= -Io = -30.000 mA.
(c) The time constant is 0.50 ms.
(d)At t=1.2 ms, 
   v=0.27215 V.   
   i=-2.7215 mA.

Example 8.8,Page number: 218

In [4]:
#Question:
"""Finding the current i(t) for t>0 seconds."""

#Calculations:
""" R_Th=(1+10)kilo ohm || (1 kiloohm) """   #Thevenin's Equivalent Resistance(in Ohms) 

print("Note: All currents expressed in mA \n")
R_Th=1.0/((1.0/11000)+(1.0/1000))
C=10e-06
time_const=R_Th*C
v_C_0_minus=30.0*((1e03)/((1e03)+(1e03)))

""" Applying KVL, 30-(i_0_plus*(1 kilo ohm))-15=0 """

i_0_plus=(30-15)/1.0
i_infinity=30.0/(1+1+10)


#Result:
print "i(t)= (%.1f + (%.1f-%.1f)*(e to the power -t/%.2f ms)) mA." %(i_infinity,i_0_plus,i_infinity,(time_const*1000))
Note: All currents expressed in mA 

i(t)= (2.5 + (15.0-2.5)*(e to the power -t/9.17 ms)) mA.

Example 8.9,Page number: 220

In [10]:
#Question:
"""Finding the current at t=1 seconds."""

from math import exp,log

#Variable Declaration:
R=3.0                 #Resistance of the coil(in Ohms)
time_const=1.8        #Time constant of the coil(in seconds)
V=10.0                #Supply voltage(in Volts)


#Calculations:
L=time_const*R
i_0_plus=0
I0=V/R
i=I0*(1-exp((-1/time_const)))
t=(log(0.5,e))*(-1.8)
growth=V/L


#Result:
print "(a)The current at t=1 seconds is given as %.2f A." %(i)
print "(b)The time at which current attains half of its final value is %.2f seconds." %(t)
print "(c)The initial rate of growth of current is %.2f A/s." %(growth)
(a)The current at t=1 seconds is given as 1.42 A.
(b)The time at which current attains half of its final value is 1.25 seconds.
(c)The initial rate of growth of current is 1.85 A/s.

Example 8.10,Page number: 220

In [12]:
#Question:
"""Finding the value of current during a sudden change."""

#Calculations:
"""If I0 is the final steady-state value of current,at t=1 s, we have
     
              i=Io*(1-exp(-1/time_const)) or (0.741*Io)=Io*(1-exp(-1/time_const));
              
              exp(-1/time_const)=0.259;
              
    During the decay of current,we have i(t)=Io*exp(-1/time_const);          
    
    Therefore, at t=1s, we have
    
    i1=0.259*Io.
    
    Therefore the value of current in the circuit is 0.259 times the steady state value."""
k=1-0.741


#Result:
print "The value of current in the circuit is %.3f times the steady state value." %(k)
The value of current in the circuit is 0.259 times the steady state value.

Example 8.11,Page number: 220

In [14]:
#Question:
"""Finding the current in the circuit at t=0.6 s."""

#Variable Declaration:
V=120.0               #Supply dc voltage(in Volts)
R=20.0                #Resistance of the resistor(in Ohms)
L=8.0                 #Inductance of the inductor(in Henry)


#Calculations:
time_const=L/R
Io=V/R
i=Io*(1-exp(-0.6/time_const))
"""The voltage drop across R,v_R=i*r=Io*(1-exp(-t/time_const))*R;
   The voltage drop across L,v_L=L*(di/dt)=((L*Io)/time_const)*exp(-t/time_const);  
   
   We are to find the time at which these two voltage-drops are same. """
t=-time_const*log(0.5,e)


#Result:
print "(a)The current in the circuit at t=0.6 s is %.2f A." %(i)
print "(b)The time at which the voltage drops across R and L are same is %.3f s." %(t)
(a)The current in the circuit at t=0.6 s is 4.66 A.
(b)The time at which the voltage drops across R and L are same is 0.277 s.

Example 8.12,Page number: 221

In [15]:
#Question:
"""Finding the energy stored in the magnetic field."""

#Variable Declaration:
V=30.0               #Supply dc voltage(in Volts)
R=12.0                #Resistance of the resistor(in Ohms)
L=18.0                 #Inductance of the inductor(in Henry)


#Calculations:
time_const=L/R
rate_curr=V/L
Io=V/R
i1=(V/R)*(1-exp(-3.0/time_const))
W1=0.5*i1*i1*L
Wlost=(0.5*L*Io*Io)-W1


#Result:
print "(a)The time constant is %.2f seconds." %(time_const)
print "(b)The initial rate of change of current is %.3f A/s." %(rate_curr)
print "(c)The current at t=3 s is %.2f A." %(i1)
print "(d)The energy stored in the magnetic field at t=3 s is %.3f J." %(W1)
print  "(e)The energy lost as heat till t=3 s is %.3f J." %(Wlost)
(a)The time constant is 1.50 seconds.
(b)The initial rate of change of current is 1.667 A/s.
(c)The current at t=3 s is 2.16 A.
(d)The energy stored in the magnetic field at t=3 s is 42.055 J.
(e)The energy lost as heat till t=3 s is 14.195 J.

Example 8.13,Page number: 221

In [3]:
#Question:
"""Finding the voltage and current at different time instants."""

#Variable Declaration:
R1=200.0              #Resistance of resistor 1(in Ohms)
L=5e-03               #Inductance of the coil(in Henry)
R2=17.0               #Resistance of resistor 2(in Ohms)


#Calculations:
i_0_plus=20e-03
v_0_plus=i_0_plus*R2
time_const=L/R1
v_L_0_plus=(L*i_0_plus)/time_const
t=20e-06 
i_20=i_0_plus*exp(-t/time_const)
v_20=v_0_plus
t=50e-06
i_50=i_0_plus*exp(-t/time_const)
v_50=v_0_plus


#Result:
print "(a)The value of i(0+)=%e A." %(i_0_plus) 
print "(b)The value of v(0+)=%.3f V." %(v_0_plus)
print "(c)The value of v_L(0+)=%.3f V." %(v_L_0_plus)
print "(d)The value of i at t=20 micro seconds is %e A and v=%.3f V." %(i_20,v_20)
print "(d)The value of i at t=50 micro seconds is %e A and v=%.3f V." %(i_50,v_50)
(a)The value of i(0+)=2.000000e-02 A.
(b)The value of v(0+)=0.340 V.
(c)The value of v_L(0+)=4.000 V.
(d)The value of i at t=20 micro seconds is 8.986579e-03 A and v=0.340 V.
(d)The value of i at t=50 micro seconds is 2.706706e-03 A and v=0.340 V.

Example 8.14,Page number: 222

In [5]:
#Question:
"""Finding the currents at t=5 mill seconds."""

#Variable Declaration:
L=0.8                 #Self Inductance of the coil(in Henry)


#Calculations:
i_L_0_minus=(120e-03)*(200.0/(200.0+40.0))
Req=40+(1.0/((1.0/800.0)+(1.0/200.0)))
time_const=L/Req
t=5e-03 
i_L=i_L_0_minus*exp(-t/time_const)
i_x=-i_L*(800.0/(800.0+200.0))
i_y=(120e-03)+(-i_L*(200.0/(200.0+800.0)))


#Result:
print "At t=5 milli seconds," 
print "(a)The current i_L=%e A." %(i_L)
print "(b)The current i_x=%e A." %(i_x)
print "(c)The current i_y=%e A." %(i_y)
At t=5 milli seconds,
(a)The current i_L=2.865048e-02 A.
(b)The current i_x=-2.292038e-02 A.
(c)The current i_y=1.142699e-01 A.

Example 8.15,Page number: 223

In [8]:
#Question:
"""Finding the current through an inductor at the time of switching."""

#Variable Declaration:
L=4.0                 #Self inductance of inductor(in Henry)
R=10.0                #Resistance of resistor parallel to the inductor(in Ohms)


#Calculations:
"""By superposition theorem, I_L_0=I_L_1+I_L_2; """
I_L1=12.0/4.0
I_L2=2.0
I_L0=I_L1+I_L2
i_L_0_plus=I_L0
w_L_0_plus=0.5*L*I_L0*I_L0
time_const=L/R
t=1.0
i_L=I_L0*exp(-t/time_const)
v_10=-i_L*R


#Result:
print "(a)The current i_L(0+)=%.2f A. The energy stored in the inductor is w_L(0+)=%.2f J." %(i_L_0_plus,w_L_0_plus)
print "(b)At t=1 second, the current in the inductance is %.2f A and the voltage v_10=%.2f V." %(i_L,v_10)   
(a)The current i_L(0+)=5.00 A. The energy stored in the inductor is w_L(0+)=50.00 J.
(b)At t=1 second, the current in the inductance is 0.41 A and the voltage v_10=-4.10 V.

Example 8.16,Page number: 223

In [10]:
#Question:
"""Finding the energy stored in the inductor."""

#Variable Declaration:
L=5e-03               #Self inductance of inductor(in Henry)
R=200.0               #Resistance of resistor(in Ohms)


#Calculations:
I_L0=5e-03
time_const=L/R
t=20e-06
i_L=I_L0*exp(-t/time_const)
w=0.5*L*i_L*i_L


#Result:
print "The energy stored in the inductor after 20 micro seconds of throwing the switch is %e J." %(w)
The energy stored in the inductor after 20 micro seconds of throwing the switch is 1.261853e-08 J.

Example 8.17,Page number: 224

In [13]:
#Question:
"""Finding the current in the circuit."""

#Variable DEclaration:
L=8.0                 #Self inductance of the coil(in Henry)
R=20.0                #Resistance of resistor(in Ohms)
V=120.0               #Voltage of the supply(in Volts) 


#Calculations:
Io=V/R
time_const=L/R
t=0.6
i_t=Io*(1-exp(-t/time_const))
""" The voltage of R at any time is given as v_R(t)=6*(1-exp(-t/0.4))*20=120*(1-exp(-t/0.4));

    The voltage across L at any time is v_L(t)=L*(di/dt)=120*exp(-t/0.4);
    
    Applying v_L(t)=v_R(t), """
t=-log(120.0/240.0)*0.4


#Result:
print "(a)The current in the circuit at t=0.6 seconds is %.2f A." %(i_t)
print "(b)The time at which the voltage drops across R and L are same is %.4f seconds."%(t)
(a)The current in the circuit at t=0.6 seconds is 4.66 A.
(b)The time at which the voltage drops across R and L are same is 0.2773 seconds.

Example 8.18,Page number: 224

In [16]:
#Question:
"""Finding the current i_x in the circuit at different time instants."""

#Variable Declaration:
L=25e-03              #Self inductance of the coil(in Henry)


#Calculations:
I_L0=(10e-03)*(80.0/(80.0+20.0))
i_x_minus_2=I_L0
i_x_0_minus=I_L0
i_x_0_plus=I_L0*(30.0/(30.0+20.0))
Req=1.0/((1.0/20.0)+(1.0/30.0))
time_const=L/Req
t=2e-03
i_L_2=I_L0*exp(-t/time_const)
i_x_2=i_L_2*(30.0/(30.0+20.0))
t=4e-03
i_L_4=I_L0*exp(-t/time_const)
i_x_4=i_L_4*(30.0/(30.0+20.0))


#Result:
print "The current i_x:" 
print "At t=-2 ms, i_x=%e A." %(i_x_minus_2)   
print "At t=0- ms, i_x=%e A." %(i_x_0_minus)
print "At t=0+ ms, i_x=%e A." %(i_x_0_plus)
print "At t=2 ms, i_x=%e A." %(i_x_2)
print "At t=4 ms, i_x=%e A." %(i_x_4)
The current i_x:
At t=-2 ms, i_x=8.000000e-03 A.
At t=0- ms, i_x=8.000000e-03 A.
At t=0+ ms, i_x=4.800000e-03 A.
At t=2 ms, i_x=1.837886e-03 A.
At t=4 ms, i_x=7.037134e-04 A.

Example 8.19,Page number: 225

In [15]:
#Question:
"""Finding the current and voltage at the time of switching."""

#Variable Declaration: 
V=1.5                 #Voltage of the supply(in Volts)
R1=5e-03              #Resistance of resistor 1(in Ohms) 
R2=1.5e03             #Resistance of resistor 2(in Ohms)


#Calculations:
"""Before the switch is thrown from a to b,the capacitor is fully charged to supply voltage.

   When switching takes place,the capacitor starts discharging through the 5 milli Ohms resistance.""" 
V0=V
v_0_plus=V0
i_0_plus=V0/R1


#Result:
print "The voltage v(0+)=%.2f V and the current i(0+)=%.2f A." %(v_0_plus,i_0_plus)
The voltage v(0+)=1.50 V and the current i(0+)=300.00 A.

Example 8.20,Page number: 226

In [25]:
#Question:
"""Finding the voltage and current at different time intervals."""

#Variable Declaration:
C=5e-06               #Capacitance of the capacitor(in Farads)
V=6.0                 #Voltage of the supply(in Volts) 


#Calculations:
v_0_minus=6.0*((3.0+2.0)/(3.0+2.0+1.0))
R=(1e03+3e03+2e03)
i_0_minus=V/R
v_0_plus=v_0_minus
Vo=v_0_plus
Req=(5e03+3e03+2e03)
time_const=Req*C
i_0_plus=v_0_plus/Req
Io=i_0_plus
t=0.05
v_t1=Vo*exp(-t/time_const)
i_t1=Io*exp(-t/time_const)
t=0.10
v_t2=Vo*exp(-t/time_const)
i_t2=Io*exp(-t/time_const)


#Result:
print "The values of v(t) and i(t) are: "
print "At t=0- s, v(t)=%.3f V and i(t)=%e A." %(v_0_minus,i_0_minus)
print "At t=0+ s, v(t)=%.3f V and i(t)=%e A." %(v_0_plus,i_0_plus)
print "At t=0.05 s, v(t)=%.3f V and i(t)=%e A." %(v_t1,i_t1)
print "At t=0.10 s, v(t)=%.3f V and i(t)=%e A." %(v_t2,i_t2)
The values of v(t) and i(t) are: 
At t=0- s, v(t)=5.000 V and i(t)=1.000000e-03 A.
At t=0+ s, v(t)=5.000 V and i(t)=5.000000e-04 A.
At t=0.05 s, v(t)=1.839 V and i(t)=1.839397e-04 A.
At t=0.10 s, v(t)=0.677 V and i(t)=6.766764e-05 A.

Example 8.21,Page number: 227

In [30]:
#Question:
"""Finding the voltage and current at the time of switching."""

#Calculations:
"""Using current divider rule, the current through branch AB is determined.""" 
I_AB=10e-03*(1000.0/(1000.0+(800.0+200.0)))
v_0_minus=I_AB*800.0
V_AB=v_0_minus
v_0_plus=V_AB
i_C_0_plus=V_AB/(1.0/((1.0/200.0)+(1.0/800.0)))
i_0_plus=i_C_0_plus*(800.0/(800.0+200.0))


#Result:
print "The value of v(0+)=%.2f V and the current i(0+)=%e A." %(v_0_plus,i_0_plus)
The value of v(0+)=4.00 V and the current i(0+)=2.000000e-02 A.

Example 8.22,Page number: 227

In [27]:
#Question:
"""Finding the voltages across resistor,capacitor and switch."""

#Variable Declaration:
V=12.0                #Voltage of the supply(in Volts)
C=50e-03              #Capacitance of the capacitor(in Farads)


#Calculations:
v_C_0_minus=12.0*(20.0/(20.0+4.0))
v_C_0_plus=v_C_0_minus
Vo=v_C_0_plus
Req=5.0+20.0
time_const=Req*C
t=1.0
v_C1=Vo*exp(-t/time_const)
v_R1=v_C1*(20.0/(20.0+5.0))
v_SW1=V-V_R1


#Result:
print "The value of v_C at t=1 second is %.3f V." %(v_C1) 
print "The value of v_R at t=1 second is %.3f V." %(v_R1)
print "The value of v_SW at t=1 second is %.3f V." %(v_SW1)
The value of v_C at t=1 second is 4.493 V.
The value of v_R at t=1 second is 3.595 V.
The value of v_SW at t=1 second is 8.405 V.