MTHEMTICL FUNDMENTLS I Michele Fitpatrick
OVERVIEW Vectors and arras Matrices Linear algebra Del( operator Tensors
DEFINITIONS vector is a single row or column of numbers. n arra is a collection of vectors or numbers. matri is a two-dimensional numeric arra that represents a linear transformation. Linear algebra includes mathematical operations defined on matrices, including matri arithmetic, linear equations, eigenvalues, singular values, and matri factoriations.
VECTOR NOTTION i j k
MTRIX FORMT We can represent a sstem of linear equations, a a a b n n a a a b n n a a a m m mn n b m
MTRIX FORMT (cont. as the matri: where a ij are the matri elements. m n mn m m n n b b b a a a a a a a a a
MTRIX TYPES Square: m n Rectangular: m n Column: m Row: n
MTRIX TYPES (cont. Identit (I: aij where δ ij is the Kronecker delta: δ ij Diagonal: a c δ ij i ij where c i are a set of constants., 0, δ ij i i j j
MTLB VECTORS Creating a vector: [,, 3, 4] or [ 3 4]: row vector also: ::4, Colon operator (start, increment, end [; ; 3; 4]: column vector Creating arras and matrices: [,, 3, 4; 5, 6, 7, 8]
MTLB ELEMENTRY MTRICES eros - Zeros arra. ones - Ones arra. ee - Identit matri. repmat - Replicate and tile arra. rand - Uniforml distributed random numbers. randn - Normall distributed random numbers. linspace - Linearl spaced vector. logspace - Logarithmicall spaced vector. freqspace - Frequenc spacing for frequenc response. meshgrid - X and Y arras for 3-D plots. accumarra - Construct an arra with accumulation. : - Regularl spaced vector and inde into matri.
MTLB VECTOR OPERTIONS dding vectors - Transposing vector (turns row vector into column vector or vice versa
VECTOR MULTIPLICTION Dot product: Cross product: B B B B B B B B B B B ( ( ( B B B B
VECTOR MULTIPLICTION EXERCISE Find B and B for: 3 4 B 5
VECTOR EXERCISE NSWERS B ( 3*5 ( * (4* 5 B [( * (4*] [(4*5 (3*] [( 3* ( *5]ẑ 0 7 6
MTLB VECTOR MULTIPLICTION row vector and a column vector of the same length can be multiplied in either order. The result is either a scalar, the inner product, or a matri, the outer product. u [3; ; 4]; v [ 0 -]; v*u X u*v X 6 0-3 0-8 0-4
MTLB MTRIX MULTIPLICTION * Matri multipl. X*Y is the matri product of X and Y. n scalar (a -b- matri ma multipl anthing. Otherwise, the number of columns of X must equal the number of rows of Y. C MTIMES(,B is called for the snta ' * B' when or B is an object..* rra multipl. X.*Y denotes element-b-element multiplication. X and Y must have the same dimensions unless one is a scalar. C TIMES(,B is called for the snta '.* B' when or B is an object.
MTLB DOT PRODUCT DOT Vector dot product. C DOT(,B returns the scalar product of the vectors and B. and B must be vectors of the same length. When and B are both column vectors, DOT(,B is the same as '*B. DOT(,B, for N-D arras and B, returns the scalar product along the first non-singleton dimension of and B. and B must have the same sie. DOT(,B,DIM returns the scalar product of and B in the dimension DIM.
MTLB CROSS PRODUCT CROSS Vector cross product. C CROSS(,B returns the cross product of the vectors and B. That is, C B. and B must be 3 element vectors. C CROSS(,B returns the cross product of and B along the first dimension of length 3. C CROSS(,B,DIM, where and B are N-D arras, returns the cross product of vectors in the dimension DIM of and B. and B must have the same sie, and both SIZE(,DIM and SIZE(B,DIM must be 3.
MTRIX OPERTIONS Matri transpose ( flips a matri about its main diagonal: a a ij ji
TRNSPOSE EXERCISE What is if 3 9 5 8 3 4 6 7
TRNSPOSE SOLUTION ' 3 5 8 4 9 3 6 7
DETERMINNTS determinant is a square arra of order n n : det( a a a n a a a n a a a n n nn The minor M ij of element a ij is the determinant of order (n- formed b deleting the ith row and the jth column of det(. The product (- ij M ij is the cofactor of a ij. The value of a determinant is defined as i j i j det( ( a M ( j ij ij i a ij M ij
DETERMINNT EXERCISE Use the determinant to find the epression for the cross product. Show all details. Reminder: det( i j i j ( aijm ij ( j i a ij M ij
MTRIX INVERSE The inverse of a matri, -, is defined such that: I MTLB: inv
MTRIX INVERSE EXMPLE Find the inverse of the matri: 0 0
MTRIX INVERSE SOLUTION Satisf the matri equation: Solve as three sets of linear equations with three unknowns each to get: I 0 0 0 0 0 0 0 0 3 3 3 3 4
SOLVING LINER EQUTIONS Given: a a a n n b a a a b n n a a a m m mn n b m Find:,, n
SOLVING L.E. (cont. llowed elementar row operations: Interchange two rows Multipl (or divide a row b a (nonero constant dd a multiple of one row to another; this includes subtracting, that is, using a negative multiple.
SOLVING L.E. EXERCISE Solve the following equations for,, : Corresponding matri: 4 7 3 5 6 4 0 7 3 5 6 0
L.E. EXERCISE RESULT 0 0 0 0 (,, ( 3,,
L.E. EXERCISE SOLUTION Subtract 3 times the first row from the second row Subtract the first row from the third row Interchange the second and third rows dd 5 times the second row to the third row Divide the third row b Back substitute
MTLB RREF RREF Reduced row echelon form. R RREF( produces the reduced row echelon form of.
RREF EXMPLE Eample: Use rref on a rank-deficient magic square: magic(4, R rref( 6 3 3 5 0 8 9 7 6 4 4 5 R 0 0 0 0 3 0 0-3 0 0 0 0
DEL OPERTOR ( r r r θ θ φ φ θ θ θ sin r r r r Rectangular Coordinates: Clindrical Coordinates: Spherical Coordinates:
GRDIENT If the del operator ( operates on a scalar function, f(,,, we get the gradient (a vector: f f f f We can interpret this gradient as a vector with the magnitude and direction of the maimum change of the function in space.
GRDIENT EXERCISES f 3 5,, ( f,, ( 3 3 3,, ( f
GRDIENT EXERCISE NSWERS f 3 5 f ( ( ( f (9 3 ( (4 3 3
DIVERGENCE & CURL Since the del operator is treated as a vector, there are two was for it to operate on another vector: dot product and cross product. The dot product gives us the divergence a scalar quantit. The cross product gives us the curl a vector quantit.
DIVERGENCE [ ]
DIVERGENCE EXERCISES 5 ( 3 ( 4 3 ( B 5 ( 3 ( 4 (3
DIVERGENCE EXERCISE NSWERS 5 ( 3 ( 4 3 ( 6 5 3 5 ( 3 ( 4 (3 B 3 0 4 0 3 ( 6
CURL [ ]
CURL EXERCISE ( 3 4 ( 3 ( 5
CURL EXERCISE NSWER 3 ( 5 ( 5 ( 4 3 ( 4 (3 3 ( 4 3
EIGEN DEFINITIONS Let be an matri, v an column vector, and λ a scalar. If v λv we sa that v is an eigenvector of and λ is an eigenvalue of.
EIGENVLUE SOLUTIONS To find the eigenvalues of, solve det λi 0 where I is the n n identit matri.
EIGENVLUE EXERCISE Find the eigenvalues of 5 9
EIGENVLUE EXERCISE SOLUTION 0 0 I λ λ λ 0 0 I λ λ λ λ λ 9 5 det 0 0 9 5 det det I 8 ( 5 ( λ λ 8 7 8 7 0 λ λ λ λ
EIGENVLUE SOLUTION (cont. Set equal to ero and solve: λ 7λ 8 0 ( λ 8( λ 0 λ λ 8
EIGENVECTORS Find the eigenvectors v of: 5 9 Using the eigenvalues of: λ λ 8
EIGENVECTOR SOLUTION For the first eigenvalue, the matri equation is: 5 v λ v 8 9 If we solve these equations, for and, we get and 3 For the second eigenvalue, we get and -3
EIGENVECTOR SUMMRY Summariing, we have found the eigenvectors of the matri to be: v with eigenvalue 3 8 λ v with eigenvalue λ 3
MTLB EIGENVLUES EIG Eigenvalues and eigenvectors. E EIG(X is a vector containing the eigenvalues of a square matri X. [V,D] EIG(X produces a diagonal matri D of eigenvalues and a full matri V whose columns are the corresponding eigenvectors so that X*V V*D. [V,D] EIG(X,'nobalance' performs the computation with balancing disabled, which sometimes gives more accurate results for certain problems with unusual scaling. If X is smmetric, EIG(X,'nobalance' is ignored since X is alread balanced. E EIG(,B is a vector containing the generalied eigenvalues of square matrices and B. [V,D] EIG(,B produces a diagonal matri D of generalied eigenvalues and a full matri V whose columns are the corresponding eigenvectors so that *V B*V*D.
MTLB EIGENVLUES (cont. EIG(,B,'chol' is the same as EIG(,B for smmetric and smmetric positive definite B. It computes the generalied eigenvalues of and B using the Cholesk factoriation of B. EIG(,B,'q' ignores the smmetr of and B and uses the QZ algorithm. In general, the two algorithms return the same result, however using the QZ algorithm ma be more stable for certain problems. The flag is ignored when and B are not smmetric.
TENSORS n n th rank tensor in m-dimensional space is a mathematical object that has n indices and m n components and obes certain transformation rules. Each inde of a tensor ranges over the number of dimensions of space. Tensors are generaliations of scalars (that have no indices, vectors (that have eactl one inde, and matrices (that have eactl two indices to an arbitrar number of indices.
TENSORS IN GEOPHYSICS Perhaps the most important engineering and geophsics tensor eamples are the stress tensor and strain tensor, which are both second rank tensors, and are related in a general linear material b a fourth rank elasticit tensor: σ C ε ij ijkl kl
TENSOR EXMPLE - STRESS Stress is defined as the force acting on a unit area of a surface: σ F nds This is actuall a tensor, σ ij, with nine components, where i and j represent the cartesian aes, and. σ σ σ σ σ σ σ σ σ σ
STRESS (cont. The first inde, i, gives the ais along which the stress is acting; the second inde, j, is the ais normal to the area on which the stress is acting. For eample, σ denotes a stress parallel to the -ais acting upon a surface perpendicular to the -ais. Stresses σ, σ, and σ are normal stresses. The other 6 are shear stresses. Stress components have the smmetric propert of: σ ij σ ji
STRIN TENSOR The strain tensor is: ε ε ε ε It also has the smmetric propert: ε ε ε ε ε ij ji ε ε ε
STRIN TENSOR (cont. The strain tensor is related to the displacement vector b derivatives in different directions, since strain is the measure of the relative deformation of the material. The normal strain is: The shear strain is: w v u ε ε ε,, ( ( ( u w w v v u ε ε ε
STRIN TENSOR (cont. Together, the can be written as: Here we introduced the notation of using the comma between the sub-indices to epress the unit of strain is dimensionless. ( (,, i j j i i j j i ij u u u u ε
TENSOR EXMPLE ELSTIC MODULI s noted earlier, elastic moduli give the relationship between the nd rank tensor stress and the nd rank tensor strain, and are therefore represented b a 4 th rank tensor: σ C ε ij ijkl kl This is the tensor epression of Hooke s Law
TENSOR LGEBR The mathematics developed for working with matrices can be applied to tensors, so tensor algebra will not be treated as a separate subject. Note that the divergence operation decreases the order of the tensor b one and the gradient operation increases the order of a tensor b one.
MTLB TENSOR OPERTION KRON Kronecker tensor product. KRON(X,Y is the Kronecker tensor product of X and Y. The result is a large matri formed b taking all possible products between the elements of X and those of Y. For eample, if X is b 3, then KRON(X,Y is [ X(,*Y X(,*Y X(,3*Y X(,*Y X(,*Y X(,3*Y ] If either X or Y is sparse, onl nonero elements are multiplied in the computation, and the result is sparse.