import scipy
import scipy.integrate
#Variable Declaration
u2=20
B2=4
l=0.06
#Calculations
def ansa(x,y):
return 4*10**3
Va, erra = scipy.integrate.dblquad(lambda y , x: ansa(x,y), #in V
0, 0.06, lambda y: 0, lambda y: 0.08)
Vb=-u2*B2*l #in mV
def ansc(x,y):
return 4
psic, errc = scipy.integrate.dblquad(lambda y , x: ansc(x,y), #in mWb
0, 0.06, lambda y: 0, lambda y: 1)
#Results
print 'Va =',Va,'sin(10^6t) V'
print 'Vb =',Vb,'mV'
print 'Vc= ',psic*10**3,'cos(10^6t-y) -',psic*10**3,'cos(10^6t) V'
import scipy
#Variable Declaration
n1=200
n2=100
S=10**-3 #cross section in m^2
muo=4*scipy.pi*10**-7 #permeabiility of free space
mur=500 #relative permeability
r=10*10**-3 #radius in m
#Calculations
psiI=n1*muo*mur*S/(2*scipy.pi*r)
#Result
print 'V2 =',psiI*n2*300*scipy.pi,'cos(100pi t) V'
print '= 6Pi cos(100pi t) V'
import scipy
import cmath
from numpy import *
#Variable Declaration
z3=1j
z4=3+4j
z5=-1+6j
z6=3+4j
z7=1+1j
z8=4-8j
#Calculations
z1=(z3*z4/(z5*z6))
z2=scipy.sqrt(z7/z8)
z1r=round(z1.real,4) #real part of z1 rounded to 4 decimal places
z1i=round(z1.imag,4) #imaginary part of z1 rounded to 4 decimal places
z2r=round(z2.real,4) #real part of z2 rounded to 4 decimal places
z2i=round(z2.imag,4) #imaginary part of z2 rounded to 4 decimal places
absz2=round(abs(z2),4) #absolute value of z2 rounded to 4 decimal places
ang=scipy.arctan(z2i/z2r)*180/scipy.pi #in degrees
#Results
print 'z1 =',z1r,'+',z1i,'j'
print 'z2 ='
print 'mod =',absz2,'and angle=',round(ang,1),'degrees'