0% found this document useful (0 votes)
724 views44 pages

Computational Mathematics Laboratory: Lab Manual

This document contains information about a computational mathematics laboratory manual for the 2017-2018 academic year at the Institute of Aeronautical Engineering. It includes the course code, regulations, class, branch, and instructor preparing the manual. It also lists the program outcomes for engineering knowledge, problem analysis, design and development of solutions, investigations of complex problems, modern tool usage, engineer and society, environment and sustainability, ethics, individual and team work, communication, project management and finance, and lifelong learning. Finally, it provides the program specific outcomes for various engineering disciplines like aeronautical, computer science, information technology, electronics and communication, electrical and electronics, mechanical, and civil engineering.

Uploaded by

rahul d
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)
724 views44 pages

Computational Mathematics Laboratory: Lab Manual

This document contains information about a computational mathematics laboratory manual for the 2017-2018 academic year at the Institute of Aeronautical Engineering. It includes the course code, regulations, class, branch, and instructor preparing the manual. It also lists the program outcomes for engineering knowledge, problem analysis, design and development of solutions, investigations of complex problems, modern tool usage, engineer and society, environment and sustainability, ethics, individual and team work, communication, project management and finance, and lifelong learning. Finally, it provides the program specific outcomes for various engineering disciplines like aeronautical, computer science, information technology, electronics and communication, electrical and electronics, mechanical, and civil engineering.

Uploaded by

rahul d
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/ 44

COMPUTATIONAL MATHEMATICS LABORATORY

LAB MANUAL

Year : 2017 - 2018


Course Code : AHS102
Regulations : R16
Class : B.Tech I Semester
Branch : CSE / IT / ECE / EEE

Prepared By
Mr. G. Nagendra Kumar, Assistant Professor

FRESHMAN ENGINEERING
INSTITUTE OF AERONAUTICAL ENGINEERING
(Autonomous)
Dundigal, Hyderabad - 500 043
INSTITUTE OF AERONAUTICAL ENGINEERING
(Autonomous)
Dundigal, Hyderabad - 500 043

Program Outcomes
PO1 Engineering knowledge: Apply the knowledge of mathematics, science, engineeringfundamentals, and
an engineering specialization to the solution of complex engineering problems.
PO2 Problem analysis: Identify, formulate, review research literature, and analyze complexengineering
problems reaching substantiated conclusions using first principles of mathematics, natural sciences, and
engineering sciences.
PO3 Design/development of solutions: Design solutions for complex engineering problems anddesign
system components or processes that meet the specified needs with appropriate consideration for the
public health and safety, and the cultural, societal, and environmental considerations.
PO4 Conduct investigations of complex problems: Use research-based knowledge and researchmethods
including design of experiments, analysis and interpretation of data, and synthesis of the information to
provide valid conclusions.
PO5 Modern tool usage: Create, select, and apply appropriate techniques, resources, and
modernengineering and IT tools including prediction and modeling to complex engineering activities
with an understanding of the limitations.
PO6 The engineer and society: Apply reasoning informed by the contextual knowledge to assesssocietal,
health, safety, legal and cultural issues and the consequent responsibilities relevant to the professional
engineering practice.
PO7 Environment and sustainability: Understand the impact of the professional engineering solutionsin
societal and environmental contexts, and demonstrate the knowledge of, and need for sustainable
development.
PO8 Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms ofthe
engineering practice.
PO9 Individual and team work: Function effectively as an individual, and as a member or leader indiverse
teams, and in multidisciplinary settings.
PO10 Communication: Communicate effectively on complex engineering activities with the
engineeringcommunity and with society at large, such as, being able to comprehend and write effective
reports and design documentation, make effective presentations, and give and receive clear instructions.
PO11 Project management and finance: Demonstrate knowledge and understanding of theengineering and
management principles and apply these to one’s own work, as a member and leader in a team, to
manage projects and in multidisciplinary environments.
PO12 Life-long learning: Recognize the need for, and have the preparation and ability to engage
inindependent and life-long learning in the broadest context of technological change.
INSTITUTE OF AERONAUTICAL ENGINEERING
(Autonomous)
Dundigal, Hyderabad - 500 043

Program Specific Outcomes - Aeronautical Engineering


PSO1 Professional skills: Able to utilize the knowledge of aeronautical/aerospace engineering in innovative,
dynamic and challenging environment for design and development of new products
PSO2 Problem solving skills: imparted through simulation language skills and general purpose CAE
packages to solve practical, design and analysis problems of components to complete the challenge of
airworthiness for flight vehicles
PSO3 Practical implementation and testing skills: Providing different types of in house and training and
industry practice to fabricate and test and develop the products with more innovative technologies.
PSO4 Successful career and entrepreneurship: To prepare the students with broad aerospace knowledge to
design and develop systems and subsystems of aerospace and allied systems and become technocrats
Program Specific Outcomes - Computer Science And Engineering
PSO1 Professional Skills: The ability to research, understand and implement computer programs in the areas
related to algorithms, system software, multimedia, web design, big data analytics, and networking for
efficient analysis and design of computer-based systems of varying complexity.
PSO2 Problem-Solving Skills: The ability to apply standard practices and strategies in software project
development using open-ended programming environments to deliver a quality product for business
success.
PSO3 Successful Career and Entrepreneurship: The ability to employ modern computer languages,
environments, and platforms in creating innovative career paths, to be an entrepreneur, and a zest for
higher studies.
Program Specific Outcomes - Information Technology
PSO1 Professional Skills: The ability to research, understand and implement computer programs in the areas
related to algorithms, system software, multimedia, web design, big data analytics, and networking for
efficient analysis and design of computer-based systems of varying complexity.
PSO2 Software Engineering practices: The ability to apply standard practices and strategies in software
service management using open-ended programming environments with agility to deliver a quality
service for business success.
PSO3 Successful Career and Entrepreneurship: The ability to employ modern computer languages,
environments, and platforms in creating innovative career paths, to be an entrepreneur, and a zest for
higher studies.
Program Specific Outcomes - Electronics And Communication Engineering
PSO1 Professional Skills: An ability to understand the basic concepts in Electronics & Communication
Engineering and to apply them to various areas, like Electronics, Communications, Signal processing,
VLSI, Embedded systems etc., in the design and implementation of complex systems.
PSO2 Problem-solving Skills: An ability to solve complex Electronics and communication Engineering
problems, using latest hardware and software tools, along with analytical skills to arrive cost effective
and appropriate solutions.
PSO3 Successful Career and Entrepreneurship:An understanding of social-awareness & environmental-
wisdom along with ethical responsibility to have a successful career and to sustain passion and zeal for
real-world applications using optimal resources as an Entrepreneur
Program Specific Outcomes - Electrical And Electronics Engineering
PSO1 Professional Skills:Able to utilize the knowledge of high voltage engineering in collaboration with
power systems in innovative, dynamic and challenging environment, for the research based team work.

