In [1]:

```
import math
# Variables
n = 2.**(12-1); #astm no. = 12
# Calculations
#1 sq inch = 645mm**2
d = 1./math.sqrt((n/645)*10**4); #grain diameter in mm
# Results
print "grain diameter for ASTM no. 12 (in mm) = %.4f mm"%d
```

In [2]:

```
# Variables
n = 2**(5-1); #astm no. = 5 in grain/inch**2
# Calculations
#Lineal and Areal magnifications are related as *100 Lineal = *10000 Areal
x = n/(.01*.01); #in grain/inch**2 at 1 x.
a = 1./x; #average area in inch**2
a1 = 2.54*2.54*a; #average area in cm.**2
l = math.sqrt(x); #grains/inch of length
s = (1./l)**2; #surface area in sq inch
s6 = 6.*s; #surface area of 6 surfaces of cubic grain in sq inch
b = 0.5*s6*(l**3); #total boundary area in sq inch
b1 = b/(2.54); #total boundary area in sq cm
# Results
print "Average area of one grain (in sq cm) = %.2e cm**2"%a1
print "Boundary Area per cubic centimetre of steel (in sq cm) = %.1f cm**2"%b1
```