Documente Academic
Documente Profesional
Documente Cultură
of India)
BY
PALLAVI KUMARI
REG. NO.-2018UGMM052
B.Tech-3rd SEMESTER
BASIC OXYGEN FURNACE (BOF)
Question:
Using the principle of least square, find an equation of the form %O=a+b/%c that fits the BOF chemistry
then superimpose the C-O relation for 1 atm at 1600°C on the plot
2[Al]+3[O]=(Al2O3). delG=-292800+9.37Tcal
C O
0.06 ,0.04 ,0.05 ,0.066 ,0.07, 0.055 ,0.04, 0.068, 0.083, 0.095, 0.074 ,0.069, 0.075,
0.15, 0.06, 0.066, 0.042, 0.04, 0.03, 0.04, 0.018, 0.037, 0.0714, 0.0698, 0.107, 0.082,
0.24, 0.03, 0.06, 0.05, 0.045, 0.06, 0.05, 0.114, 0.095, 0.019, 0.136, 0.065, 0.084,
0.06, 0.06, 0.035, 0.05, 0.07, 0.12, 0.18, 0.105, 0.0675, 0.078, 0.0686, 0.0728, 0.114,
0.055, 0.2 0.0835, 0.056, 0.036, 0.025, 0.0626, 0.024
Program:-
clc
clear all
c=[.06 0.04 .05 .066 .07 .055 .04 .15 .06 .066 .042 .04 .03 .04 .24 .03 .06 .05 .045 .06 .05 .06 .06 .035 .05 .07 .12 .18
.055 .2 ];
length_c=length(c);
o=[.068 .083 .095 .074 .069 .075 .018 .037 .0714 .0698 .107 .082 .114 .095 .019 .136 .065 .084 .105 .0675 .078 .0686
.0728 .114 .0835 .056 .036 .025 .0626 .024];
length_o=length(o);
X=1./c;
Y=o;
%plot(X,Y,'*')
%hold on
%y = 0.0031967*x + 0.013635
a=0.013635;
b=0.0031967;
plot(c,o,'*')%scatter of original data
hold on
%superimposition of the curve obtained on original data
c=linspace(min(c),max(c));
o=0.0031967./c + 0.013635;
plot(c,o,'g')
hold on
%calculation of k
R=1.987;
T=1873;
dG=-8510-7.52*T;
K=exp(-dG/(R*T))
c1=linspace(min(c),max(c));
o1=1./(K*c1);
plot(c1,o1,'r')
oe=1/(K*0.06) %0.0385 practical value
op=0.0031967./0.06 + 0.013635 %0.0669 equilibrium value
do=op-oe %0.0284 difference in o
R=1.987;
G=-292800+9.37*1873;
K1=exp(-G/(R*1873));
Al1=sqrt(1/(K1*(oe^3)))
Al2=(2/3)*0.0284
Al=Al1+Al2;
Al=vpa(Al,5)
Output:
K=
433.2086
Al1 =
1.1541e-14
Al2 =
0.0189
Al =
0.018933
Question:
Program: -
Question:
Evaluate f(15) for given table of values
x 10 20 30 40 50
y 46 66 81 93 101
Program:
clc
clear all
x=[10 20 30 40 50];
y=[46 66 81 93 101];
dy1=diff(y,1)';
D1=dy1(1);
dy2=diff(y,2)';
D2=dy2(1);
dy3=diff(y,3)';
D3=dy3(1);
dy4=diff(y,4)';
D4=dy4(1);
p=0.5;
yf=y(1)+p*D1+(p*(p-1)*D2/factorial(2))+(p*(p-1)*(p-2)*D3/factorial(3))+(p*(p-1)*(p-2)*(p-3)*D4/factorial(4))
Output:
yf =
56.8672
Question:
A thermodynamic student need the temperature under a pressure of 6.3MPa(NPa). Estimate the
temperature using polynomial interpolation from data :
Pressure(MPa) 4.0 5.0 6.0 7.0 8.0 9.0
Temperature(°C) 250 263.99 275.64 285.88 295.06 303.40
Program:
clc
clear all
x=[4 5 6 7 8 9];
y=[250 263.99 275.64 285.88 295.06 303.40];
dy1=diff(y,1)';
D1=dy1(1)
dy2=diff(y,2)';
D2=dy2(1)
dy3=diff(y,3)';
D3=dy3(1)
dy4=diff(y,4)';
D4=dy4(1)
dy5=diff(y,5);
D5=dy5(1)
syms x y
p=x-4;
y=250+p*D1+(p*(p-1)*D2/factorial(2))+(p*(p-1)*(p-2)*D3/factorial(3))+(p*(p-1)*(p-2)*(p-3)*D4/factorial(4))+(p*(p-1)*(p-
2)*(p-3)*(p-4)*D5/factorial(5));
y=collect(y);
y=vpa(y,5)
x=6.3;
y=inline('0.00375*x^5 - 0.13667*x^4 + 2.0179*x^3 - 15.583*x^2 + 73.698*x + 106.54');
y=y(6.3)
x=linspace(4,9);
y=0.00375*x.^5 - 0.13667*x.^4 + 2.0179*x.^3 - 15.583*x.^2 + 73.698*x + 106.54;
plot(x,y)
title('steam temperature pressure graph')
xlabel('pressure(MPa)')
ylabel('temp^0C')
%shortcut method
xi=6.3;
yi=interp1(x,y,xi)
Output:
y=
278.8386
yi =
278.8382
Question:
Fit a polynomial to obtain a function, find the value of x for which value of y is maximum using Newton’s
forward formula. Also find the value of y. Draw a tangent at x=0.6 and find the value of 2 intercepts
x 0 0.1 0.3 0.5 0.7 0.9
y 0 298.2 652.4 800.0 620.5 251.5
Output:
clc
clear all
x=[0.1 0.3 0.5 0.7 0.9];
y=[298.2 652.4 800.0 620.5 251.5];
dy1=diff(y,1)';
D1=dy1(1)
dy2=diff(y,2)';
D2=dy2(1)
dy3=diff(y,3)';
D3=dy3(1)
dy4=diff(y,4)';
D4=dy4(1)
syms x y
p=(x-0.1)/0.2;
y=298.2+p*D1+(p*(p-1)*D2/factorial(2))+(p*(p-1)*(p-2)*D3/factorial(3))+(p*(p-1)*(p-2)*(p-3)*D4/factorial(4));
y=collect(y);
y=vpa(y,5);
y=inline('6721.4*x^4 - 13265.0*x^3 + 5457.2*x^2 + 1043.6*x + 151.86');
y=y(0.6)
x=linspace(0.1,0.9);
y=6721.4*x.^4 - 13265.0*x.^3 + 5457.2*x.^2 + 1043.6*x + 151.86;
plot(x,y)
syms x y
df=diff(6721.4*x.^4 - 13265.0*x.^3 + 5457.2*x.^2 + 1043.6*x + 151.86,x);
df =(134428*x^3)/5 - 39795*x^2 + (54572*x)/5 + 5218/5;
X=solve(df)
x1=X(1);
x1=vpa(x1,6)%x1=1.06458(max)
x2=X(2);
x2=vpa(x2,6)
x3=X(3);
x3=vpa(x3,6)%x2, x3 complex
df=inline('(134428*x^3)/5 - 39795*x^2 + (54572*x)/5 + 5218/5');
m=df(0.6)%-926.6704
y=inline('6721.4*x^4 - 13265.0*x^3 + 5457.2*x^2 + 1043.6*x + 151.86');
y1=y(0.6)% 748.4654
hold on
x=linspace(0.1 ,0.9);
y=748.4654-926.6704*(x-0.6)
plot(x,y)
Output:
y=
748.4654
x1 =
1.06458
x2 =
- 0.0744125 - 5.32907e-15i
x3 =
0.489993 + 5.32907e-15i
m=
-926.6704
y1 =
748.4654
Question :
Using the Newton’s Backward Difference formula for the following data and find the value of f(7.5) (ie
y7.5).
x 1 2 3 4 5 6 7 8
y 1 8 27 64 125 216 343 512
Program:
clc
N1=diff(y,1)
N1=N1(end);
N2=diff(y,2)
N2=N2(end);
N3=diff(y,3)
N3=N3(end);
N4=diff(y,4)
N4=N4(end);
N5=diff(y,5)
N5=N5(end);
N6=diff(y,6)
N6=N6(end);
Y=512-(0.5*169)-(0.5*0.5*21)-(0.5*0.5*1.5)
Output:
N1 = 7 19 37 61 91 127 169
N2 = 12 18 24 30 36 42
N3 = 6 6 6 6 6
N4 = 0 0 0 0
N5 = 0 0 0
N6 = 0 0
Y = 421.8750
LAGRANGE’S INTERPOLATION
Question:
Apply Lagrange’s interpolation formula to find f(x) if f(xo) = 2, f(x1) = 4, f(x2) = 8, f(x3)=16, f(x4)=128, calculate
f(5), f(6). Plot lagrange’s function & superimpose scattered data. Given, xo= 1, x1= 2, x2= 3, x3= 4, x4= 7.
Program:
clc
clear all
syms x
no=(x-x1)*(x-x2)*(x-x3)*(x-x4);
x=xo;
do=subs(no);
Lo=no/do syms x ;
n1=(x-xo)*(x-x2)*(x-x3)*(x-x4);
x=x1; d1=subs(n1);
L1=n1/d1 syms x ;
n2=(x-x1)*(x-xo)*(x-x3)*(x-x4);
x=x2; d2=subs(n2);
L2=n2/d2 syms x;
n3=(x-x1)*(x-x2)*(x-xo)*(x-x4);
x=x3; d3=subs(n3);
L3=n3/d3 syms x ;
n4=(x-x1)*(x-x2)*(x-x3)*(x-xo);
x=x4; d4=subs(n4);
L4=n4/d4 ;
L=[Lo L1 L2 L3 L4];
fx=[fxo fx1 fx2 fx3 fx4];
Y=sum(L.*fx)
x=5;
y1=(11*x^4)/90 - (8*x^3)/9 + (59*x^2)/18 - (31*x)/9 + 44/15
x=6;
y=[2 4 8 16 128];
scatter(x,y)
hold on x=linspace(1,7);
Y=(11.*x.^4)./90 - (8.*x.^3)./9 + (59.*x.^2)./18 - (31.*x)./9 + 44./15;
plot(x,Y)
xlabel('x values')
ylabel('y values')
title('lagranges formula')
Output:
Y = (11*x^4)/90 - (8*x^3)/9 + (59*x^2)/18 - (31*x)/9 + 44/15
y1 = 32.9333 (at x=5)
y2 = 66.6667 (at x=6)
Question :
Use Lagrange’s interpolation formula, to find f(x) for the following data:
x 0 1 3 4
y -12 0 6 12
Program:
clc
clear all
Lo=no/do
syms x
n1=(x-xo)*(x-x2)*(x-x3);
x=x1; d1=subs(n1);
L1=n1/d1
syms x
n2=(x-x1)*(x-xo)*(x-x3);
x=x2; d2=subs(n2);
L2=n2/d2
syms x
n3=(x-x1)*(x-x2)*(x-xo);
x=x3; d3=subs(n3);
L3=n3/d3
L=[Lo L1 L2 L3];
fx=[fxo fx1 fx2 fx3];
Y=sum(L.*fx)
x=[0 1 3 4];
y=[-12 0 6 12];
scatter(x,y)
hold on
x=linspace(0,4);
y=x.^3 - 7.*x.^2 + 18.*x - 12;
plot(x,y)
xlabel('x values')
ylabel('y values')
title('lagranges formula')
Output:
Lo =-((x - 1)*(x - 3)*(x - 4))/12
x 4 5 7 10 11
y 48 100 294 900 1210
Program:
clc
X2=15;
Y1=48+(52*(X1-4))+(15*(X1-4)*(X1-5))+((X1-4)*(X1-5)*(X1-7))
Y2=48+(52*(X2-4))+(15*(X2-4)*(X2-5))+((X2-4)*(X2-5)*(X2-7))
Output:
D = 48 0 0 0 0
100 52 0 0 0
294 97 15 0 0
900 202 21 1 0
1210 310 27 1 0
Y1 =4 Y2 = 3150
Question :
Calculate the activity coefficient of Aluminium in a solution containing 49 atom percentage Aluminium using
Newton’s Divided Difference:-
χAl 0.90 0.75 0.63 0.53 0.45 0.38 0.30 0.20 0.10
aAl 0.89 0.69 0.50 0.31 0.20 0.10 0.03 0.005 0.008
Program:
clc
clear all
syms Xy
x=[0.90 0.75 0.63 0.53 0.45 0.38 0.30 0.20 0.10]; a=[0.89 0.69 0.50 0.31 0.20
0.10 0.03 0.005 0.008]; n=length(a);
y=c(1)+(X-0.90)*c(2)+c(3)*(X-0.90)*(X-0.75)+c(4)*(X-0.90)*(X-0.75)*(X-0.63)+c(5)*(X0.90)*(X-0.75)*(X-0.63)*(X-
0.53)+c(6)*(X-0.90)*(X-0.75)*(X-0.63)*(X-0.53)*(X-
0. 45)+c(7)*(X-0.90)*(X-0.75)*(X-0.63)*(X-0.53)*(X-0.45)*(X-0.38)+c(8)*(X-0.90)*(X0.75)*(X-0.63)*(X-0.53)*(X-
0.45)*(X-0.38)*(X-0.30)+c(9)*(X-0.90)*(X-0.75)*(X-
0.63)*(X-0.53)*(X-0.45)*(X-0.38)*(X-0.30)*(X-0.20);
Y=y/X
Output:
Y = 0.5213
Question :
The following table gives the value of x and y
X 1.2 2.1 2.8 4.1 4.9 6.2
y 4.2 6.8 9.8 13.4 15.5 19.6
Find the value of x corresponding to y=12 using Newton’s Divided difference formula.
Program:
clc
clear all
x=[4.2 6.8 9.8 13.4 15.5 19.6];
y=[1.2 2.1 2.8 4.1 4.9 6.2];
plot(x,y,'*')
hold on
n=length(y);
%if length(x)~=n,error('x and y are not compatible')
%end
D=zeros(n,n);
D(:,1)=y(:);
for j=2:n
for i=j:n
D(i,j)=(D(i,j-1)-D(i-1,j-1))/(x(i)-x(i-j+1));
end
end
C=diag(D);
x0=4.2;
x1=6.8;
x2=9.8;
x3=13.4;
x4=15.5;
x5=19.6;
syms X
Y=C(1)+C(2)*(X-x0)+C(3)*(X-x0)*(X-x1)+C(4)*(X-x0)*(X-x1)*(X-x2)+C(5)*(X-x0)*(X-x1)*(X-x2)*(X-x3)+C(6)*(X-x0)*(X-
x1)*(X-x2)*(X-x3)*(X-x4);
Y=collect(Y);
Y=vpa(Y,6);
syms X
Y =inline('0.0000372891*X^5 - 0.00239481*X^4 + 0.0580598*X^3 - 0.65273*X^2 + 3.65214*X - 6.2299');
V=Y(12)%V=3.5499
X=linspace(4,20);
Y=0.0000372891.*X.^5 - 0.00239481.*X.^4 + 0.0580598.*X.^3 - 0.65273.*X.^2 + 3.65214.*X - 6.2299;
plot(X,Y)
x=[1.2 2.1 2.8 4.1 4.9 6.2];
y=[4.2 6.8 9.8 13.4 15.5 19.6];
plot(x,y,'*')
hold on
n=length(y);
%if length(x)~=n,error('x and y are not compatible')
%end
D=zeros(n,n);
D(:,1)=y(:);
for j=2:n
for i=j:n
D(i,j)=(D(i,j-1)-D(i-1,j-1))/(x(i)-x(i-j+1));
end
end
C=diag(D);
x0=1.2;
x1=2.1;
x2=2.8;
x3=4.1;
x4=4.9;
x5=6.2;
syms X
Y=C(1)+C(2)*(X-x0)+C(3)*(X-x0)*(X-x1)+C(4)*(X-x0)*(X-x1)*(X-x2)+C(5)*(X-x0)*(X-x1)*(X-x2)*(X-x3)+C(6)*(X-x0)*(X-
x1)*(X-x2)*(X-x3)*(X-x4);
Y=collect(Y);
Y=vpa(Y,6);
syms X
Y =inline('- 0.0511323*X^5 + 0.990686*X^4 - 7.22782*X^3 + 24.3806*X^2 - 34.0164*X + 20.4743');
V2=Y(3.5499)%V=3.5499
X=linspace(1,6.2);
Y=- 0.0511323*X.^5 + 0.990686*X.^4 - 7.22782*X.^3 + 24.3806*X.^2 - 34.0164*X + 20.4743;
plot(X,Y)
Output:
V=
3.5499
V2 =
12.1220
Question :
A slider in a machine moves along a fixed straight rod. Its distance x cm along the rod is given below for
various values of time ‘t’ sec. Find the velocity and acceleration when t=0.3 sec using Newton’s divided
difference formula
Program:
clc
clear all
x=[0 0.1 0.2 0.3 0.4 0.5 0.6];
y=[30.13 31.62 32.87 33.64 33.95 33.81 33.24];
n=length(y);
%if length(x)~=n,error('x and y are not compatible')
%end
D=zeros(n,n);
D(:,1)=y(:);
for j=2:n
for i=j:n
D(i,j)=(D(i,j-1)-D(i-1,j-1))/(x(i)-x(i-j+1));
end
end
C=diag(D);
x0=0;
x1=0.1;
x2=0.2;
x3=0.3;
x4=0.4;
x5=0.5;
x6=0.6;
syms X
Y=C(1)+C(2)*(X-x0)+C(3)*(X-x0)*(X-x1)+C(4)*(X-x0)*(X-x1)*(X-x2)+C(5)*(X-x0)*(X-x1)*(X-
x2)*(X-x3)+C(6)*(X-x0)*(X-x1)*(X-x2)*(X-x3)*(X-x4)+C(7)*(X-x0)*(X-x1)*(X-x2)*(X-x3)*(X-
x4)*(X-x5);%ndd formula
Y=collect(Y);
Y=vpa(Y,6);
dY=diff(Y,X);
dY=vpa(dY,6);
dY=inline('2416.67*X^5 - 4145.83*X^4 + 2702.78*X^3 - 823.125*X^2 + 68.4056*X +
13.6267');
Velocity=dY(0.3)
dY=2416.67*X^5 - 4145.83*X^4 + 2702.78*X^3 - 823.125*X^2 + 68.4056*X + 13.6267;
dY2=diff(dY,X);
dY2=vpa(dY2,6);
dY2=inline('12083.4*X^4 - 16583.3*X^3 + 8108.34*X^2 - 1646.25*X + 68.4056');
acceleration=dY2(0.3)
Output:
Velocity =
5.3335
acceleration =
-45.5924