PSO2 Problem-Solving Skills: Can explore the scientific theories, ideas, methodologies and the new cutting
edge technologies in renewable energy engineering, and use this erudition in their professional
development and gain sufficient competence to solve the current and future energy problems
universally.
PSO3 Successful Career and Entrepreneurship: The understanding of technologies like PLC, PMC,
process controllers, transducers and HMI one can analyze, design electrical and electronics principles
to install, test , maintain power system and applications.
Program Specific Outcomes - Mechanical Engineering
PSO1 To produce engineering professional capable of analyzing and synthesizing mechanical systems
including allied engineering streams.
PSO2 An ability to adopt and integrate current technologies in the design and manufacturing domain to
enhance the employability.
PSO3 To build the nation, by imparting technological inputs and managerial skills to become technocrats.

Program Specific Outcomes - Civil Engineering


PSO1 Engineering Knowledge: Graduates shall demonstrate sound knowledge in analysis, design,
laboratory investigations and construction aspects of civil engineering infrastructure, along
with good foundation in mathematics, basic sciences and technical communication.
PSO2 Broadness and Diversity: Graduates will have a broad understanding of economical,
environmental, societal, health and safety factors involved in infrastructural development, and
shall demonstrate ability to function within multidisciplinary teams with competence in
modern tool usage.
PSO3 Self-Learning and Service: Graduates will be motivated for continuous self-learning in
engineering practice and/ or pursue research in advanced areas of civil engineering in order to
offer engineering services to the society, ethically and responsibly.
INSTITUTE OF AERONAUTICAL ENGINEERING
(Autonomous)
Dundigal, Hyderabad - 500 043

Certificate
This is to certify that it is a bonafied record of practical work done by
Sri/Kum. _____________________________________ bearing
the Roll No. ______________________ of ____________ class
_______________________________________ branch in the
____________________________ laboratory during the academic
year ___________________ under our supervision.

Head of the Department Lecturer In-Charge

External Examiner Internal Examiner


ATTAINMENT OF PROGRAM OUTCOMES & PROGRAM SPECIFIC OUTCOMES

Expt. No. Program Outcomes Attained Program Specific Outcomes Attained

CSE ECE EEE IT

I PO1, PO2, PO3, PO4, PO5, PO9, PO12 PSO1, PSO2 PSO2 PSO3 PSO1, PSO2

II PO1, PO2, PO3, PO4, PO5, PO9, PO12 PSO1, PSO2 PSO2 PSO3 PSO1, PSO2

III PO1, PO2, PO3, PO4, PO5, PO9, PO12 PSO1, PSO2 PSO2 PSO3 PSO1, PSO2

IV PO1, PO2, PO3, PO4, PO5, PO9, PO12 PSO1, PSO2 PSO2 PSO3 PSO1, PSO2

V PO1, PO2, PO3, PO4, PO5, PO9, PO12 PSO1, PSO2 PSO2 PSO3 PSO1, PSO2

VI PO1, PO2, PO3, PO4, PO5, PO9, PO12 PSO1, PSO2 PSO2 PSO3 PSO1, PSO2

VII PO1, PO2, PO3, PO4, PO5, PO9, PO12 PSO1, PSO2 PSO2 PSO3 PSO1, PSO2

VIII PO1, PO2, PO3, PO4, PO5, PO9, PO12 PSO1, PSO2 PSO2 PSO3 PSO1, PSO2

IX PO1, PO2, PO3, PO4, PO5, PO9, PO12 PSO1, PSO2 PSO2 PSO3 PSO1, PSO2

X PO1, PO2, PO3, PO4, PO5, PO9, PO12 PSO1, PSO2 PSO2 PSO3 PSO1, PSO2

XI PO1, PO2, PO3, PO4, PO5, PO9, PO12 PSO1, PSO2 PSO2 PSO3 PSO1, PSO2

XII PO1, PO2, PO3, PO4, PO5, PO9, PO12 PSO1, PSO2 PSO2 PSO3 PSO1, PSO2
COMPUTATIONAL MATHEMATICS LABORATORY SYLLABUS

Recommended Systems/Software Requirements:

Intel based desktop PC with minimum of 166 MHZ or faster processor with at least 64 MB RAM and
100MB free disk space. MATLAB compiler.

LIST OF EXPERIMENTS
Week-1 BASIC FEATURES
a. To Know the history and features of MATLAB
b. To Know the local environment of MATLAB
Week-2 ALGEBRA
a. Find the roots of the equations 6x5 -41x4 +97x3 -97x2 +41x-6
b. Find the values of x,y,z of the equations x+y+z=3,x+2y+3z=4,x+4y+9z=6
c. For f(x)=8x8 -7x7 +12x6 -5 x5 +8 x4 +13 x3 -12x+9 compute f(2),roots of f(x) and plotfor 0  x  20
Week-3 CALCULUS
a. Verification of basic properties of limits for the functions f(x) = (3x + 5)/(x - 3) and g(x) = x2 + 1as x endsto 4.
b. Find the derivative of (x+2)(x^2+3)
c. Calculate the area enclosed between the x-axis, and the curve y=x3 -2x+5 and the ordinates x = 1 and x = 2.
Week-4 MATRICES
a. Find the addition, subtraction and multiplication of matrix
1 2 9 1 2 3
   
A= 2 1 2 , B= 4 5 6
   
 3 4 3   7 8 9 

1 2 9
 
b. Find the transpose of matrix A= 2 1 2
 
 3 4 3 

1 2 3
 
c. Find the inverse of matrix A= 2 3 2
 
 1 2 5 
Week-5 SYSTEM OF LINEAR EQUATIONS
 1 2 3 
 
5 6 7
a. Find the rank of matrix A=  
 9 10 11
 
1 3 14 15 

 1 2 3 
 
5 6 7
b. Find the row echelon form A=  
 9 10 11
 
1 3 14 15 

 2 3  1
 
c. Find the LU decomposition of the matrix 1/2 1 1
 
 0 1  1 
Week-6 LINEAR TRANSFORMATION
1 2 3
 
a. Find the characteristics equation of the matrix 4 5 6
 
 7 8 0 

 1 8 10
 
b. Find the Eigen values of the matrix 4 2 4
 
  5 2 8 

3 1 1
 
c. Find the Eigen vector of the matrix 1 0 2
 
 1 2 0 
Week-7 DIFFERENTIATION AND INTEGRATION
a. Solve ( D  5 D  6 ) y  e
2 x

2
5 x

b. Solve   x(x
2
 y )dxdy
2

0 0

3 3 x 3 x  y

c. Solve    xyzdxdydz
0 0 0

Week-8 INTERPOLATION AND CURVE FITTING


