In [1]:

```
# Variables
c = 2.; #for 2 component system
p = 4.;
# Calculations
d = c-p+2; #degree of freedom
t = p*(c-1)+2; #no. of total variables
# Results
print "D = C-P+2"
print "Total no. of variables = P*(C-1)+2"
print "Degree of freedom = ",d
print "when p = ",p
print "Two component system cannot have more than 4 phases in an equilibrium"
```

In [3]:

```
# Variables
p_pb = 11364.1; #density of lead in kg/m**3
p_sn = 7220.14; #density of tin in kg/m**3
# Calculations
p_e = 100./((38./p_pb)+(62./p_sn)); #density of eutectic composition at point D
w = .88*p_e; #in kgf
w_pb = .38*w; #of lead in kgf
w_sn = .62*w; #of tin in kgf
p_b = 7300.; #density in beta phase in kg/m**3
w1 = .12*p_b; #in kgf
w1_pb = .03*w1; #of lead in kgf
w1_sn = .97*w1; #of tin in kgf
w2_pb = w_pb+w1_pb; #Total weight of lead in kgf
w2_sn = w_sn+w1_sn; #Total weight of tin in kgf
sn = (w2_sn/(w2_sn+w2_pb))*100;
# Results
print "Density of eutectic composition at point D (in kg/m3) = %.1f kg/m**3"%p_e
print "Total weight of lead (in kgf) = %.2f kgf"%w2_pb
print "Total weight of tin (in kgf) = %.1f kgf"%w2_sn
print "%% of Sn = %.2f"%sn
```

In [4]:

```
# Variables
c_be = 100;
c_e = 1.65;
c_o = 10;
# Calculations
w = (c_be-c_o)/(c_be-c_e);
# Results
print "weight fractions = %.3f"%w
```

In [6]:

```
# Variables
#m be amount of tin
w_sn = 900.; #weight of tin
w_pb = 1000.; #weight of lead
# Calculations
m = ((w_pb*0.97)-w_sn)/(1-.97); #in grams
m1 = m/1000.; #maximum mass of tin in kgm
# Results
print "Maximum weight of tin that can be added without changing systems temperature (in kgm) = %.2f kg"%m1
```

In [7]:

```
# Variables
c = 0.83; #carbon
f = 0.; #ferrite
ce = 6.67; #cementite
# Calculations
w_a = (ce-c)/(ce-f);
w_b = (c-f)/(ce-f);
# Results
print "Weight fraction of errite = %.3f"%w_a
print "Weight Fraction of Cementite = %.3f"%w_b
```