Numerical Methods and Computing Lab
Numerical Methods and Computing Lab
%Assignment No.1
%Submitted to:
%Submitted by: Baran Shafqat (2015-ME-1)
%Q.No.1(a)
format bank;
A=(22+5.1^2)/(50-6.3^2);
disp('The value of A is');
disp(A)
%Q.No.1(a)
format short;
A=(22+5.1^2)/(50-6.3^2);
disp('The value of A is');
disp(A)
%Q.No.1(a)
format long;
A=(22+5.1^2)/(50-6.3^2);
disp('The value of A is');
disp(A)
%Q.No.1(b)
format bank;
B=(44/7)+(8^2/5)-(99/3.9^2);
disp('The value of B is');
disp(B)
%Q.No.1(b)
format short;
B=(44/7)+(8^2/5)-(99/3.9^2);
disp('The value of B is');
disp(B)
%Q.No.1(b)
format long;
B=(44/7)+(8^2/5)-(99/3.9^2);
disp('The value of B is');
disp(B)
%Q.No.2(a)
format bank;
C=(sqrt(41^2-5.2^2))/(exp(5)-100.53);
disp('The value of C is');
disp(C)
format short;
C=(sqrt(41^2-5.2^2))/(exp(5)-100.53);
disp('The value of C is');
disp(C)
format long;
C=(sqrt(41^2-5.2^2))/(exp(5)-100.53);
disp('The value of C is');
disp(C)
%Q.No.2(b)
format bank;
D=nthroot(132,3)+(log(500)/8);
disp('The value of D is');
disp(D)
format short;
D=nthroot(132,3)+(log(500)/8);
disp('The value of D is');
disp(D)
format long;
D=nthroot(132,3)+(log(500)/8);
disp('The value of D is');
disp(D)
%Q.No.3(a)
format bank;
E=(14.8^3-6.3^2)/(sqrt(13)+5)^2
disp('The value of E is');
disp(E)
format short;
E=(14.8^3-6.3^2)/(sqrt(13)+5)^2
disp('The value of E is');
disp(E)
format long;
E=(14.8^3-6.3^2)/(sqrt(13)+5)^2
disp('The value of E is');
disp(E)
%Q.No.3(b)
format bank;
F=45*(288/9.3-4.6^2)-1065*exp(-1.5);
disp('The value of F is');
disp(F)
format short;
F=45*(288/9.3-4.6^2)-1065*exp(-1.5);
disp('The value of F is');
disp(F)
format long;
F=45*(288/9.3-4.6^2)-1065*exp(-1.5);
disp('The value of F is');
disp(F)
%Q.No.4(a)
format bank;
G=(24.5+64/3.5^2+8.3*12.5^3)/(sqrt(76.4)-28/15);
disp('The value of G is');
disp(G)
format short;
G=(24.5+64/3.5^2+8.3*12.5^3)/(sqrt(76.4)-28/15);
disp('The value of G is');
disp(G)
format long;
G=(24.5+64/3.5^2+8.3*12.5^3)/(sqrt(76.4)-28/15);
disp('The value of G is');
disp(G)
%Q.No.4(b)
format bank;
H=(5.9^2-2.4^2)/3+(log10(12890)/exp(0.3))^2;
disp('The value of H is');
disp(H)
format short;
H=(5.9^2-2.4^2)/3+(log10(12890)/exp(0.3))^2;
disp('The value of H is');
disp(H)
format long;
H=(5.9^2-2.4^2)/3+(log10(12890)/exp(0.3))^2;
disp('The value of H is');
disp(H)
%Q.No.5(a)
format bank;
I=cos(7*pi/9)+tan(7*pi/15)*sind(15);
disp('The value of I is');
disp(I)
format short;
I=cos(7*pi/9)+tan(7*pi/15)*sind(15);
disp('The value of I is');
disp(I)
format long;
I=cos(7*pi/9)+tan(7*pi/15)*sind(15);
disp('The value of I is');
disp(I)
%Q.No.5(b)
format bank;
J=sind(80)^2-(cosd(14)*sind(80))^2/nthroot(0.18,3);
disp('The value of J is');
disp(J)
format bank;
J=sind(80)^2-(cosd(14)*sind(80))^2/nthroot(0.18,3);
disp('The value of J is');
disp(J)
format bank;
J=sind(80)^2-(cosd(14)*sind(80))^2/nthroot(0.18,3);
disp('The value of J is');
disp(J)
format short;
J=sind(80)^2-(cosd(14)*sind(80))^2/nthroot(0.18,3);
disp('The value of J is');
disp(J)
format long;
J=sind(80)^2-(cosd(14)*sind(80))^2/nthroot(0.18,3);
disp('The value of J is');
disp(J)
%Q.No.6(a)
format bank;
x=6.7;
K=0.01*x^5-1.4*x^3+80*x+16.7;
disp('The value of K is');
disp(K)
format short;
x=6.7;
K=0.01*x^5-1.4*x^3+80*x+16.7;
disp('The value of K is');
disp(K)
format long;
x=6.7;
K=0.01*x^5-1.4*x^3+80*x+16.7;
disp('The value of K is');
disp(K)
%Q.No.6(b)
format bank;
x=6.7;
L=sqrt(x^3+exp(x)-51/x);
disp('The value of L is');
disp(L)
format short;
x=6.7;
L=sqrt(x^3+exp(x)-51/x);
disp('The value of L is');
disp(L)
format long;
x=6.7;
L=sqrt(x^3+exp(x)-51/x);
disp('The value of L is');
disp(L)