# 1: Electric and Magnetic Fields¶

## Example number 1.1, Page number 4¶

In [1]:
#import modules
import math
from __future__ import division

#Variable declaration
q1=3.2*10**-19;
q2=q1;                #q1 and q2 are the values of charge on alpha-particle(C)
d=10**-13;            #distance between two alpha-particles(m)
m1=6.68*10**-27;
m2=m1;          #m1 and m2 are masses of alpha-particles(kg)
G=6.67*10**-11;       #Gravitational constant(Nm^2/kg^2)

#Calculation
F1=(9*10**9)*(q1*q2)/(d**2);       #calculation of electrostatic force(N)
F2=G*(m1*m2)/(d**2);        #calculation of electrostatic force(N)
F1=math.ceil(F1*10**4)/10**4;   #rounding off to 4 decimals
F1 = F1*10**2;

#Result
print "The electrosatic force is",F1,"*10**-2 N"
print "The gravitational force is",round(F2/1e-37,3),"*10**-37 N"

The electrosatic force is 9.22 *10**-2 N
The gravitational force is 2.976 *10**-37 N


## Example number 1.2, Page number 4¶

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

#Variable declaration
m=9.1*10**-31;       #mass of elctron(kg)
q=1.6*10**-19;       #charge on electron(C)
g=9.81;           #acceleration due to gravity(m/s^2)

#Calculation
Fg=m*g;                #gravitational force(N)
d=math.sqrt((9*10**9*q**2)/Fg);            #equating gravitational force with electrosatic force(m)
d=math.ceil(d*10**3)/10**3;            #rounding off to 4 decimals

#Result
print "The distance of separation is",d,"m"

The distance of separation is 5.081 m


## Example number 1.3, Page number 4¶

In [3]:
#import modules
import math
from __future__ import division

#Variable declaration
d=0.02;          #distance between plates(m)
V=400;           #potential differnce of plates(V)
q=1.6*10**-19;         #charge on a proton(C)

#Calculation
E=V/d;       #electric field intensity between plates(V/m)
F=q*E;       #electrostatic force on oil drop(N)

#Result
print "The electric field intensity between plates is",E,"V/m"
print "The force on proton is",F,"N"

The electric field intensity between plates is 20000.0 V/m
The force on proton is 3.2e-15 N


## Example number 1.4, Page number 4¶

In [4]:
#import modules
import math
from __future__ import division

#Variable declaration
d=0.02;           #distance between plates(m)
q=1.6*10**-19;       #charge on oil drop(C)
V=6000;              #potential differnce of plates(V)
g=9.81;              #acceleration due to gravity(m/s^2)

#Calculation
E=V/d;       #electric field intensity between plates(V/m)
F=q*E;       #electrostatic force on oil drop(N)
m=F/g;       #equating the weight of oil drop to the electrostatic force on it(kg)

#Result
print "The mass of oil drop is",round(m/1e-15,3),"*10**-15 kg"

The mass of oil drop is 4.893 *10**-15 kg


## Example number 1.5, Page number 5¶

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

#Variable declaration
V=150;             #potential difference between anode and cathode(V)
m=9.31*10**-31;    #mass of an electron(kg)
q=1.6*10**-19;     #charge on an electron(C)

#Calculation
E=q*V;            #energy gained by electron during speeding from cathode to anode(J)
vel=math.sqrt(E*2/m);    #equating with kinetic energy of electron(m/s)
vel=vel*10**-6;
vel=math.ceil(vel*10)/10;   #rounding off to 1 decimal

#Result
print "The velocity is",vel,"*10**6 m/s"
print "answer in the book is wrong by 1 decimal"

The velocity is 7.2 *10**6 m/s
answer in the book is wrong by 1 decimal


## Example number 1.6, Page number 5¶

In [6]:
#import modules
import math
from __future__ import division

#Variable declaration
V=5*10**6;       #potential differnce through which alpha-particle is accelerated(V)
e=1.6*10**-19;         #charge on electron(C)

#Calculation
E1=2*V;      #electronic charge on alpha-particle(eV)
E2=E1/10**6;      #energy(MeV)
E3=E1*e;         #energy(J)
E1=E1*10**-7;

#Result
print "The energy is",E1,"*10**7 eV"
print "The energy is",E2,"MeV"
print "The energy is",E3,"J"

The energy is 1.0 *10**7 eV
The energy is 10.0 MeV
The energy is 1.6e-12 J


## Example number 1.7, Page number 6¶

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

#Variable declaration
q=-1.6*10**-19;        #charge on electron(C)
Q=1.6*10**-19;         #charge on Hydrogen nucleus(C)
Eo=8.854*10**-12;      #permittivity in free space(F/m)

#Calculation
E=(q*Q)/(8*3.14*Eo*r);       #electric field intensity between plates(V/m)
E1=E/(1.6*10**-19);          #electrifeild intensity(eV)
E=E*10**19;
E=math.ceil(E*10**2)/10**2;     #rounding off to 2 decimals
E1=math.ceil(E1*10**2)/10**2;     #rounding off to 2 decimals

#Result
print "The total energy is",E,"*10**-19 J"
print "The total energy is",E1,"eV"

The total energy is -21.79 *10**-19 J
The total energy is -13.62 eV


## Example number 1.8, Page number 9¶

In [8]:
#import modules
import math
from __future__ import division

#Variable declaration
Q=3.2*10**-19;     #charge on alpha-particle(C)
m=6.68*10**-27;    #mass on alpha-particle(kg)
B=1.5;          #transverse magnetic field of flux density(Wb/m^2)
v=5*10**6;      #velocity of alpha-particle(m/s)

#Calculation
F=B*Q*v;        #electrostatic force on oil drop(N)

The force on particle is 2.4e-12 N