a. Find the lagrange’s polynomial for the following data (0,2),(1,3),(2,12),(5,147)
b. Fit a straight line for the following data (0,12),(5,15),(10,17),(15,22),(20,24),(25,30)
c. Fit a polynomial curve for the following data (0,1),(1,1.8),(2,1.3),(3,2.5),(4,6.3)
Week-9 ROOT FINDING
write a program to find the root of the equation by using x 3-5x+3
a. Bisection Method
b. Regula Falsi
c. Newton Raphson Method
Week-10 NUMERICAL DIFFERENTION AND INTEGRATION
1 .2

a. Evaluate  e
x
by using trapezoidal and Simpson’s method
0

b. Evaluate y1=x+y, y(0)=1 of size h=0.2 by using Euler’s and Runge-Kutta method
Week-11 3D PLOTTING
a. Evaluate  ( 3 x 2 2
 8 y )dx  (4 y  6 xy )dy Where region is bounded by y  x
2
,y  x and plot the diagram.
y
b. Plot the surface for f  ( 2  c o s π x ) e
c. Plot the surface for 2+cost
Week-12 VECTOR CALCULUS
a. Find grad f where f=x3+y3+3xyz at (1,1,1)
b. If f  x y i  2 x y z j  3 y z k find div f at the point (1,-1,1)
2 2 2

c. If f  x y i  2 x y z j  3 y z k find curl f at the point (1,-1,1)


2 2 2
EXPERIMENT-I

1.1 OBJECTIVES

a. To Know the history and features of MATLAB


b. To Know the local environment of MATLAB

1.1.1 CONTENT

Introduction
MATLAB is a high-level language and interactive environment for numericalcomputation,
visualization, and programming. Using MATLAB, you can analyse data, develop algorithms, and
create models and applications. The language, tools, and built-inmath functions enable you to
explore multiple approaches and reach a solution fasterthan with spread sheets or traditional
programming languages, such as C/C++ or Java. You can use MATLAB for a range of applications,
including signal processing andcommunications, image and video processing, control systems, test
and measurement, computational finance, and computational biology. More than a million engineers
andscientists in industry and academia use MATLAB, the language of technical computing.

History

 Developed primarily by Cleve Moler in the 1970'sDerived from FORTRAN subroutines


LINPACK and EISPACK, linear and eigenvaluesystems.
 Developed primarily as an interactive system to access LINPACK and EISPACK.
 Gained its popularity through word of mouth, because it was not socially distributed.
 Rewritten in C in the 1980's with more functionality, which include plotting routines.
 The Math Works Inc. was created (1984) to market and continue development of
MATLAB.

Strengths

 MATLAB may behave as a calculator or as a programming language


 MATLAB combine nicely calculation and graphic plotting.
 MATLAB is relatively easy to learn
 MATLAB is interpreted (not compiled), errors are easy to fix
 MATLAB is optimized to be relatively fast when performing matrix operations
 MATLAB does have some object-oriented elements

Weaknesses

 MATLAB is not a general purpose programming language such as C, C++, or FORTRAN


 MATLAB is designed for scientific computing, and is not well suitable for other applications
 MATLAB is an interpreted language, slower than a compiled language such as C++
 MATLAB commands are specific for MATLAB usage. Most of them do not have a direct
equivalent with other programming language commands
Competition
One of MATLAB's competitors is Mathematica the symbolic computation program.MATLAB is
more convenient for numerical analysis and linear algebra. It is frequentlyused in engineering
community. Mathematica has superior symbolic manipulation, making it popular among physicists.
There are other competitors: Scilab, GNU Octave, and Rlab
Key Features

 It is a high-level language for numerical computation, visualization and application


development.
 It also provides an interactive environment for iterative exploration, design and problem
solving.
 It provides vast library of mathematical functions for linear algebra, statistics, Fourier analysis,
filtering, optimization, numerical integration and solving ordinary differential equations.
 It provides built-in graphics for visualizing data and tools for creating custom plots.
 MATLAB's programming interface gives development tools for improving code quality,
maintainability, and maximizing performance.
 It provides tools for building applications with custom graphical interfaces.
 It provides functions for integrating MATLAB based algorithms with external applications
and languages such as C, Java, .NET and Microsoft Excel.

MATLAB's Power of Computational Mathematics

MATLAB is used in every facet of computational mathematics. Following are some commonly used
mathematical calculations where it is used most commonly:

 Dealing with Matrices and Arrays


 2-D and 3-D Plotting and graphics
 Linear Algebra
 Algebraic Equations
 Non-linear Functions
 Statistics
 Data Analysis
 Calculus and Differential Equations
 Numerical Calculations
 Integration
 Transforms
 Curve Fitting
 Various other special functions

Uses of MATLAB

MATLAB is widely used as a computational tool in science and engineering encompassing the fields
of physics, chemistry, math and all engineering streams. It is used in a range of applications
including:

 Signal processing and Communications


 Image and video Processing
 Control systems
 Test and measurement
 Computational finance
 Computational biology

Understanding the MATLAB Environment

MATLAB development IDE can be launched from the icon created on the desktop. The main
working window in MATLAB is called the desktop. When MATLAB is started, the desktop appears
in its default layout:
The desktop includes these panels:

Current Folder - This panel allows you to access the project folders and files.

Command Window - This is the main area where commands can be entered at the command line. It
is indicated by the command prompt (>>).
Workspace - The workspace shows all the variables created and/or imported from files.

Command History - This panel shows or rerun commands that are entered at the command line.
You are now faced with the MATLAB desktop on your computer, which contains the prompt
(>>) in the Command Window. Usually, there are 2 types of prompt:

>>For full version


EDU> for educational version

Note:

1. To simplify the notation, we will use this prompt, >>, as a standard prompt sign, though our
MATLAB version is for educational purpose.
2. MATLAB adds variable to the workspace and displays the result in the Command Window.

Managing workspace and file commands

Command Description
cd Change current directory
clc Clear the Command Window
clear (all) Removes all variables from the workspace
clear x Remove x from the workspace
copy file Copy file or directory
delete Delete files
dir Display directory listing
exist Check if variables or functions are defined
help Display help for MATLAB functions
look for Search for specified word in all help entries
mkdir Make new directory
move file Move file or directory
pwd Identify current directory
rmdir Remove directory
type Display contents of file
what List MATLAB files in current directory
which Locate functions and files
who Display variables currently in the workspace
whos Display information on variables in the workspace

Commonly used Operators and Special Characters


MATLAB supports the following commonly used operators and special characters:

