Mechi Multiple Campus: Lab Report of Mathematics-II (CAMT-154)
Mechi Multiple Campus: Lab Report of Mathematics-II (CAMT-154)
Tribhuvan University
Bhadrapur, Jhapa, Nepal
Submitted By
Name: - Tirtha Bahadur Rajbanshi
Roll no: - 66
Submitted To
Mechi Multiple Campus
Department of Bachelor in Computer Applications
Bhadrapur, Jhapa, Nepal
Roll no: - 66
i
CERTIFICATE FROM THE SUPERVISOR
ii
PREFACE
The Lab report of BCA 2nd semester is the implementation of theoretical and
practical knowledge of various topics of mathematics on software’s such as
‘MATHEMATICA’ and ‘MATLAB’. This project is especially designed to
familiarize, develop and enhance the knowledge of students in software like
MATHEMATICA and MATLAB.
This lab report is assigned to students as they lag behind in fair result processing
and to solve the current problem of various academic institutions. The report is
made by using MATLAB and MATHEMATICA and also using my own related
knowledge which I gained from the theory and practical classes of
‘MATHEMATICS-II’.
This Lab report is made to obtain the information about various uses of
mathematical software tools. The main objective of this report is to make BCA
students capable of using mathematical software and perform related problems in a
systematic way.
The report includes all features of lab practicals which is essential in enhancing the
skill of students for the fruitful career ahead in future. Finally, I welcome valuable
and constructive suggestions and comments from all the readers on any aspects of
this for improving my logic.
iii
ACKNOWLEDGEMENT
This lab report is especially assigned by the academic institution to the students of
BCA 2nd semester for the partial fulfilment of the course and designed for the
systematic and accurate use of mathematical software’s i.e. ‘MATLAB’ and
‘MATHEMATICA’.
For successful completion of this lab report there are various hands to help me out
to whom I am greatly thankful.
I would like to thank BCA director Mr. Krishna Prasad Acharya sir who granted
our project work by understanding the needs of students. I am highly indebted to
my subject teacher Mr. Kumar Subedi sir for his guidance and constant supervision
as well as for providing necessary information regarding the project & also for the
support in completing the lab report. Similarly, I am thankful to the institution and
faculty management for providing essential resources and remarkable support in
this report.
Lastly, I would express heartfelt gratitude to the TU board for innovation of such a
wonderful course structure which can surely help to enhance the skill and career of
student’s ahead in future.
iv
TABLE OF CONTENT
Part A: Mathematica (Wolfram Mathematica)..........................................................1
Introduction..................................................................................................................... 1
Limit and Continuity.......................................................................................................2
Limit of Trigonometric Function.................................................................................4
Some Graphs of Limits................................................................................................5
One Sided Limits.........................................................................................................6
Differentiation................................................................................................................. 7
Derivatives................................................................................................................... 7
Application of Derivatives...........................................................................................9
Maxima and Minima...................................................................................................9
Some Graphs of Derivatives......................................................................................10
Integration..................................................................................................................... 13
Definite integrals.......................................................................................................14
Improper Integrals.....................................................................................................15
Part A: MATLAB (Matrix Laboratory)...................................................................16
Introduction...................................................................................................................16
Assigning Scalars, Array, Vectors & Matrix.................................................................17
Linear Programming.....................................................................................................19
Simpson’s 1/3 Rule.......................................................................................................20
Trapezodial Rule...........................................................................................................21
v
Part A: Mathematica (Wolfram Mathematica)
Introduction
Note:
a. Parentheses i.e. ()
Parentheses are used only for grouping expressions. Mostly, it is used to prove
arithmetic expressions. Like (2 + 3).
b. Brackets i.e. []
Brackets are used to enclose the arguments of a function. Like cos[x]
c. Braces i.e. {}
Braces are used only to enclose the elements of list/ranges. The list can be a set,
order pair or even a matrix.
1
Limit and Continuity
In [2]: = Limit [ 3+ x , x →1 ]
Out [2] = 4
In [3]: = Limit
[ ( 5 ∗ x3 +3 ∗ x )
x
, x →0 ]
Out [3] = 3
In [4]: = Limit
[ (√ x − 4 )
( x −6 )
,x →9
]
−1
Out [4] =
3
In [8]: = Limit
Out [8] = 4
[ ( x − √ 8− x 2)
( √ x 2 +12− 4 )
, x→2
]
In [9]: = Limit [ ( x 8 −256 )
( x − 2)
, x →1 ]
Out [9] = 255
In [14]: = Limit
[ ( x 2+ 7∗ x+ 3 )
( 9∗ x 2+7 ∗ x+ 2)
, x →1
]
11
Out [14] =
18
In [16]: = Limit [ ( √ x −1 − √ x ) , x → 1 ]
Out [16] =−1
In [17]: = Limit
[ ( √ x 2 +1 )
( x+ 1)
, x→∞
]
Out [17]: =1
2
3
Limit of Trigonometric Function
In [1]: = Limit [ sin [ x ]
x
, x→0 ]
Out [1] =1
[
In [4]: = Limit tan [ 4 ∗ x ] −
3∗x
( 3 ∗ x −sin [ 3 ∗ x ] )
, x→0
]
Out [4] =− ∞
[ ]
( sin [ x ] − cos [ x ] ) π
Limit ,x →
In [5]: =
(x − π4 ) 4
Out [5] =√ 2
4
Some Graphs of Limits
GraphicsRow [Plot [Sin[x]/x, {x,-2, 2}]}]
5
One Sided Limits
6
Differentiation
Derivatives
In [1]: = D [ 4 ∗ x +4 , x ]
Out [1] =4
In [2]: = D [ √ [ x ] , x ]
1
Out [2] =
2√ x
In [3]: = D [ 4 ∗ x 10 +4 ∗ x 5 −10 , x ]
Out [3] =20 x 4 +40 x 9
In [4]: = D [ ( x 4 + 3∗ x )( 5 ∗ x 4 − x ) , x ]
Out [4] =( − 1+ 20 x 3 )( 3 x + x 4 ) + ( 3+ 4 x 3)( − x +5 x 4 )
In [5]: = D [ sin [ x ] , x ]
Out [5] =cos [ x ]
In [6]: = D [ cos [ x ] , x ]
Out [6] =− sin [ x ]
In [7]: = D [ exp [ x ] , x ]
Out [7] = ⅇ x
In [8]: = D [ log [ x ] , x ]
1
Out [8] =
x
7
8
Application of Derivatives
Maxima and Minima
9
Some Graphs of Derivatives
Plot [ x , { x , −2,2 } ]
2
10
Plot [ x 3 , {x , −1,1 }]
Plot [ −2 ∗ x +6 ∗ x −3 , { x , −4,5 }]
3 2
11
Plot [ x −2 ∗ x − 3 ,{ x , −10,10 }]
4 2
Plot [ x 4 −7 ∗ x 2 +3 , { x , −3,5 } ]
12
Integration
In [2]: = ∫ ( x+ 9 ) ⅆx
x2
Out [2] =9 x +
2
In [3]: = Integrate
[ ( 4 ∗ x 3 +2 ∗ x +5 )
x
2
,x
]
−5
Out [3] = +2 x 2 +2 log [ x ]
x
13
Definite integrals
14
Improper Integrals
∞
2
In [1]: =∫ ❑ ⅆx
0 ( x +2 )
2
π
Out [1] =
√2
1
2
In [6]: =∫ ❑ ⅆx
0 √x
Out [6] =4
∞
2
In [7]: = ∫ ❑ ⅆx
−∞ ( 1+ x 2)
Out [7] =2 π
15
Part A: MATLAB (Matrix Laboratory)
Introduction
If we type
>> 8 + 5
Press Enter
MATLAB will display: -
Ans =13
16
Assigning Scalars, Array, Vectors & Matrix
>> x=4
x=
>> a=[1 2 3 4]
a=
1 2 3 4
>> b=[1; 2; 3; 4]
b=
1
2
3
4
>> A=[1 2 3; 4 3 2; 5 6
7]
A=
1 2 3
4 3 2
5 6 7
17
>> A=[1 2 3
432
5 6 7]
A=
1 2 3
4 3 2
5 6 7
>> A(1, 2)
ans =
18
Linear Programming
>>F=[-7; -5];
>>b=[6; 6; 0; 0];
>>A=[1 2; 4 3; -1 0; 0 -1];
>>[x, fmin]= linprog(f, A, b)
X=
1.5000
0
fmin=
-10.5000
19
Simpson’s 1/3 Rule
f = @(x)(1/(1+x^2));
a = 0;
b = 1;
n = 4;
h = (b-a)/n;
s=(f(a)+f(b));
for i=1:n-1
s=s+4*f(a+i*h);
end
for k=2:2:n-2;
s=s-2*f(a+k*h);
end
I=(h/3)*s
>>Simpson
I=
0.7854
20
Trapezodial Rule
>>Trapezodial
I=
1.8961
21