CHAPTER 1: UNITS, DIMENSIONS AND STANDARDS

Example 1-1, Page Number: 8

In [1]:
import math

#Variable Declaration

phi=500*10**-8               #in weber
A=(1*1)*(2.54*10**-2)**2     #in meter square 

#Calculation
B=phi/A                      #in tesla  

#Results
print "Total Magenetic Flux =",phi*10**6,"micro weber"
print "Cross Section=",'%.2e' % A,"meter square"
print "Flux Density(B)=",round(B*10**3,2),"mT"
Total Magenetic Flux = 5.0 micro weber
Cross Section= 6.45e-04 meter square
Flux Density(B)= 7.75 mT

Example 1-2, Page Number: 8

In [1]:
import math

#Variable Declaration
F=98.6      #Temperature =98.6 Farenheit 

#Calculations

Celsius_temperature=(F-32)/1.8           #in Celsius
 
Kelvin_temperature=(F-32)/1.8+273.15     #in Kelvin

#Results
print "Celsius Temperature=",Celsius_temperature,"degree celsisus"
print "Kelvin Temperature=",round(Kelvin_temperature,2),"K"
Celsius Temperature= 37.0 degree celsisus
Kelvin Temperature= 310.15 K

Example 1-3, Page Number: 10

In [2]:
import numpy as np

# Powers of M, L,T,I are expressed in an array consisting of four elements
#Each array element represents the power of the corresponding dimension
#it is of the form [M,L,T,I]


P=np.array([1,2,-3,0])     #Dimesnion of Power
I=np.array([0,0,0,1])      #Dimension of Current

E=P-I      #As E=P/I, the powers have to be subtracted

R=E-I      #As R=E/I, the powers have to be subtracted

print "The dimensions of Voltage and Resistance are expressed in array format[M L T I],"
print "Voltage=",E
print "Resistance=",R
The dimensions of Voltage and Resistance are expressed in array format[M L T I],
Voltage= [ 1  2 -3 -1]
Resistance= [ 1  2 -3 -2]