Operator Purpose
+ Plus; addition operator.
- Minus; subtraction operator.
* Scalar and matrix multiplication operator.
.* Array multiplication operator.
^ Scalar and matrix exponentiation operator.
.^ Array exponentiation operator.
\ Left-division operator.
/ Right-division operator.
.\ Array left-division operator.
./ Array right-division operator.
: Colon; generates regularly spaced elements and represents an
entire row or column.
() Parentheses; encloses function arguments and array indices;
overrides precedence.
[] Brackets; enclosures array elements.
. Decimal point.
… Ellipsis; line-continuation operator
, Comma; separates statements and elements in a row
; Semicolon; separates columns and suppresses display.
% Percent sign; designates a comment and specifies formatting.
_ Quote sign and transpose operator.
._ Non-conjugated transpose operator.
= Assignment operator.

Note:
If you end a statement with a semicolon, MATLAB performs the computation, butsuppresses the
display of output in the Command Window.
Special Variables and Constants
MATLAB supports the following special variables and constants:

Name Meaning
ans Most recent answer.
eps Accuracy of floating-point precision.
i,j The imaginary unit √-1.
Inf Infinity.
NaN Undefined numerical result (not a number).
pi The number π

Naming Variables
Variable names consist of a letter followed by any number of letters, digits or underscore.
MATLAB is case-sensitive.
Variable names can be of any length; however, MATLAB uses only first N characters, where N is
given by the function namelengthmax.

Saving Your Work


The save command is used for saving all the variables in the workspace, as a file with .mat
extension, in the current directory.
For example, save myfile
You can reload the file anytime later using the load command.
load myfile

Example 1:
Example 2:

In MATLAB environment, every variable is an array or matrix.


Example 3:

In the above example it creates a 1-by-1 matrix named ‘x’and stores the value 3 in its element.
Example 4:

In this example x is to find the square root of 25 it creates a 1-by-1 matrix named ‘x’and stores the
value 5 in its element
.
Note:
 Once a variable is entered into the system, you can refer to it later.
 Variables must have values before they are used.
 When you do not specify an output variable, MATLAB uses the variable ans, short for
answer, to store the results of your calculation.

Example 6:
Example 7:

In the above example we have multiple assignments


EXPERIMENT-2

2.1 OBJECTIVES

a. Find the roots of the equations 6x5 -41x4 +97x3 -97x2 +41x-6
b. Find the values of x,y,z of the equations x+y+z=3,x+2y+3z=4,x+4y+9z=6
c. For f(x)=8x8 -7x7 +12x6 -5 x5 +8 x4 +13 x3 -12x+9 compute f(2),roots of f(x) and plotfor
0  x  20

2.2 SOFTWARE REQUIRED

1. MATLAB R2013a.
2. Windows 7/XP SP2.

2.3 PROCEDURE

1. Open MATLAB
2. Open new M-file
3. Type the program
4. Save in current directory
5. Compile and Run the program
6. For the output see command window\ Figure window

2.4 PROGRAM
Roots of the equations 6x5 -41x4 +97x3 -97x2 +41x-6
v = [6, -41, 97, -97, 41,-6]; % writing the coefficients
s = roots(v);
disp('The first root is: '), disp(s(1));
disp('The second root is: '), disp(s(2));
disp('The third root is: '), disp(s(3));
disp('The fourth root is: '), disp(s(4));
disp('The fifth root is: '), disp(s(5));

Values of x,y,z of the equations x+y+z=3,x+2y+3z=4,x+4y+9z=6


A=[1,1,1;1,2,3;1,4,9];
b=[3;4;6];
A\b

f(2),roots and plot of f(x)


p=[8 -7 12 -5 8 13 0 -12 9];
polyval(p,2)
roots(p)
x=0:0.1:20;
y=polyval(p,x);
plot(x,y)

2.5 OUTPUT
Roots of the equations 6x5 -41x4 +97x3 -97x2 +41x-6
The first root is: 3.0000
The second root is:2.0000
The third root is: 1.0000
The fourth root is:0.5000
The fifth root is: 0.3333
Values of x,y,z of the equations x+y+z=3,x+2y+3z=4,x+4y+9z=6
ans =
2
1
0

f(2),roots and plot of f(x)


ans = 1977
ans = -0.2079 + 1.3091i
-0.2079 - 1.3091i
-0.8053 + 0.4306i
-0.8053 - 0.4306i
0.8878 + 0.9318i
0.8878 - 0.9318i
0.5629 + 0.3828i
0.5629 - 0.3828i

2.6 EXERCISES

a) Find the roots of the equation x5-3x4+6x2-5x+1=0


b) Find the roots of the equation x4-x-10=0
c) Find the roots of the equation x3-4x-9=0
d) Find the roots of the equation x3-5x+1=0
e) Find the values of x,y,z of the equations x+3z=10, 2x+y=4, 5y-4z=-2
f) Find the values of x,y,z of the equations 10x-y+2z=4, x+10y-z=3, 2x+3y+20z=7
g) Find the values of x,y,z of the equations 2x+y+z=10, 3x+2y+3z=18, x+4y+9z=16
h) Find the values of x,y,z,w of the equations 2x+y+z-2w=-10, 4x+2z+w=8, 3x+2y+2z=7, and
x+3y+2z-w= -5
i) Draw the graph of y = x2 for - 10  x  10 and compute f(3)

j) Draw the graph of y = x3-5x+1 for - 5  x  5 and find f(10)

k) Draw the graph of y = sinx for 0  x  30

l) Draw the graph of y=x3+cosx+10 for 4  x  4


EXPERIMENT-3

3.1 OBJECTIVES

a. Verification of basic properties of limits for the functions f(x) = (3x + 5)/(x - 3) and g(x) = x2 +
1as x endsto 4.
b. Find the derivative of (x+2)(x^2+3)
c. Find the area of the region bounded by the curve y=x3 -2x+5 and the ordinates x = 1 and x =
2.

3.2 SOFTWARE REQUIRED

1. MATLAB R2013a.
2. Windows 7/XP SP2.

3.3 PROCEDURE

1. Open MATLAB
2. Open new M-file
3. Type the program
4. Save in current directory
5. Compile and Run the program
6. For the output see command window\ Figure window

3.4 PROGRAM

Properties of limits
f = (3*x + 5)/(x-3);
g = x^2 + 1;
flim = limit(f, 4)
glim = limit (g, 4)
Add = limit(f + g, 4)
Sub = limit(f - g, 4)
Mult = limit(f*g, 4)
Div = limit (f/g, 4)

Derivative
syms x
f=(x+2)*(x^2+3)
diff(f)
diff(ans)
diff(ans)
diff(ans)

Integration
syms x
f = x^3 - 2*x +5;
a = int(f, 1, 2)
display('Area: '), disp(double(a));
3.5 OUTPUT

Properties of limits
l1 =17
l2 = 17
lAdd = 34
lSub = 0
lMult = 289
lDiv = 1

