# 6: Moving charge in electric and magnetic fields¶

## Example number 6.1, Page number 159¶

In [2]:
#importing modules
import math
from __future__ import division

#Variable declaration
theta=90-60;     #angle(degrees)
N=30;   #number of turns
i=10;   #current(A)
a=0.2;  #length(m)
B=8*10**-4;   #magnetic field of induction(Wb/m**2)

#Calculation
tow=N*a*b*B*i*math.sin(theta);   #torque on coil(Nm)

#Result
print "torque on coil is",tow*10**3,"*10**-3 Nm"

torque on coil is 2.4 *10**-3 Nm


## Example number 6.2, Page number 159¶

In [5]:
#importing modules
import math
from __future__ import division

#Variable declaration
mew0=4*math.pi*10**-7;
ia=10;    #current(A)
ib=10;    #current(A)
d=0.02;   #diameter(m)

#Calculation
F=mew0*ia*ib/(2*math.pi*d);    #force(N/m)

#Result
print "force is",F*10**3,"*10**-3 N/m"
print "force is attractive"

force is 1.0 *10**-3 N/m
force is attractive


## Example number 6.3, Page number 160¶

In [7]:
#importing modules
import math
from __future__ import division

#Variable declaration
i=0.1;   #current(A)
N=60;   #number of turns
mew0=4*math.pi*10**-7;
x=(18/2)*10**-2;    #distance(m)

#Calculation
a=mew0*i*N*(R**2);
b=((x**2)+(R**2))**(3/2);
B=2*a/(2*b);    #magnetic field of induction(Wb/m**2)

#Result
print "magnetic field of induction is",round(B*10**5,1),"*10**-5 Wb/m**2"

magnetic field of induction is 2.5 *10**-5 Wb/m**2


## Example number 6.4, Page number 160¶

In [11]:
#importing modules
import math
from __future__ import division

#Variable declaration
i=32;   #current(A)
mew0=4*math.pi*10**-7;
d=1.2*10**-3;   #distance(m)

#Calculation
B1=mew0*i/(2*math.pi*r);    #magnetic field on surface(T)
B2=B1*d;    #magnetic field at a distance(T)

#Result
print "magnetic field on surface is",round(B1*10**3,1),"mT"
print "magnetic field at a distance is",B2*10**3,"mT"
print "answer for magnetic field at a distance given in the book is wrong"

magnetic field on surface is 4.3 mT
magnetic field at a distance is 0.00512 mT
answer for magnetic field at a distance given in the book is wrong


## Example number 6.5, Page number 161¶

In [14]:
#importing modules
import math
from __future__ import division

#Variable declaration
i0=5.57;   #current(A)
mew0=4*math.pi*10**-7;
n=850;    #number of turns
l=1.23;   #length(m)

#Calculation
N=5*n/l;    #number of turns per cm
B=mew0*i0*N;     #magnetic field in solenoid(T)

#Result
print "magnetic field in solenoid is",round(B*10**3,1),"mT"

magnetic field in solenoid is 24.2 mT


## Example number 6.6, Page number 161¶

In [24]:
#importing modules
import math
from __future__ import division

#Variable declaration
i=20;   #current(A)
mew0=4*math.pi*10**-7;
n=1000;    #number of turns
l=1;      #length(m)
theta=90*math.pi/180;

#Calculation
a=l/2;
b=r/2;
c=(a**2)+(b**2);
costheta1=a/math.sqrt(c);
costheta2=-a/math.sqrt(c);
B1=mew0*n*i*(costheta1-costheta2)/2;     #magnetic field induction at the middle(Wb/m**2)
costheta_1=l/math.sqrt((l**2)+(r**2));
costheta_2=round(math.cos(theta));
B2=mew0*n*i*(costheta_1-costheta_2)/2;     #magnetic field induction at one end(Wb/m**2)

#Result
print "magnetic field induction at the middle is",round(B1*10**2,3),"*10**-2 Wb/m**2"
print "magnetic field induction at  one end is",round(B2*10**3,1),"mT"

magnetic field induction at the middle is 2.501 *10**-2 Wb/m**2
magnetic field induction at  one end is 12.5 mT


## Example number 6.7, Page number 162¶

In [26]:
#importing modules
import math
from __future__ import division

#Variable declaration
q=1.6*10**-19;   #conversion factor from eV to J
K=200*q;   #kinetic energy(J)
m=9.1083*10**-31;   #mass(kg)
B=10**-2;   #magnetic field(T)

#Calculation
p=math.sqrt(2*m*K);    #momentum(kg m/s)
d=2*math.pi*p*math.cos(theta)/(q*B);   #pitch of helix(m)

#Result
print "pitch of helix is",round(d*10**3),"mm"

