In [1]:

```
# Given
n = 2000 # flux lines enter in given volume in Vm
n_ = 4000 # flux lines diverge from given volume in Vm
e0 = 8.85e-12 # permittivity of space
#Calculations
fi = n_ - n
q = e0 * fi
#Result
print 'The total charge within volume(in C) = ',q
```

In [1]:

```
# Given
n = 20000 # flux lines entering in given volume in Vm
n_ = 45000 # flux lines entering out from given volume in Vm
e0 = 8.85e-12 # permittivity of space
#Calculations
fi = n_ - n
q = e0 * fi
#Result
print "The total charge enclosed by closed surface is %.3e C"%q
```

In [3]:

```
# Given
q = 13.5e-6 # charge enclosed at the centre of cube in C
l = 6 # length of the side of cube in cm
e0 = 8.85e-12 # permittivity of space
#Calculations
fi = q / e0
fi_ = fi / 6
q = e0 * fi
#Results
print "Electric flux through the whole volume of the cube is %.3e Nm^2/C\nElectric flux through one face of the cube is %.2e Nm^2/C"%(fi,fi_)
```

In [4]:

```
# Given
q = 11 # charge enclosed at the centre of cube in C
l = 5 # length of the side of cube in cm
e0 = 8.85e-12 # permittivity of space
#Calculation
fi_ = (q / e0) / 6
#Result
print " Electric flux through each surface of the cube = %.2e Nm^2/C"%fi_
```

In [5]:

```
from math import pi
# Given
q = 1e-8 # charge uniformly spread over metallic sphere in C
r = .1 #radius of sphere in m
d = 7 # distance of a point from centre of the sphere in cm
d_ = .5 # distance of another point from centre of the sphere in m
e0 = 8.85e-12 # permittivity of space
#calculations
E1 = (1 / (4 * pi * e0) * (q / r**2))
E2 = 0 #because sphere is metallic
E3 = (1 / (4 * pi * e0) * (q / d_**2))
#Result
print "Electric field intensity-\n(1) On the surface of the sphere = %.e N/C\n(2) At first point = %d N/C\n(3)At second point = %.2e N/C"%(E1,E2,E3)
```

In [6]:

```
from math import pi
# Given
q = 1.6e-19 # charge on a proton in C
d = 1e-10 # distance of a point from proton in m
e0 = 8.85e-12 # permittivity of space
#Calculation
E = (1 / (4 * pi * e0)) * (q / d**2)
#Result
print "Electric field = %.2e V/m"%E
```

In [7]:

```
# Given
v = 1000 # potential through which alpha particle accelerated in V
q = 3.2e-19 # charge on an alpha particle in C
e0 = 8.85e-12 # electric permittivity of space
#calculation
E = q * v
#Result
print "Energy gained by alpha particle = %.1e J"%E
```

In [8]:

```
from math import pi
# Given
q = 1.6e-19 # charge on a proton in C
d = 1e-10 # distance of a point from proton in m
d_ = 2e-11 # distance of another point from proton in m
e0 = 8.85e-12 # permittivity of space
#calculations
v = (1 / (4 * pi * e0)) * (q / d)#calculation for potential at first point
E = -q * v#calculation for energy at first point in J
delta_v = (1 / (4 * pi * e0)) * q * ((1 / d_) - (1 / d))#calculation for potential difference between points
#Result
print "Potential energy at first point = %.1f eV\nPotential difference between points = %.1f V"%(E/q,delta_v)
```

In [9]:

```
from math import pi, ceil
# Given
q = 1.5e-6 # charge in C
v = 30 # potential of a surface in V
e0 = 8.85e-12 # permittivity of space
#Calculation
r = (1 / (4 * pi * e0)) * (q / v)
#Result
print "Radius of equipotential surface = %d m"%ceil(r)
```

In [10]:

```
from math import pi
# Given
p = 3.8e26 # power radiated by sun in W
r = 7e8 # radius of sun in m
e0 = 8.85e-12 # permittivity of space
#Calculation
s = p / (4 * pi * r**2)
#Result
print "The value of poynting vector at the surface of the sun = %.3e W/m^2"%s
```

In [1]:

```
#Given
Se = (2*4.2)/(60*10**-4) #J/m^2-sec
c = 3*10**8 #m/s
res = 1.4*10**11 #m
rs = 7*10**7 #W/m^2
#Calculations
Prad_e = Se/c
Ss = Se*((res/rs)**2)
Prad_s = Ss/c
#Results
print "Radiation pressure at the surface of the earth =%.2e N/m^2"%Prad_e
print "Radiation pressure at the surface of the sun =%.3e N/m^2"%Prad_s
```

In [2]:

```
from math import sqrt
# Given
s = 2 # energy received by the earth in cal/cm^2.min
e0 = 8.85e-12 # electric permittivity of space
mu0 = 1.2567e-6 # magnetic permittivity of space
c = 3e8 # speed of light in meter/sec
#calculations
r = sqrt(mu0 / e0)
P = s*4.2/(60*1e-4)
E = sqrt(P*r)
H = E/r
#Result
print "Magnitude of electric field vector = %.1f v/m\nMagnitude of magnetic field vector = %.3f A/m"%(E * sqrt(2),H*sqrt(2))
```

In [3]:

```
from math import sqrt
# Given
H = 1 # magnitude of magnetic field vector A/m
e0 = 8.85e-12 # electric permittivity of space
mu0 = 1.2567e-6 # magnetic permittivity of space
c = 3e8 # speed of light in meter/sec
#Calculations
r = sqrt(mu0 / e0) # ratio of E,H
E = H * r
#Result
print "Magnitude of electric field vector = %.2f v/m."%E
```

In [4]:

```
from math import sqrt, pi
# Given
p = 1000 # power of lamp in W
d = 2 # distance of a point from lamp in meter
e0 = 8.85e-12 # electric permittivity of space
mu0 = 1.2567e-6 # magnetic permittivity of space
c = 3e8 # speed of light in meter/sec
#Calculations
s = p / (4 * pi * d**2) #calculation for
r = sqrt(mu0 / e0) # ratio of E,H
E = sqrt(s * r)#calculation for average value of intensity of electric field of radiation
#Result
print "Average value of the intensity of electric field of radiation = %.2f v/m."%E
```

In [5]:

```
from math import sqrt
# Given
k = 81 # relative permittivity of water
c = 3e8 # speed of light in meter/sec
#Calculations
mu = sqrt(k)
v = c / mu
#Result
print "Refractive index of distilled water is %d \nSpeed of light in water is %.2e m/sec"%(mu,v)
```