Derivative
f = (x+2)*(x^2+3)
ans = x^2+3+2*(x+2)*x
ans = 6*x+4
ans = 6
ans = 0

Integration
a =23/4
Area:5.7500

3.6 EXERCISES

a) Verify basic properties of limits for the functions f(x) =(x3-8x2+45)/(2x2-3x-9) and g(x)=(x3-27)/(x-
3) as x tends to three.

b) Verification of basic properties of limits for the functions f(x) = x 2 + 2 and g(x) = (3x + 5)/(x - 3) as
x tends to four.

c) Verify basic properties of limits for the functions f(x)=sin3x/x cosx and g(x)=(tan2x-x)/(3x-sinx) as
x tends to zero.

d) Verify basic properties of limits for the functions f(x)=logx/(x-1) and g(x)=sin(x-1)/(x2-1) as x tends
to one

e) Verify basic properties of limits for the functions f(x)=2log(1+x)/x and g(x)=(x 3-6x-9)/(x4-81)as x
tends to zero.

f) Find the derivatives of f(x)=x6-6x5+5x2+2

g) Find the derivatives of f(x)=sinx+logx

h) Find the derivatives of f(x)=x2logx+sinx

i) Find the derivatives of f(x)= (x2+6x+3)/(x+5)

j) Find the area of the region bounded by the curve y= x2-3x+2 and the ordinates x = 0 and x = 3.

k) Find the area of the region bounded by the curve y= x4-x-10 and the ordinates x = 1and x = 3
.
l) Find the area of the region bounded by the curve y= x3-4x-9 and the ordinates x = 0 and x = 2.

m) Find the area of the region bounded by the curve y= x3-5x+1and the ordinates x = 1 and x = 2.
EXPERIMENT-4

4.1 OBJECTIVES

a. Find the addition, subtraction and multiplication of matrix


1 2 9  1 2 3
   
A= 2 1 2 , B= 4 5 6
   
 3 4 3   7 8 9 

1 2 9
 
b. Find the transpose of matrix A= 2 1 2
 
 3 4 3 

1 2 3
 
c. Find the inverse of matrix A= 2 3 2
 
 1 2 5 
4.2 SOFTWARE REQUIRED

1. MATLAB R2013a.
2. Windows 7/XP SP2.

4.3 PROCEDURE

1. Open MATLAB
2. Open new M-file
3. Type the program
4. Save in current directory
5. Compile and Run the program
6. For the output see command window\ Figure window

4.4 PROGRAM

Addition, Subtraction and Multiplication of matrix


a=[1 2 -9 ; 2 -1 2; 3 -4 3];
b=[1 2 3; 4 5 6; 7 8 9];
disp('The matrix a= ');a
disp('The matrix b= ');b
% to find sum of a and b
c=a+b;
disp('The sum of a and b is ');c
% to find difference of a and b
d=a-b;
disp('The difference of a and b is ');d
%to find multiplication of a and b
e=a*b;
disp('The product of a and b is ');e
% to find element-by-element multiplication

Transpose of matrix
A=[1,2,-9;2,-1,2;3,-4,3]
B = A.'
Inverse of matrix
a = [ 1 2 3; 2 3 4; 1 2 5]
inv (a)

4.5 OUTPUT
Addition, Subtraction and Multiplication of matrix
The matrix a=
a=
1 2 -9
2 -1 2
3 -4 3
The matrix b=
b=
1 2 3
4 5 6
7 8 9
The sum of a and b is
c=
2 4 -6
6 4 8
10 4 12

The difference of a and b is


d=
0 0 -12
-2 -6 -4
-4 -12 -6

The product of a and b is


e=
-54 -60 -66
12 15 18
8 10 12
Transpose of matrix
A=
1 2 -9
2 -1 2
3 -4 3
B=
1 2 3
2 -1 -4
-9 2 3
Inverse of matrix
a=
1 2 3
2 3 4
1 2 5

ans =
-3.5000 2.0000 0.5000
3.0000 -1.0000 -1.0000
-0.5000 0 0.5000
4.6 EXERCISES
1 4  9 4 
a) Find the addition, subtraction and multiplication of matrices A=   ,B=  
2 9 2 1 

1 3 2  2 2 4 
 
b) Find the addition, subtraction and multiplication of matrices A= 
2 1 3

,B=  1 3 4


 4 1 3   1 2  3 

2 3 1  1 2 6 
   
c) Find the addition, subtraction and multiplication of matrices A= 0 1 5 ,B= 0 1 3
   
 1 2 3    2 0 1 

1 4 1  2 3 0
 
d) Find the addition, subtraction and multiplication of matrices A= 
2 7 1

,B=  5 7 1


 3 10 0    6 8 1 

 1 2 3
e) Find the transpose of a matrix A=  
1 0 2

4 0 5

f) Find the transpose of a matrix A=  1 2 0




 0 3 1 

3 2

g) Find the transpose of a matrix A=  1 5




 4 3 

 4 3
h) Find the transpose of a matrix A=  
1 1 

1 2 2

i) Find the inverse of a matrix A=  2 3 0




 0 1 2 

1 2 3

j) Find the inverse of a matrix A=  0 2 0




 0 0 3 

0 1 2 2
 
1 1 2 3
k) Find the inverse of a matrix A=  
2 2 2 3
 
2 3 3 3

1 3 3 1
 
1 1 1 0
l) Find the inverse of a matrix A=  
 2 5 2 3
 
1 1 0 1 
EXPERIMENT-5

5.1 OBJECTIVES

 1 2 3 
 
5 6 7
a. Find the rank of matrix A=  
 9 10 11
 
1 3 14 15

 1 2 3 
 
5 6 7
b. Find the row echelon form A=  
 9 10 11
 
1 3 14 15

 2 3  1
 
c. Find the LU decomposition of the matrix 1/2 1 1
 
 0 1  1 

5.2 SOFTWARE REQUIRED

1. MATLAB R2013a.
2. Windows 7/XP SP2.

5.3 PROCEDURE
1. Open MATLAB
2. Open new M-file
3. Type the program
4. Save in current directory
5. Compile and Run the program
6. For the output see command window\ Figure window

5.4 PROGRAM

Rank of matrix
A= [1, 2, 3; 5, 6, 7;9, 10, 11;13, 14, 15]
rank (A)

Row echelon form


A = [1, 2, 3;5, 6, 7;9, 10, 11;13, 14, 15]
R = rref(A)

LU decomposition
A = [2 -3 -1; 1/2 1 -1; 0 1 -1]
[L, U] = lu(A)
5.5 OUTPUT

Rank of matrix
A=
1 2 3
5 6 7
9 10 11
13 14 15

ans = 2

Row echelon form


A=
1 2 3
5 6 7
9 10 11
13 14 15

R=
1 0 -1
0 1 2
0 0 0
0 0 0

