# 1: Electrostatics-Basic concepts¶

## Example number 1.1, Page number 12¶

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

#Variable declaration
r=0.053*10**-9;      #distance(m)
q1=1.6*10**-19;     #charge on electron(C)
q2=1.6*10**-19;     #charge on proton(C)
#let x=1/(4*math.pi*epsilon0)
x=9*10**9;

#Calculation
F=x*q1*q2/(r**2);    #force of attraction(N)

#Result
print "force of attraction is",round(F*10**8,1),"*10**-8 N"

force of attraction is 8.2 *10**-8 N


## Example number 1.2, Page number 13¶

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

#Variable declaration
r=2;      #distance(m)
q1plusq2=5*10**-4;     #positive charge(C)
#let x=1/(4*math.pi*epsilon0)
x=9*10**9;
F=1;    #force(N)

#Calculation
q1q2=F*(r**2)/x;     #product of charges(C**2)
q1minusq2=math.sqrt((q1plusq2**2)-(4*q1q2));     ##difference of charges(C)
twoq1=q1plusq2+q1minusq2;
q1=twoq1/2;      #charge on individual sphere(C)
twoq2=q1plusq2-q1minusq2;
q2=twoq2/2;      #charge on individual sphere(C)

#Result
print "the charges on individual spheres are",round(q1*10**4,3),"*10**-4 and",round(q2*10**4,3),"*10**-4"

the charges on individual spheres are 4.991 *10**-4 and 0.009 *10**-4


## Example number 1.3, Page number 13¶

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

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

#Calculation
F1=m*g;    #force by electron(N)
E=F1/(2*q);    #intensity of electric field(N/C)

#Result
print "intensity of electric field is",round(E*10**11,3),"*10**-11 N/C"

intensity of electric field is 2.787 *10**-11 N/C


## Example number 1.4, Page number 14¶

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

#Variable declaration
r=12*10**-2;      #distance(m)
q1=2*10**-7;     #charge(C)
q2=8.5*10**-8;     #charge(C)
#let x=1/(4*math.pi*epsilon0)
x=9*10**9;

#Calculation
E1=x*q2/(r**2);    #intensity at electric field at q1 due to q2(N/C)
E2=x*q1/(r**2);    #intensity at electric field at q2 due to q1(N/C)
F=x*q1*q2/(r**2);    #force of attraction(N)

#Result
print "intensity at electric field at q1 due to q2 is",round(E1*10**-5,2),"*10**5 N/C"
print "intensity at electric field at q1 due to q2 is",round(E2*10**-5,2),"*10**5 N/C"
print "force of attraction is",round(F,4),"N"

intensity at electric field at q1 due to q2 is 0.53 *10**5 N/C
intensity at electric field at q1 due to q2 is 1.25 *10**5 N/C
force of attraction is 0.0106 N