#initiation of variable
#alpha phase
#from diagram
Sn=10;
Pb=100-Sn;
#result
print "In alpha phase % of tin is",Sn,"and % of lead is",Pb,"in the alloy"
#beta phase
#from diagram
Sn=78
Pb=80-Sn;
#result
print "In alpha phase % of tin is",Sn,"and % of lead is",Pb,"in the alloy"
#initiation of variable
C1=40.0 # Overall alloy composition
Cb=98.0
Ca=10.0
rho_Sn=7.24 # density in g/cm^3 density of tin
rho_Pb=11.23 # density in g/cm^3 density of lead
Ca_Sn=10.0
Ca_Pb=90.0
Cb_Sn=98.0
Cb_Pb=2.0
#part A
#calculation
Wa=(Cb-C1)/(Cb-Ca)
Wb=(C1-Ca)/(Cb-Ca)
print" Mass fraction for alpha and beta phases is %.2f" %Wa,"and %.2f respectively" %Wb;
#partB
rho_a=100.0/((Ca_Sn/rho_Sn)+(Ca_Pb/rho_Pb));
rho_b=100.0/((Cb_Sn/rho_Sn)+(Cb_Pb/rho_Pb));
Va=Wa/(rho_a*((Wa/rho_a)+(Wb/rho_b)));
Vb=Wb/(rho_b*((Wa/rho_a)+(Wb/rho_b)));
#result
print" Density of alpha phase is : %.2f g/cm^3" %rho_a;
print" Density of beta phase is : %.2f g/cm^3" %rho_b;
print" Volume fraction of alpha phase : %.2f" %Va;
print"Volume fraction of beta phase : %.2f" %Vb;
#initiation of variable
C0=0.35 # given composition
C_a=0.022 # given composition
C_Fe3C=6.7 # given composition
C_p=0.76
#partA
W_a=(C_Fe3C-C0)/(C_Fe3C-C_a)
W_Fe3C=(C0-C_a)/(C_Fe3C-C_a)
#result
print" Mass fraction of total ferrite phase is %.2f" %W_a
print" Mass fraction of cementide phase is %.2f" %W_Fe3C
#part B
Wp=(C0-C_a)/(C_p-C_a)
W_a1=(C_p-C0)/(C_p-C_a)
#result
print" Mass fraction of Pearlite is %.2f" %Wp
print" Mass fraction of proeutectoid ferrite is %.2f" %W_a1
#partC
Wae=W_a-W_a1
#result
print" Mass fraction of eutectoid ferrite : %.3f" %Wae
print "Answer in book is 0.39. It is due to considering different number of significant figure at intermediate steps"