LU decomposition
L=
1.0000 0 0
0.2500 1.0000 0
0 0.5714 1.0000

U=
2.0000 -3.0000 -1.0000
0 1.7500 -0.7500
0 0 -0.5714

5.6 EXERCISES
1 1 1 1 
 
1 2 3 4
a) Find the rank of a matrix A=  
2 3 5 5
 
3 4 5 8 

 1 4 3 2 1 
 
2 3 1 4 3
b) Find the rank of a matrix A=  
1 6 7 2 9 
 
3 3 6 6 12 

1 2 1 2
 
1 3 2 2
c) Find the rank of a matrix A=  
2 4 3 4
 
3 7 5 6
2 1 3 5 
 
4 2 1 3
d) Find the rank of a matrix A=  
8 4 7 13 
 
8 4 3 1

0 1 3 1
 
1 0 1 1
e) Find the row echelon form of A=  
3 1 0 2 
 
1 1 2 0 

1 2 3 0
 
2 4 3 2
f) Find the row echelon form of A=  
3 2 1 3
 
6 8 7 5

 1 2 1 0 

g) Find the row echelon form of A=   2 4 3 0




 1 0 2  8 

2 4 3 1 0
 
1 2 1 4 2
h) Find the row echelon form of A=  
0 1 1 3 1
 
4 7 4 4 5

3 12 6 

i) Find the LU decomposition of the matrix A=  1 2 2




 0 1 1 

1 3 8

j) Find the LU decomposition of the matrix A=  1 4 3




 1 3 4 

 2 1 1

k) Find the LU decomposition of the matrix A=  1 2 2




  1 2  3 

3 1 3

l) Find the LU decomposition of the matrix A=  1 2 5




 1 1 1 
EXPERIMENT-6

6.1 OBJECTIVES

1 2 3
 
a. Find the characteristics equation of the matrix 4 5 6
 
 7 8 0 

 1 8 10
 
b. Find the Eigen values of the matrix 4 2 4
 
  5 2 8 

3 1 1
 
c. Find the Eigen vector of the matrix 1 0 2
 
 1 2 0 
6.2 SOFTWARE REQUIRED

1. MATLAB R2013a.
2. Windows 7/XP SP2.

6.3 PROCEDURE

1. Open MATLAB
2. Open new M-file
3. Type the program
4. Save in current directory
5. Compile and Run the program
6. For the output see command window\ Figure window

6.4 PROGRAM

Characteristics equation
A = [1 2 3; 4 5 6; 7 8 0]
p = poly(A)

Eigen values
A = [1 8 -10; -4 2 4; -5 2 8]
e = eig(A)

Eigen vector
A=[3,1,1;1,0,2;1,2,0];
[eigenvector, eigenvalue] = eig(A)

6.5 OUTPUT

Characteristics equation
A=
1 2 3
4 5 6
7 8 0
p =1.0000 -6.0000 -72.0000 -27.0000
Eigen values
A=
1 8 -10
-4 2 4
-5 2 8

e=
11.6219
-0.3110 + 2.6704i
-0.3110 - 2.6704i

Eigen vector
eigenvector =
-0.0000 0.5774 -0.8165
0.7071 -0.5774 -0.4082
-0.7071 -0.5774 -0.4082

eigenvalue =
-2.0000 0 0
0 1.0000 0
0 0 4.0000

6.6 EXERCISES
 5 2 0
 
a) Find the characteristics equation, Eigen value and Eigen vectors of the matrix 2 6 2
 
 0 2 7 

 6 2 2 
 
b) Find the characteristics equation, Eigen value and Eigen vectors of the matrix 2 3 1
 
 2 1 3 
c) Find the characteristics equation, Eigen value and Eigen vectors of the matrix
i 0 0
 
0 0 i
 
 0 i 0 

1 3 3
 
d) Find the characteristics equation, Eigen value and Eigen vectors of the matrix 3 5 3
 
 6 6 4 
EXPERIMENT-7

7.1 OBJECTIVES

 5D  6) y  e
2 x
a. solve (D
2
5 x

b. solve   x(x
2
 y )dxdy
2

0 0

3 3 x 3 x  y

c. solve    xyzdxdydz
0 0 0

7.2 SOFTWARE REQUIRED

1. MATLAB R2013a.
2. Windows 7/XP SP2.

7.3 PROCEDURE

1. Open MATLAB
2. Open new M-file
3. Type the program
4. Save in current directory
5. Compile and Run the program
6. For the output see command window\ Figure window

7.4 PROGRAM

Higher order differential


dsolve('D2y+5*Dy+6*y=exp(x)','x')

Double Integration
syms x y
firstint=int(x*(x^2+y^2),y,0,x^2)
answer=int(firstint,x,0,5)

Triple Integration
syms x y z
firstans=int(int(int(x*y*z,z,0,3-x-y),y,0,3-x),x,0,3)

7.5 OUTPUT

Higher order differential


ans =exp(-2*x)*C2+exp(-3*x)*C1+1/12*exp(x)

Double Integration
firstint = 1/3*x^7+x^5
answer = 453125/24

Triple Integration
firstans = 81/80
7.6 EXERCISES
2
d y dy
 2  y  e
2x
a. Solve 2
dx dx

b. Solve (D +2D -D-2)y=1-4x3


3 2

c. Solve (D4-1)y=ex cosx


2
d y
d. Solve 2
 y  s in 2 x
dx
1 x
2 2
e. Solve   ( x  y )d y d x
0 x

2
1 x
y/x
f. Solve   e dydx
0 0

2 3
g. Solve   x yd y d x
0 0

1 x
h. Solve   2 2
x y ( x  y )d y d x
0 x

1 2 3
i. Solve    xyzd xd yd z
0 1 2

1 1 x 1 x  y

j. Solve   
x
e dxdydz
0 0 0

1 1 1 x

k. Solve    xd zd yd x
0 y 0

2 2 2
1 1 x 1 x y
l. Solve    xyzd xd yd z
0 0 0
EXPERIMENT-8

8.1 OBJECTIVES

a. Find the lagrange’s polynomial for the following data (0,2),(1,3),(2,12),(5,147)


b. Fit a straight line for the following data (0,12),(5,15),(10,17),(15,22),(20,24),(25,30)
c. Fit a polynomial curve for the following data (0,1),(1,1.8),(2,1.3),(3,2.5),(4,6.3)

8.2 SOFTWARE REQUIRED

1. MATLAB R2013a.
2. Windows 7/XP SP2.

8.3 PROCEDURE

1. Open MATLAB
2. Open new M-file
3. Type the program
4. Save in current directory
5. Compile and Run the program
6. For the output see command window\ Figure window

8.4 PROGRAM

Lagrange’s polynomial
x=[0 1 2 5];
y=[2 3 12 147];
disp([x;y])
v=vander(x)
c=v\y'

Straight Line
x=[0 5 10 15 20 25];
y=[12 15 17 22 24 30];
disp([x;y])
p=polyfit(x,y,1);
disp(p);

Polynomial curve
x=[0 1 2 3 4];
y=[1 1.8 1.3 2.5 6.3];
disp([x;y])
p=polyfit(x,y,2);
disp(p);

8.5 OUTPUT

Lagrange’s polynomial
0 1 2 5
2 3 12 147

v =0 0 0 1
1 1 1 1
8 4 2 1
125 25 5 1
c =1.0000
1.0000
-1.0000
2.0000

Straight Line
0 5 10 15 20 25
12 15 17 22 24 30

0.6971 11.2857

Polynomial curve
0 1.0000 2.0000 3.0000 4.0000
1.0000 1.8000 1.3000 2.5000 6.3000

0.5500 -1.0700 1.4200

8.6 EXERCISES

a) Find the Lagrange’s polynomial for the data (0,12) (3,6) (4,8)
b) Find the Lagrange’s polynomial for the data (-1,-8) (0,3) (2,1) (3,12)
c) Find the Lagrange’s polynomial for the data (1,1) (3,27) (4,64)
d) Find the Lagrange’s polynomial for the data (1,1) (2,2) (3,9) (4,28)
e) Fit a straight line for the data (4,1) (3,2) (2,3) (1,4)
f) Fit a straight line for the data (0,1) (1,1.8) (2,3.3) (3,4.5) (4,6.3)
g) Fit a straight line for the data (1,2) (2,5) (3,4) (4,9) (5,10)
h) Fit a straight line for the data (0,-1) (2,5) (5,12) (7,20)
i) Fit a Second degree polynomial curve for the data (0,1) (1,6) (2,17)
j) Fit a Second degree polynomial curve for the data (0,1) (1,0) (2,3) (3,10) (4,21)
k) Fit a Second degree polynomial curve for the data (-1,-2) (0,1) (1,2) (2,4)
l) Fit a Second degree polynomial curve for the data (1,10) (2,12) (3,8) (4,10) (5,14)
EXPERIMENT-9

