0% found this document useful (0 votes)
36 views27 pages

Solution:: Output

Physics

Uploaded by

riyadhassanbd12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views27 pages

Solution:: Output

Physics

Uploaded by

riyadhassanbd12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

1

Solution:
clc
clear all
a=2.^3+7.^3+(273.^(2/3))/2+(55.^(3/2));
b=((3.^7)*log(76))/((7.^3)+546)+910.^(1/3);
c=43*(((250.^(1/4)+23).^2)/exp(45-3.^3));
d=(1+2-exp(-3)+sin(5))/(cos(6)-7.^(-8));
fprintf('The magnitude of the given expressions are
below\n\n(a)%f\n\n(b)%f\n\n(c)%f\n\n(d)%f\n',a,b,c,d)

Output:

The magnitude of the given expressions are below

(a)779.932501

(b)20.344417

(c)0.000477

(d)2.073892
>>

Solution:

clc
clear all
x=9.6;
z=8.1;
a=(x*z.^2)-((2*z)/(3*x)).^(3/5);
b=((443*z)/(2*x.^3))+((exp(-x*z))/(x+z));
fprintf('The magnitude of the given expressions are
below\n\n(a)%.10f\n\n(b)%.10f\n',a,b)

Output:

The magnitude of the given expressions are below


prepared by K. M. Ashikur Rahaman
2

(a)629.1479343665

(b)2.0278930664
>>

Solution:
clc
clear all
a=15.62;
b=-7.08;
c=62.5;
d=0.5*(a*b-c);
r1=a+((a*b*(a+d).^2)/(c*sqrt(abs(a*b))));
r2=(d*exp(d/2))+((a*d+c*d)/((20/a)+(20/b)))/(a+b+c+d);
fprintf('The magnitude of the given expressions are
below\n\n(a)%.15f\n\n(b)%.15f\n',r1,r2)

Output:
The magnitude of the given expressions are below

(a)-830.775539343049790

(b)-282.334184942866900
>>

Solution:

prepared by K. M. Ashikur Rahaman


3

clc
clear all
r1=(((cos(5*pi/6)).^2)*(sin(7*pi/8).^2))+((tan(pi*log(8)/6))/sqrt(7
));
r2=((cos(5*pi/6).^2)*((sin(7*pi/8)).^2))+((tan(pi*log(8)/6))/(7*(5/
2)));
r3=sin(acos(1/2)+atan(1));
r4=cos(asin(sqrt(3)/2)+acot(sqrt(3)));
r5=tan(asin(3/4)-acos(1/3));
fprintf('The magnitude of the given expressions are
below\n\n(a)%f\n\n(b)%f\n\n(c)%f\n\n(d)%f\n\n(e)%f\n',r1,r2,r3,r4,r
5)

Output:
The magnitude of the given expressions are below

(a)0.832300

(b)0.219061

(c)0.965926

(d)0.000000

(e)-0.402776
>>

Solution:
clc
clear all
alpha=(5*pi)/6;
beta=pi/7;
aLHS=cos(alpha)-cos(beta);
aRHS=2*sin((1/2)*(alpha+beta))*sin((1/2)*(beta-alpha));
bLHS=(sin(alpha+beta)-sin(alpha-beta))/(cos(alpha+beta)+cos(alpha-
beta));
bRHS=tan(beta);
disp('===========OUTPUT=============')
fprintf('The required value of the LEFT HAND SIDE of the given
equation (a)=%.8f\n',aLHS)

prepared by K. M. Ashikur Rahaman


4

fprintf('The required value of the RIGHT HAND SIDE of the given


equation (a)=%.8f\n',aRHS)
fprintf('The required value of the LEFT HAND SIDE of the given
equation (b)=%.8f\n',bLHS)
fprintf('The required value of the RIGHT HAND SIDE of the given
equation (b)=%.8f\n',bRHS)

===========OUTPUT=============
The required value of the LEFT HAND SIDE of the given equation (a)=-1.76699427
The required value of the RIGHT HAND SIDE of the given equation (a)=-1.76699427
The required value of the LEFT HAND SIDE of the given equation (b)=0.48157462
The required value of the RIGHT HAND SIDE of the given equation (b)=0.48157462
>>

Solution:
clc
clear all
A = [75000 100000 300000 500000 1199900];
r = 0.09;%rate of interest is 9 percent
n = 10;%time is 10 years
B = A*(1 + r).^n;
table=[A;B];
fprintf('Investement Final balance\n\n')
fprintf('%d %.5f\n',table)
%disp( [A' B'] )

Output
Investement Final balance

75000 177552.27559
100000 236736.36746
300000 710209.10238
500000 1183681.83730
1199900 2840599.67314
>>

Solution:

prepared by K. M. Ashikur Rahaman


5

clc
clear all
P=400000; % total invesment
r = 0.085; % interest rate
t = 17; % invesment years
n=12; % 1 year= 12 months
B = P*(1 + r).^t;
fprintf('The final balance after 17 years %.3f is %.6f\n',P,B) %
solution of 1st question
time=log(B/P)/(n*log(1+r/n));% time calculated
years=fix(time)% fixing time
months=ceil((time-years)*12)

Output:
The final balance after 17 years 400000.000 is 1600904.924208

years =

16

months =

>>

Solution:
clc
clear all
Tb=256.93*82.85;% 1 US dollar=82.85 taka
Cp=89.99*82.85; % 1 US dollar=82.85 taka
Tp=2*Tb+8*Cp; % price of 2 tables and 8 chairs
W_tax=Tp+Tp*(5.5/100); % price of 2 tables and 8 chairs with 5.5
percent tax
disp('===============================OUTPUT========================
=======')
fprintf('The required cost of two tables and eight chairs=%f
taka\n',Tp) % solution of 1st question

prepared by K. M. Ashikur Rahaman


6

fprintf('The required cost of two tables and eight chairs with 5.5
percent tax=%f taka\n',W_tax) % solution of 2nd question

===============================OUTPUT===============================
The required cost of two tables and eight chairs=102218.673000 taka
The required cost of two tables and eight chairs with 5.5 percent tax=107840.700015 taka
>>

Solution:
clc
clear all
r1=10; % external diameter
r2=2; % internal diameter
V=(4/3)*pi*(r1.^3-r2.^3); % Volume formula
disp('===============================OUTPUT========================
=======')
fprintf('The required volume of a shell=%f\n',V)

===============================OUTPUT===============================
The required volume of a shell=4155.279883
>>

Solution:
clc
clear all
disp('===============================INPUT=========================
=======')
F=input('Enter the temperatures in degrees Fahrenheit=');
C=5*(F-32)/9;
K=C+273.15;
disp('===============================OUTPUT========================
=======')

prepared by K. M. Ashikur Rahaman


7

fprintf('The required temperatures in %.4f degrees Fahrenheit is


%.5f degree Centigrade and %.5f degree Kelvin\n',F,C,K)
fprintf('The required temperatures in %.4f degrees Fahrenheit is
%.7e degree Centigrade and %.7e degree Kelvin\n',F,C,K)
fprintf('The required temperatures in %.4g degrees Fahrenheit is
%.4g degree Centigrade and %.4g degree Kelvin\n',F,C,K)

===============================INPUT================================
Enter the temperatures in degrees Fahrenheit=12
===============================OUTPUT===============================
The required temperatures in 12.0000 degrees Fahrenheit is -11.11111 degree Centigrade and
262.03889 degree Kelvin
The required temperatures in 12.0000 degrees Fahrenheit is -1.1111111e+001 degree Centigrade
and 2.6203889e+002 degree Kelvin
The required temperatures in 12 degrees Fahrenheit is -11.11 degree Centigrade and 262 degree
Kelvin
>>

Solution:

clc
clear all
x=input('Enter the initial inches=');
f=x+3*9; % Here 9 is stands for lines
I=x:3:f;
CM=I*2.54;%Since 1 inch = 2.54 cm
table=[I;CM];
fprintf('Conservation from inches to centimeters\n')
fprintf('inches\t\t\t\t centimeters\n')
fprintf('%.2f\t\t\t\t\t%.5f\n',table)

Output:
Enter the initial inches=15
Conservation from inches to centimeters
inches centimeters
15.00 38.10000
18.00 45.72000
21.00 53.34000
24.00 60.96000
27.00 68.58000
30.00 76.20000
33.00 83.82000
36.00 91.44000

prepared by K. M. Ashikur Rahaman


8

39.00 99.06000
42.00 106.68000
>>

Solution:
clc
clear all
linspace(7,47.5,15)
Output:

ans =

Columns 1 through 7

7.0000 9.8929 12.7857 15.6786 18.5714 21.4643 24.3571

Columns 8 through 14

27.2500 30.1429 33.0357 35.9286 38.8214 41.7143 44.6071

Column 15

47.5000

>>

Solution:
clc
clear all
B=[7:0.16:23];
Display=B(18)

Output:
Display =

9.7200

prepared by K. M. Ashikur Rahaman


9

>>

Solution:
clc
clear all
%x=[-2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5];
x=-2.5:0.5:2.5;
y=(x.^2+1).^3.*(x.^3);
disp('===========OUTPUT============')
table=[x;y];
fprintf('Conversion from x to y\n')
fprintf('x y\n\n')
fprintf('===== ==========\n');
fprintf('%.2f %.4f\n',table)

===========OUTPUT============
Conversion from x to y
x y

===== ==========
-2.50 -5954.3457
-2.00 -1000.0000
-1.50 -115.8574
-1.00 -8.0000
-0.50 -0.2441
0.00 0.0000
0.50 0.2441
1.00 8.0000
1.50 115.8574
2.00 1000.0000
2.50 5954.3457
>>

prepared by K. M. Ashikur Rahaman


10

Solution:
clc
clear all
g=9.81; %acceleration (meter per second sq)
t=linspace(1,10,10); %time (seconds)
d=(1/2)*g*t.^2; %the depth of a well
table=[t;d];
fprintf('Time(seconds)\t\tDepth of a well(meters)\n')
fprintf('------------\t\t----------------------\n\n')
fprintf('%d\t\t\t\t\t\t\t%f\n\n',table)

Output:
Time(seconds) Depth of a well(meters)
------------ ----------------------

1 4.905000

2 19.620000

3 44.145000

4 78.480000

5 122.625000

6 176.580000

7 240.345000

8 313.920000

9 397.305000

10 490.500000

>>

prepared by K. M. Ashikur Rahaman


11

Solution:
clear all
clc
x=2:2:10;
y=3:3:15;
z=(((x.*y)+(y./x))./((x+y).^(y-x)))+12.^(x./y);
table=[x;y;z];
fprintf('The required value of z with respect to x and y\n')
fprintf('x\t\t\t\t y\t\t\t\t z\n')
fprintf('-----\t\t\t-----\t\t\t-----\n')
fprintf('%d\t\t\t\t %d\t\t\t %.6f\n',table)

Output:
The required value of z with respect to x and y
x y z
----- ----- -----
2 3 6.741483
4 6 5.496483
6 9 5.257927
8 12 5.242092
10 15 5.241498
>>

Solution:
clear all
clc
h=0.9;
k=12.5;
x=1:1:4;
y=0.9:-0.1:0.6;
z=2.5:0.5:4;
T=((x.*y.*z)./((h+k).^(k/5)))+(k*exp((z./x)+y))./z.^h;
Table=[x;y;z;T];
fprintf('The required value of T with respect to h,k,x,y and z\n')
fprintf('x\t\t\t y\t\t\t\t z\t\t\t\t T\n')
fprintf('%d\t\t %f\t\t %f\t\t %f\n',Table)

Output:
The required value of T with respect to h,k,x,y and z
x y z T

prepared by K. M. Ashikur Rahaman


12

1 0.900000 2.500000 164.200433


2 0.800000 3.000000 46.392370
3 0.700000 3.500000 26.188901
4 0.600000 4.000000 17.794418
>>

Solution:

clc
clear all
r=3:8; %radii
A=pi*r.^2; % Area of circles
table=[r;A];
disp('=========OUTPUT========')
fprintf('radii\t\t\t\t\tArea of circles\n')
fprintf('------------\t\t----------------------\n\n')
fprintf('%.2f\t\t\t\t\t\t\t%.4f\n\n',table)

=========OUTPUT========
radii Area of circles
------------ ----------------------

3.00 28.2743

4.00 50.2655

5.00 78.5398

6.00 113.0973

7.00 153.9380

8.00 201.0619

>>

prepared by K. M. Ashikur Rahaman


13

Solution:
clc
clear all
R=1:1:3;
y=5;
theta=pi*20/180;
V=(pi*R.^3)/(3*tan(theta))+(pi/3)*((R-
y*tan(theta)).^2).*(R/tan(theta)-y);
disp('===========OUTPUT============')
table=[R;V];
fprintf('Conversion from R to V\n')
fprintf('R V\n\n')
fprintf('===== ==========\n');
fprintf('%.2f %.6f\n',table)

===========OUTPUT============
Conversion from R to V
R V

===== ==========
1.00 1.291646
2.00 23.034034
3.00 82.412135
>>

Solution:
clc
clear all
A=[7 2;3 1];
B=[2 3;-4 -5];
r1=A+B
r2=A-B
r3=2*B
r4=A/4
r5=A.*B
r6=B.*A

prepared by K. M. Ashikur Rahaman


14

r7=A*B
r8=A.^2
r9=A^2
r10=A.^B
r11=A./B

Output:

r1 =

9 5
-1 -4

r2 =

5 -1
7 6

r3 =

4 6
-8 -10

r4 =

1.7500 0.5000
0.7500 0.2500

r5 =

14 6
-12 -5

r6 =

14 6
-12 -5

r7 =

6 11
2 4
prepared by K. M. Ashikur Rahaman
15

r8 =

49 4
9 1

r9 =

55 16
24 7

r10 =

49.0000 8.0000
0.0123 1.0000

r11 =

3.5000 0.6667
-0.7500 -0.2000

>>

prepared by K. M. Ashikur Rahaman


16

Solution:
clc
clear all
A=[12.11 -7.9 9.23;5.06 6.35 21.7;-3.34 2.67 14.38];
r1=log(abs(A))
r2=log10(abs(A))
r3=sqrt(A)
r4=cosh(A)
r5=round(A)
r6=ceil(A)
r7=fix(A)
r8=sum(A)
r9=prod(A')'
r10=max(A)
r11=min(A')'
r12=sort(A)
r13=sort(A')'
r14=mean(A)
r15=size(A)

Output:

r1 =

2.4940 2.0669 2.2225


1.6214 1.8485 3.0773
1.2060 0.9821 2.6658

r2 =

1.0831 0.8976 0.9652


0.7042 0.8028 1.3365

prepared by K. M. Ashikur Rahaman


17

0.5237 0.4265 1.1578

r3 =

3.4799 0 + 2.8107i 3.0381


2.2494 2.5199 4.6583
0 + 1.8276i 1.6340 3.7921

r4 =

1.0e+009 *

0.0001 0.0000 0.0000


0.0000 0.0000 1.3279
0.0000 0.0000 0.0009

r5 =

12 -8 9
5 6 22
-3 3 14

r6 =

13 -7 10
6 7 22
-3 3 15

r7 =

12 -7 9
5 6 21
-3 2 14

r8 =

13.8300 1.1200 45.3100

r9 =

prepared by K. M. Ashikur Rahaman


18

-883.0249
697.2427
-128.2380

r10 =

12.1100 6.3500 21.7000

r11 =

-7.9000
5.0600
-3.3400

r12 =

-3.3400 -7.9000 9.2300


5.0600 2.6700 14.3800
12.1100 6.3500 21.7000

r13 =

-7.9000 9.2300 12.1100


5.0600 6.3500 21.7000
-3.3400 2.6700 14.3800

r14 =

4.6100 0.3733 15.1033

r15 =

3 3

>>

prepared by K. M. Ashikur Rahaman


19

Solution:
clc
clear all
A=[6 -3 4;12 5 -7;-5 2 6];
B=[41;-26;14];
r=inv(A)*B;
fprintf('a:\n')
fprintf('x y z\n')
fprintf('%3.2f %3.2f %3.2f\n',r)

Output:

a:
x y z
2.00 -3.00 5.00
>>

Solution:
clc
clear all
A=[1 -2 5 2.5;10 25 -6.2 18;25 -30 -15 28;-3.2 0 12 -8];
B=[-4;2.9;-5.2;-4];
x=inv(A)*B;
fprintf('a:\n')
fprintf('x1 x2 x3 x4\n')
fprintf('%f %f %f %f\n',x)

Output:
a:
x1 x2 x3 x4
0.131489 0.202049 -0.553817 -0.383321

prepared by K. M. Ashikur Rahaman


20

>>

Solution:
clc
clear all
x1=-4:0.01:4;
x2=-2.7:0.01:2.7;
y1=0.6.*x1.^5-5.*x1.^3+9.*x1+2;
y2=0.6.*x2.^5-5.*x2.^3+9.*x2+2;
plot(x1,y1,'r-.','linewidth',1.5,'markersize',15)
%axis on('[-10 10],[0 0]')
xlabel('x(cm)','fontsize',12)
ylabel('y(cm)','fontsize',12)
title('x as a function of y','fontsize',12)
axis([-4 4 -100 100])
%text(-7.8,70,'Comparison between -4<=x<=4 and -
2.7<=x<=2.7','edgecolor','k','linewidth',1)
hold on
plot(x2,y2,'k-','linewidth',.5,'markersize',15)
legend('-4<=x<=4','-2.7<=x<=2.7',0)
%axis equal
plot([-4 4],[0 0],'k')
plot([0 0],[-100 100],'k')
grid off
hold off

Output:

prepared by K. M. Ashikur Rahaman


21
x as a function of y
100

80

60

40

20
y(cm)

-20

-40
-4<=x<=4
-2.7<=x<=2.7
-60

-80

-100
-4 -3 -2 -1 0 1 2 3 4
x(cm)

Solution:
clc
clear all
x=-10:1:10;
y=(x.^2+x+1)./(x.^2-x+1);
plot(x,y,'--k')
xlabel('x')
ylabel('y')
title('Graph of a polynomial function')
legend('y')
Output:

prepared by K. M. Ashikur Rahaman


22

Graph of a polynomial function


3
y

2.5

1.5
y

0.5

0
-10 -8 -6 -4 -2 0 2 4 6 8 10
x

Solution:
clc
clear all
x=linspace(-4,6,200);
y=(0.01.*(x.^5)-0.03.*(x.^4)+0.4.*(x.^3)-2.*(x.^2)-6.*x+5);
plot(x,y,'--r')

prepared by K. M. Ashikur Rahaman


30 23

20

10

-10

-20

-30

-40

-50
-4 -3 -2 -1 0 1 2 3 4 5 6

Solution:
clc
clear all
x=linspace(-2*pi,2*pi,180);
y=3.*x.*cos(x)-3.*sin(x)-2.*x;
plot(x,y,'-.k')
z=3.*cos(x)-3.*sin(x)-2;
hold on
plot(x,z,'--r')
xlabel('x')
ylabel('y')
hold off

Output:

prepared by K. M. Ashikur Rahaman


24

20

15

10

0
y

-5

-10

-15

-20
-8 -6 -4 -2 0 2 4 6 8
x

Solution:
clc
clear all
r1=3:1:10;
r2=2;
V=(4/3)*pi*(r1.^3-r2.^3);
plot(r1,V,'k');
%bar(r1,V,'k-.','linewidth',2.5,'markersize',15)
xlabel('Externat radius(cm)','fontsize',12)
ylabel('Volume(cubic cm)','fontsize',12)
%title('Comparing the graph between sinx and cosx','fontsize',12)
axis([0 10 -400 4000])
%text(-7.8,70,'Comparison between -4<=x<=4 and -
2.7<=x<=2.7','edgecolor','k','linewidth',1)
%hold on
%plot(x2,y2,'k-.','linewidth',1.5,'markersize',15)

prepared by K. M. Ashikur Rahaman


25

legend('Volume',0)
%axis equal
%plot([0 10],[0 0],'k')
%plot([0 0],[-400 4000],'k')
%hold off

Output:

4000
Volume
3500

3000
Volume(cubic cm)

2500

2000

1500

1000

500

0 1 2 3 4 5 6 7 8 9 10
Externat radius(cm)

Solution:
clc
clear all
t=linspace(-5,5,20);
x=2+3.*sin(pi.*t+10).*exp(-0.35.*t);
plot(t,x,'--')
xlabel('t')

prepared by K. M. Ashikur Rahaman


26

ylabel('x')
title('graph of a trigonometric function')
axis([-20 20 -6 6])

graph of a trigonometric function


6

0
x

-2

-4

-6
-20 -15 -10 -5 0 5 10 15 20
t

prepared by K. M. Ashikur Rahaman


27

Solution:
clc
clear all
EL=0:10.^(-3):10*10.^(-3);
ITF=[0 1000 1700 3300 4500 7000 10400 12100 13300 14100 14700];
DTF=[0 0 1500 2200 3600 5900 8700 11400 12900 13300 14700];
plot(EL,ITF,('sk'))
hold on
plot(EL,DTF,'vr')
xlabel('Elogation(inches)')
ylabel('depenndent variable(lbs)')
legend('Increasing tension force','Decreasing Tension force')

Output:

15000
Increasing tension force
Decreasing Tension force
depenndent variable(lbs)

10000

5000

0
0 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.01
Elogation(inches)

prepared by K. M. Ashikur Rahaman

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy