Similar to Matrices(teaching)Matrices(teaching)Matrices(teaching)Matrices(teaching)Matrices(teaching)Matrices(teaching)Matrices(teaching) ppt.pptx (20)
PDF
Computer Science CS Project Matrix CBSE Class 12th XII .pdf
1. Matrices
by
L Surya
Department of CSA
KL Deemed to be university
Vijayawada, AP, India
Department of computer science and application
2. Contents
Applications of matrices
Creation of a matrix in R
Perform mathematical operations on matrices
Access the elements of a matrix
Department of computer science and application
3. Department of computer science and technology
Outcomes
• Know the applications of matrices
• Creating a matrix
• Perform mathematical operations on matrices
• Access the elements of a matrix
At the end of this lecture you will be
able to
4. Applications of matrices
• Computer graphics
• Probability and statistics
• Game theory
• Algorithms
• Quantum mechanics
7. Matrix creation
A matrix is created using
The matrix() function.
Syntax:
matrix_name<-
matrix(data,nrow,ncol,byrow,dimnames)
Where
Data – means input
nrow- number of rows
ncol – number of columns
byrow- means logical . If TRUE then the input vector
elements are arranged by row.
dimnames-is the names for the rows and columns.
8. Matrix creation
> x
[,1] [,2] [,3]
[1,] 10 11 12
[2,] 13 14 15
[3,] 16 17 18
Department of computer science and technology
12. Accessing the elements of matrix
Access the elements of a matrix by using
The column and row index of the element.
Syn:Matrix_name[row,column]
Ex: to access 3rd
row 2nd
column
>x[3,2]
13. Accessing the elements of matrix
[,1] [,2] [,3]
[1,] 10 11 12
[2,] 13 14 15
[3,] 16 17 18
[4,] 19 20 21
To access column
>
To access row column
>
To access only row
>
To access only column
>
14. Operations on matrices
Operations that can be done on matrices are
Arithmetic operations
-->Addition
-->Subtraction
-->Multiplication
-->Division