9.1 OBJECTIVES

write a program to find the root of the equation by using x 3-5x+3


a. Bisection Method
b. Regula Falsi
c. Newton Raphson Method

9.2 SOFTWARE REQUIRED

1. MATLAB R2013a.
2. Windows 7/XP SP2.

9.3 PROCEDURE

1. Open MATLAB
2. Open new M-file
3. Type the program
4. Save in current directory
5. Compile and Run the program
6. For the output see command window\ Figure window

9.4 PROGRAM

Bisection Method
f=@(x) x^3-5*x+3;
display('Equation is x^3-5*x+3= 0')
i=1;
while(i)
xl=input('Enter lower value:');
xu=input('Enter upper value: ');
e=input('Enter accuracy: ');
if f(xl)*f(xu)<0
i=0;
else
warning('Enter proper range');
end
end
if f(xl)<0
xn=xl;
xp=xu;
else
xn=xu;
xp=xl;
end
while (abs(xn-xp)>e)
xm=(xn+xp)/2;
if f(xm)<0
xn=xm;
else
xp=xm;
end
end
Root=xm
Regula Falsi
f=@(x) x^3-5*x+3;
display('Equation is x^3-5*x+3= 0')
i=1;
while(i)
xl=input('Enter lower value:');
xu=input('Enter upper value: ');
e=input('Enter accuracy: ');
if f(xl)*f(xu)<0
i=0;
else
warning('Enter proper range');
end
end
if f(xl)<0
xn=xl;
xp=xu;
else
xn=xu;
xp=xl;
end
xm=xl;
while (abs(f(xm))>e)
xm=(xn*f(xp)-xp*f(xn))/(f(xp)-f(xn));
if f(xm)<0
xn=xm;
else
xp=xm;
end
end
Root=xm

Newton Raphson Method


syms x
f= x^3-5*x+3;
fdash=diff(f);
disp('The equation is: '),disp(f);
disp('The derivative of equation is: '),disp(fdash);
y=inline(f);
dy=inline(fdash);
x0=input('Enter approximate root: ');
e=input('Enter the accuracy: ');
while abs(feval(y,x0))>e
h=-feval(y,x0)/feval(dy,x0);
x0=x0+h;
end
root=x0

9.5 OUTPUT
Bisection Method
Equation is x^3-5*x+3= 0
Enter lower value:1
Enter upper value: 2
Enter accuracy: 0.0001
Root =1.8343
Regula Falsi
Equation is x^3-5*x+3= 0
Enter lower value:1
Enter upper value: 2
Enter accuracy: 0.0001
Root =1.8342

Newton Raphson Method


The equation is: x^3-5*x+3
The derivative of equation is: 3*x^2-5
Enter approximate root: 1.5
Enter the accuracy: 0.0001
root =1.8343

9.6 EXERCISES

Find the root of the equation following equation by using Bisection Method, Regula Falsi and
Newton Raphson Methods
a) x3-x-1=0
b) 4sinx=ex

c) 2x-cosx=3
EXPERIMENT-10

10.1 OBJECTIVES
1 .2

a. Evaluate  e
x
by using trapezoidal and Simpson’s method
0

b. Evaluate y1=x+y, y(0)=1 of size h=0.2 by using Euler’s and Runge-Kutta method

10.2 SOFTWARE REQUIRED

1. MATLAB R2013a.
2. Windows 7/XP SP2.

10.3 PROCEDURE

1. Open MATLAB
2. Open new M-file
3. Type the program
4. Save in current directory
5. Compile and Run the program
6. For the output see command window\ Figure window

10.4 PROGRAM
Trapezoidal Method:
x=0:0.2:1.2;
y=exp(x);
trapz(x,y)

Simpson’s Method:
quad('exp(x)',0,1.2)

Euler’s and Runge-Kutta method


f=@(x,y) (x+y);
[x,y]=ode23(f,[0:0.2:1],1)
[x,y]=ode45(f,[0:0.2:1],1)

10.5 OUTPUT

Trapezoidal Method:
ans =2.3278

Simpson’s Method:
ans =2.3201

Euler’s method
x= 0
0.2000
0.4000
0.6000
0.8000
1.0000

y =1.0000
1.2428
1.5836
2.0442
2.6510
3.4364

Runge-Kutta method
x= 0
0.2000
0.4000
0.6000
0.8000
1.0000

y =1.0000
1.2428
1.5836
2.0442
2.6511
3.4366

10.6 EXERCISES