radius of path is 4.772 mm
pitch of helix is 26.0 mm


## Example number 6.8, Page number 163¶

In [28]:
#importing modules
import math
from __future__ import division

#Variable declaration
q=1.6*10**-19;   #conversion factor from eV to J
K=20*q;   #kinetic energy(J)
m=9.1*10**-31;   #mass(kg)
B=10**2;   #magnetic field(T)

#Calculation
v=math.sqrt(2*K/m);    #velocity(m/sec)

#Result
print "radius of path is",round(r*10**8,2),"*10**-8 m"

radius of path is 15.08 *10**-8 m


## Example number 6.9, Page number 164¶

In [32]:
#importing modules
import math
from __future__ import division

#Variable declaration
m=9.1*10**-31;   #mass(kg)
B=0.1;   #magnetic field(Wb/m**2)
v=10**4;   #velocity(m/s)
q=1.6*10**-19;   #conversion factor from eV to J

#Calculation
f=v/(2*math.pi*r);    #frequency of revolution(rev/sec)

#Result
print "radius of path is",round(r*10**7,2),"*10**-7 m"
print "frequency of revolution is",round(f/10**9,1),"*10**9 rev/sec"

radius of path is 5.69 *10**-7 m
frequency of revolution is 2.8 *10**9 rev/sec


## Example number 6.10, Page number 164¶

In [35]:
#importing modules
import math
from __future__ import division

#Variable declaration
s=0.1;    #distance(m)
v=3*10**6;   #velocity(m/s)
y=2*10**-3;   #deflected distance(m)
E=0.18;    #static electric field(V/m)

#Calculation
t=s/v;   #time(sec)
ebym=2*y/(E*(t**2));   #e/m of electron(C/kg)

#Result
print "e/m of electron is",ebym,"C/kg"
print "answer given in the book is wrong"

e/m of electron is 2e+13 C/kg
answer given in the book is wrong


## Example number 6.11, Page number 165¶

In [38]:
#importing modules
import math
from __future__ import division

#Variable declaration
I=5;    #current(A)
B=1.2;   #magnetic field(T)
t=0.1*10**-2;    #thickness(m)
q=1.6*10**-19;   #conversion factor from eV to J
n=8.48*10**28;   #concentration(electron/m**3)

#Calculation
VH=I*B/(n*q*t);    #hall voltage(V)

#Result
print "hall voltage is",round(VH*10**6,4),"micro V"

hall voltage is 0.4422 micro V


## Example number 6.12, Page number 165¶

In [44]:
#importing modules
import math
from __future__ import division

#Variable declaration
i=0.5;   #current(A)
mew0=4*math.pi*10**-7;
N=200;    #number of turns

#Calculation
B=8*mew0*N*i/(R*math.sqrt(125));     #magnetic field induction(Wb/m**2)
B=round(B,4);
H=B/mew0;      #intensity of magnetic field(A/m**2)

#Result
print "magnetic field induction is",B*10**3,"*10**-3 Wb/m**2"
print "intensity of magnetic field is",round(H),"A/m**2"
print "answer varies due to rounding off errors"

magnetic field induction is 1.8 *10**-3 Wb/m**2
intensity of magnetic field is 1432.0 A/m**2
answer varies due to rounding off errors


## Example number 6.14, Page number 166¶

In [49]:
#importing modules
import math
from __future__ import division

#Variable declaration
q=1.6*10**-19;   #conversion factor from eV to J
m=3.3*10**-27;   #mass(kg)
t=10**-7;   #time(sec)

#Calculation
B=2*math.pi*m/(q*t);   #magnetic flux density(Wb/m**2)
v=B*q*r/m;     #velocity of particle(m/s)

#Result
print "magnetic flux density is",round(B,3),"Wb/m**2"
print "velocity of particle is",round(v/10**7,2),"*10**7 m/sec"

magnetic flux density is 1.296 Wb/m**2
velocity of particle is 1.88 *10**7 m/sec


## Example number 6.15, Page number 167¶

In [52]:
#importing modules
import math
from __future__ import division

#Variable declaration
q=1.6*10**-19;   #conversion factor from eV to J
i=1;   #current(amp)
n=10**28;    #concentration(electron/m**3)
rho=1.7*10**-8;    #resistivity of Cu(ohm m)

#Calculation
A=math.pi*(r**2);    #area(m**2)
vd=1/(n*q*A);    #drift velocity(m/sec)
E=rho*i/A;    #electric field(v/m)

#Result
print "drift velocity is",round(vd*10**4,2),"*10**-4 m/sec"
print "electric field is",round(E*10**2,3),"*10**-2 v/m"

drift velocity is 6.58 *10**-4 m/sec
electric field is 1.789 *10**-2 v/m