5 .2
a) Evaluate  4
lo g x d x using trapezoidal method
1
2
b) Evaluate  0
(1  x ) d x using trapezoidal method
5
c) Evaluate  2
e
s in x
dx using trapezoidal method
4
x
d) Evaluate  0
e dx using trapezoidal method
1 .2
e) Evaluate  0
s in x d x by using trapezoidal method
dy
f) Evaluate =3x2+1, y(1)=2 of size h=0.5 using Euler’s method
dx
dy
g) Evaluate =x+y+xy, y(0)=1 of size h=0.025 using Euler’s method
dx
dy
h) Evaluate =x2+y2, y(0)=0 of size h=0.1 using Euler’s method
dx
dy
i) Evaluate =2ex _3y, y(0)=0 of size h=0.25 using Euler’s method
dx
EXPERIMENT-11

11.1 OBJECTIVES

a. Evaluate  ( 3 x 2 2
 8 y )dx  (4 y  6 xy )dy Where region is bounded by y  x
2
,y  x and plot the
diagram.
y
b. Plot the surface for f  ( 2  c o s π x ) e
c. Plot the surface for 2+cost

11.2 SOFTWARE REQUIRED

1. MATLAB R2013a.
2. Windows 7/XP SP2.

11.3 PROCEDURE
1. Open MATLAB
2. Open new M-file
3. Type the program
4. Save in current directory
5. Compile and Run the program
6. For the output see command window\ Figure window

11.4 PROGRAM

Line Integral
clear all
clc
syms x y
f=[3*x.^2-8*y.^2 4*y-6*x*y];
disp('Along the curve y=x.^2')
a=subs(f,y,x.^2);
b=diff(x.^2,x);
c=b*a(2);
d=int(a(1),x,0,1);
e=int(c,x,0,1);
u=d+e
disp('Along the curve y=sqrt(x)')
p=subs(f,y,sqrt(x));
q=diff(sqrt(x),x);
r=q*p(2);
s=int(p(1),x,1,0);
t=int(r,x,1,0);
v=s+t
I=u+v
x=-2:0.5:2;
y2=sqrt(x);
y1=x.^2;
plot(x,y1,'r', x,y2,'g');
grid on

Surface
x=-1:.1:1;y=0:.1:1.5;
[X,Y]=meshgrid(x,y);
F=(2-cos(pi*X)).*exp(Y);
surf(X,Y,F);
xlabel('x');
ylabel('y');

Volume
t = 0:pi/10:2*pi;
figure
[X,Y,Z] = cylinder(2+cos(t));
surf(X,Y,Z)
axis square

11.5 OUTPUT

Line Integral
Along the curve y=x.^2
u =-1
Along the curve y=sqrt(x)
v =5/2
I =3/2

1.5
X: 1.002
Y: 1.001
1

0.5

-0.5

-1

-1.5

-2

-1.5 -1 -0.5 0 0.5 1 1.5 2

Surface

15

10

0
1.5
1
1
0.5
0.5 0
-0.5
y 0 -1
x

Volume

0.8

0.6

0.4

0.2

0
4
2 5
0
0
-2
-4 -5
11.6 EXERCISES

a. Evaluate  ( x 2 2
 y )d x  2 x y d y where the region is bounded by y= x2 and y= x and also plot 2D

diagram
b. Plot 3D surface for f=x2+y2
c. Plot 3D surface for f=cosx+siny
d. Plot 3D surface for f=y2+5cosπx
e. Plot 3D Volume for f=t2+2t+1
f. Plot 3D Volume for f=sint+cost
EXPERIMENT-12

12.1 OBJECTIVES

a. Find grad f where f=x3+y3+3xyz at (1,1,1)


b. If f  x y i  2 x y z j  3 y z k find div f at the point (1,-1,1)
2 2 2

c. If f  x y i  2 x y z j  3 y z k find curl f at the point (1,-1,1)


2 2 2

12.2 SOFTWARE REQUIRED

1. MATLAB R2013a.
2. Windows 7/XP SP2.

12.3 PROCEDURE

1. Open MATLAB
2. Open new M-file
3. Type the program
4. Save in current directory
5. Compile and Run the program
6. For the output see command window\ Figure window

12.4 PROGRAM

Gradient
syms x y z
f=x.^3+y.^3+3*x*y*z;
p = diff(f,x)
q = diff(f,y)
r = diff(f,z)
w=[p q r]
subs(w,{x,y,z},{1,1,1})

Divergent
syms x y z
f=[x*y.^2 2*x.^2*y*z -3*y*z.^2];
p = diff(f(1),x)
q = diff(f(2),y)
r = diff(f(3),z)
w=p+q+r
subs(w,{x,y,z},{1,-1,1})
Curl
syms x y z
f=[x*y.^2 2*x.^2*y*z -3*y*z.^2];
p=diff(f(3),y)-diff(f(2),z)
q=diff(f(3),x)-diff(f(1),z)
r=diff(f(2),x)-diff(f(1),y)
w=[p q r]
subs(w,{x,y,z},{1,-1,1})
12.5 OUTPUT

Gradient
p =3*x^2+3*y*z
q =3*y^2+3*x*z
r =3*x*y
w =[ 3*x^2+3*y*z, 3*y^2+3*x*z, 3*x*y]
ans = 6 6 3

Divergent
p =y^2
q =2*x^2*z
r =-6*y*z
w =y^2+2*x^2*z-6*y*z
ans = 9

Curl
p =-3*z^2-2*x^2*y
q =0
r =4*x*y*z-2*x*y
w = [ -3*z^2-2*x^2*y, 0, 4*x*y*z-2*x*y]
ans = -1 0 -2

12.6 EXERCISES

a. Find gradf where f= xy2+yz2at (2,-1,1)


b. Find gradf where f=xy+yz+zx at (1,2,3)
c. Find gradf where f=xyz2+xz at (1,1,1)
d. Find gradf where f= x2yz+4xz3at (1,-2,-1)
e. Find gradf where f=3xy2+y-z at (0,1,1)
f. Find divf where f=(x2+yz)i+(y2-zx)j+(z2+xy)k at (1,-2,3)
g. Find divf where f=(x3-yz)i-2x2yj+yzkat (3,-2,1)
h. Find divf where f=4xzi-y2j+yzk at (2,-1,1)
i. Find divf where f=(x2-xy3)i+(y2-2xy)j+(z2-xyz)k at (1,1,1)
j. Find divf where f=xy2i+2x2yzj-3yz2k at (1,-1,1)
k. Find curlf where f=(x2+yz)i+(y2-zx)j+(z2+xy)k at (1,-2,3)
l. Find curlf where f=(x3-yz)i-2x2yj+yzkat (3,-2,1)
m. Find curlf where f=4xzi-y2j+yzk at (2,-1,1)
n. Find curlf where f=(x2-xy3)i+(y2-2xy)j+(z2-xyz)k at (1,1,1)
o. Find curlf where f=xy2i+2x2yzj-3yz2k at (1,-1,1)

You might also like