2019학년도 1학기

반도체 공학과 공학수학1

주교재: Erwin Kreyszig, Engineering Mathematics, 10th Edition

부교재: 이상구 외 4인, 최신공학수학 I,  1st Edition

강의시간:  공학수학1, (화09:00-10:15)   (목10:30-11:45)

담당교수:  김응기 박사

Week 11

11주차

*6.7: Systems of ODEs

7.1: Matrices, Vectors

7.2: Matrix Multiplication

1.1 행렬의 성질과 연산

*6.7 Systems of ODEs

A first-order linear system with constant coefficients

(1)

Writing , , , , we obtain from the subsidiary system

By collecting the and terms we have

(2)

By solving this system algebraically for , and taking the inverse transform we obtain the solution , of this given system .

Setting , , , , we have

and   .

Example 1  Mixing Problem Involving Two Tanks

Tank initially contains of pure water. Tank initially contains of water in which of salt are dissolved. The inflow into is from and  containing of salt from the outside. The inflow into is from . The outflow from is . The mixture are kept uniform by stirring. Find and plot the salt contents and in and respectively.

Solution

The model is obtained in the form of two equations

Time rate of change

for the two tanks. Thus,

.

.

The initial conditions are , .

From this we see that the subsidiary system is

.

We solve this algebraically for and by elimination, and we write the solutions in terms of partial fractions,

By taking the inverse transform we arrive at the solution

Sage Coding

 t = var('t') y1 = function('y1')(t) y2 = function('y2')(t) de1 = diff(y1, t) == -8/100*y1 + 2/100*y2 + 6 de2 = diff(y2, t) == 8/100*y1 - 8/100*y2 desolve_system([de1, de2], [y1, y2], ics = [0, 0, 150])

Evaluate

[y1(t) == -125/2*e^(-3/25*t) - 75/2*e^(-1/25*t) + 100,

y2(t) == 125*e^(-3/25*t) - 75*e^(-1/25*t) + 100]

Example 3  Model of Two Masses on Spring

The mechanical system consists of two bodies of mass on three springs of the same springs constant and of negligibly small masses of the springs. Also damping is assumed to be practically zero. Then the model of the physical system is the system of ODEs

(3)

Here and are the displacements of bodies from their position of static equilibrium. These ODEs follow from Newton’s second law, for a single body. We again regard downward forces as positive and upward as negative. On the upper body, is the force of the upper spring and that of the middle springs, being the net change in spring length-think this over before going on. On the lower body, is the force of the middle spring and that of the lower spring.

We shall determine the solution corresponding to the initial conditions , , , . The initial conditions we obtain the subsidiary system

Hence the solution of our initial value problem is

.

Sage Coding

 # 라플라스 변환 var('y1, y2, s, t, k') assume(k > 0) y1 = function('y1')(t) y2 = function('y2')(t) eqy1 = diff(y1, t, 2) == -k*y1 + k*(y2-y1) eqy2 = diff(y2, t, 2) == -k*(y2-y1) - k*y2 EQY1 = eqy1.laplace(t, s) EQY2 = eqy2.laplace(t, s) var('Y1', 'Y2') strEQY1 = str(EQY1).replace('laplace(y1(t), t, s)', 'Y1').replace('laplace(y2(t), t, s)', 'Y2') strEQY2 = str(EQY2).replace('laplace(y1(t), t, s)', 'Y1').replace('laplace(y2(t), t, s)', 'Y2') # 초깃값대입 strEQY11 = strEQY1.replace('y1(0)', '1').replace('D[0](y1)(0)', 'sqrt(3*k)') strEQY21 = strEQY2.replace('y2(0)', '1').replace('D[0](y2)(0)', '-sqrt(3*k)') EQ1 = sage_eval(strEQY11, locals={'s':s, 'Y1':Y1, 'Y2':Y2, 'k':k}) EQ2 = sage_eval(strEQY21, locals={'s':s, 'Y1':Y1, 'Y2':Y2, 'k':k}) # 연립방정식 풀기 soln = solve([EQ1, EQ2], Y1, Y2) soly1 = soln[0][0].rhs().inverse_laplace(s, t) soly2 = soln[0][1].rhs().inverse_laplace(s, t) print "y1(t) =", soly1 print "y2(t) =", soly2

Evaluate

y1(t) = sin(sqrt(3)*sqrt(k)*t) + cos(sqrt(k)*t)

y2(t) = -sin(sqrt(3)*sqrt(k)*t) + cos(sqrt(k)*t)

Chapters 7 Linear Algebra

Matrices, Vector, Determinants, Linear Systems

This chapter deals with system of linear equations and linear transformations.

System of linear equations is linear systems.

System of linear equations arise in electrical models, mechanical frameworks, economic models, optimization problems, numerics for differential equations.

Linear algebra uses matrices and vectors as main tools.

Matrix : A rectangular arrays of numbers(or function) enclosed in brackets.

Calculations with matrices and vectors are defined and explained.

Linear systems

Rank

Gauss elimination

Matrix inversion

Cramer's rule

7.1. Matrices, Vectors: Addition and Scalar Multiplication

In this section we introduce the basic concepts and rules of matrix and vector algebra.

Matrix

A Matrix means that a rectangular array of numbers(or letters, functions) enclosed in brackets.

(1)       ,   ,    ,    ,

Entry

These numbers (or letters, functions) are the entries(or elements) of the matrix.

General Concepts and Notations

We shall denote matrices by capital boldface letters or by writing the general entry in brackets ; thus , and so on. By a matrix with rows and column is called a matrix (read by matrix or the pair of numbers ) matrix is called the size of the matrix. Each entry has subscripts. The first is the row numbers and second is the column numbers. Thus an matrix is of the form.

The horizontal lines -tuple are the rows of the matrix.

The vertical lines -tuple are the columns of the matrix.

Note that the element , called the -entry or -component, appears in the th row and the th column.

A matrix with the same number of rows and columns is a square matrix.

A square matrix with rows and columns is an square matrix.

Diagonal containing the entries is the main diagonal of .

matrix of any size is a rectangular matrix.

Matrices having just a single row or column are  vectors.

Matrices having just one row is  a row vectors.

Matrices having just one column is  a column vectors.

For example

: matrix

: matrix, -square matrix

: matrix, -square matrix

: row vector

: column vector

Example 1  Linear Systems, a Major Application of Matrices

A linear system such as

the coefficients of the unknowns are the entries of the coefficient matrix, call it .

.

The matrix  is obtained by augmenting by the right sides of the linear system and is the augmented matrix of the system.

Solution is , , .

Sage Coding

 A = matrix([[4, 6, 9], [6, 0, -2], [5, -8, 1]])  # 계수행렬 생성 b = vector([6, 20, 10]) Ab = A.augment(b)  # [A : b]의 RREF print "[A : b] =" print Ab print print Ab.rref()  # [A : b]의 RREF print  print A.solve_right(b)

Evaluate

[A : b] =

[ 4  6  9  6]

[ 6  0 -2 20]

[ 5 -8  1 10]

[  1   0   0   3]

[  0   1   0 1/2]

[  0   0   1  -1]

(3, 1/2, -1)

Example 2  Sales Figures in Matrix Form

A system of linear equation : Linear system

Sales figures for three products I, II, III in a store on Monday(M), Tuesday(T), Wednesday(W), Thursday(Th), Friday(F), Saturday(S) may for each week be arranged in a matrix,

.

Vectors

A vector is a matrix with only one row or column. Its entries are called the components of the vector. We shall denote vectors by lowercase boldface letter , , or by its general component in brackets, , and so on.

The matrix with one row is a row vectors.

A row vector is of the form .   For instance, .

The matrix with one column is a column vectors.

A column vector is of the form .   For instance, .

Addition and Scalar Multiplication of Matrices and Vectors

Definition  Equality of Matrices

Two matrices and are equal, written   they have the same size and the corresponding elements are equal.

Matrices that are not equal are called different.

Matrices of different sizes are always different.

and are equal

For example,

.

Example 3  Equality of Matrices

Let and .

Then       , , , .

The sum of two matrices and of the same size is written and has the entries obtained by adding corresponding entries of and .

Matrices of different sizes cannot be added.

The sum of two row vectors or two column vectors which must have the same numbers of components is obtained by adding the corresponding components.

Example 4  Addition of Matrices and Vectors

If and then

.

If and then

.

Sage Coding

 A = matrix([[-4, 6, 3], [0, 1, 2]]) B = matrix([[5, -1, 0], [3, 1, 0]]) print A + B

Evaluate

[1 5 3]

[3 2 2]

Definition  Scalar Multiplication(Multiplication by a Number)

The product of any matrices and any scalar is written and is the matrix obtained by multiplying each entry of the matrix by the scalar .

is  the negative of .

.

is  the difference of and .

Example 5  Scalar Multiplication

If then .

Sage Coding

 A = matrix(QQ, [[2.7, -1.8], [0, 0.9], [9.0, -4.5]]) print -A print print 10/9*A print print 0*A

Evaluate

[-27/10    9/5]

[     0  -9/10]

[    -9    9/2]

[ 3 -2]

[ 0  1]

[10 -5]

[0 0]

[0 0]

[0 0]

Laws for the addition of matrices of the same size , namely,

(a) Commutative law

(b) Associative law

(c)

(d) .

Here denotes the zero matrix, that is, the matrix with all entries zero.

is a zero vector. If or , this is a vector, called a zero vector.

Rules for Scalar Multiplication

The scalar multiplication of the same size , namely,

(a)

(b)

(c)

(d) .

7.2 Matrix Multiplication

In this section we introduce the basic concepts and rules of matrix and vector algebra.

Matrix multiplication means multiplication of matrices by matrices.

Definition  Multiplication of a Matrix by a Matrix

Product

column of  row of

( is matrix ) ( is matrix)

is matrix

(1)

( row of ) ( column of )

Example 1  Matrix Multiplication

Here and .

Sage Coding

 A = matrix(3, 3, [3, 5, -1, 4, 0, 2, -6, -3, 2])  B = matrix(3, 4, [2, -2, 3, 1, 5, 0, 7, 8, 9, -4, 1, 1]) (A*B).matrix_from_rows_and_columns([0], [0])

Evaluate

[22]

 A = matrix(3, 3, [3, 5, -1, 4, 0, 2, -6, -3, 2])  B = matrix(3, 4, [2, -2, 3, 1, 5, 0, 7, 8, 9, -4, 1, 1]) (A*B).matrix_from_rows_and_columns([1], [2])

Evaluate

[14]

 A = matrix(3, 3, [3, 5, -1, 4, 0, 2, -6, -3, 2])  B = matrix(3, 4, [2, -2, 3, 1, 5, 0, 7, 8, 9, -4, 1, 1]) A*B

Evaluate

[ 22  -2  43  42]

[ 26 -16  14   6]

[ -9   4 -37 -28]

Product is not defined.

column of row of

Example 2  Multiplication of a Matrix and a Vector

is undefined

column of row of

Sage Coding

 A = matrix(2, 2, [4, 2, 1, 8])  B = matrix(2, 1, [3, 5]) A*B

Evaluate

[22]

[43]

Example 3  Products of row and column Vectors

Sage Coding

 A = matrix(1, 3, [3, 6, 1])  B = matrix(3, 1, [1, 2, 4]) A*B

Evaluate

[19]

 A = matrix(1, 3, [3, 6, 1]) B = matrix(3, 1, [1, 2, 4]) B*A

Evaluate

[ 3  6  1]

[ 6 12  2]

[12 24  4]

 A = matrix(1, 3, [3, 6, 1]) B = matrix(3, 1, [1, 2, 4]) bool(A*B == B*A)

Evaluate

False

Example 4  Matrix multiplication is not commutative. in General

but

Sage Coding

 A = matrix(2, 2, [1, 1, 100, 100])  B = matrix(2, 2, [-1, 1, 1, -1]) show( A*B ) show( B*A ) bool(A*B == B*A)

Evaluate

[0 0]

[0 0]

[ 99  99]

[-99 -99]

does not necessarily imply , , .

Example

In general

Matrix multiplication rules

(a)

(b) Associative law :

(c) Distributive law :

(d) Distributive law : .

does not necessarily imply .

, ,

.

Sage Coding

 A = matrix(2, 2, [3, 0, 2, 0])  B = matrix(2, 2, [1, 3, 5, 7]) C = matrix(2, 2, [1, 3, 1, 4]) print bool(A*B == A*C) print bool(B ==C)

Evaluate

True

False

Matrix multiplication is a multiplication of rows into columns, we can write the defining formula more compactly as

(3)       ,

where is the row vector of and is the column vector of .

Example 5  Product in Terms Row and Column Vectors

If is of size and is of size , then

Parallel processing of products on the computer is facilitated by a variant of for computing , which is used by standard algorithms (such as in Lapack). In this method, is used as given, is taken in terms of its column vectors, and the product is computed columnwise thus,

(5)        .

Example 6  Computing Products Columnwise by

Solution

Calculate the columns

of and then write them as a single matrix.

Sage Coding

 A = matrix(2, 2, [4, 1, -5, 2])  B = matrix(2, 3, [3, 0, 7, -1, 4, 6]) print A*(B.column(0)) print A*(B.column(1)) print A*(B.column(2))

Evaluate

(11, -17)

(4, 8)

(34, -23)

Motivation of Multiplication by Linear Transformations

For variables these transformations are of the form.

(6*)         .

and suffice to explain the idea. For instance, may relate an -coordinate system to a -coordinate system in the plane.

In vectorial from we can write as

(6)

Now suppose further that the -system is related to a -system by another linear transformation, say,

(7)

Then the -system is related to the system indirectly via the -system, and we wish to express this relation directly. Substitution will show that this direct relation is a linear transformation, too, say,

(8)

Substitute into , we obtain

.

.

Comparing this with , we see that

,

.

This proves that with the product defined as in .

Transposition

Definition Transposition of matrices and vectors

Transpose of an matrix is the matrix .

Transpose of is

Transposition converts row vectors to column vectors and conversely.

Transpose of is .

Example 7  Transposition of Matrices and Vectors

If then

Sage Coding

 A = matrix(QQ,[[5, -8, 1], [4, 0, 0]]) C = matrix(QQ,[[3, 0], [8, -1]]) D = matrix(QQ, [[6, 2, 3,]]) print A.transpose()                # Transpose of a matrix  A.transpose() print print C.transpose() print print D.transpose()

Evaluate

[ 5  4]

[-8  0]

[ 1  0]

[ 3  8]

[ 0 -1]

[6]

[2]

[3]

Rules for transposition are

a.                    b.

c.                   d.

Symmetric matrix

Symmetric matrix of an matrix is the matrix .

Matrix whose transpose equals the matrix itself ().

Symmetric matrix of is

Symmetric matrix of is then .

Sage Coding

 A = matrix(3, 3, [20, 120, 200, 120, 10, 150, 200, 150, 30]) print A.transpose() print bool(A == A.transpose())

Evaluate

[ 20 120 200]

[120  10 150]

[200 150  30]

True

Skew-symmetric matrix

Skew-symmetric matrix of an matrix is the matrix

.

Matrix whose transpose equals minus the matrix ().

Skew-symmetric matrix of is

Skew-symmetric matrix of is then .

Sage Coding

 A = matrix(3, 3, [0, 1, -3, -1, 0, -2, 3, 2, 0]) print A.transpose() print bool(-A==A.transpose())

Evaluate

[ 0 -1  3]

[ 1  0  2]

[-3 -2  0]

True

Show that if is any matrix, then

(a) is symmetric matrix.

(b) is skew-symmetric matrix.

Solution

(a) .

is symmetric matrix.

(b).

is skew-symmetric matrix.

is an matrix      where is symmetric and is skew-symmetric.

Solution

is symmetric matrix.

is skew-symmetric matrix.

Triangular Matrices

A square matrix the entries either below or above the main diagonal are zero.

Upper triangular Matrices

Upper triangular Matrices are square matrices that can have non-zero entries only on and above the main diagonal, whereas any entry below the diagonal must be zero.

Upper triangular matrix

.

is upper triangular matrix.

Lower triangular Matrices

Lower triangular Matrices are square matrices that can have non-zero entries only on and below the main diagonal, whereas any entry above the diagonal must be zero.

Lower triangular matrix

.

is lower triangular matrix.

Diagonal matrices

These are square matrices that can have non-zero entries only on the main diagonal. Any entry above or below the main diagonal must be zero.

Diagonal matrix is

.

Sage Coding

 G = diagonal_matrix([2, -1])          # generate diagonal matrix H = diagonal_matrix([-3, -2, 1])      # diagonal_matrix([a1, a2, a3]) print G print H

Evaluate

[ 2  0]

[ 0 -1]

[-3  0  0]

[ 0 -2  0]

[ 0  0  1]

Scalar Matrix

If all the diagonal entries of a diagonal matrix are equal, say, , we call a scalar matrix because multiplication of any square matrix of the same size by has the same effect as the multiplication by a scalar, that is,

.

is diagonal matrix.      is scalar matrix.

If is an matrix, the trace of , is defined as the sum of all elements on the main diagonal of , .

Rules for trace are

(a)

(b) , where is a real number.

(c)

(d)

Identity matrix(Unit matrix)

A scalar matrix whose entries on the main diagonal are all is called a Identity matrix (unit matrix) and is denoted by or simply by .

Unit matrix

.

.

, is unit matrix.

Sage Coding

 print identity_matrix(2) print print identity_matrix(3)

Evaluate

[1 0]

[0 1]

[1 0 0]

[0 1 0]

[0 0 1]

[한빛 아카데미] Engineering Mathematics with Sage:

[저자] 이상 구, 김영 록, 박준 현, 김응 기, 이재 화

Contents

A. 공학수학 1 – 선형대수, 상미분방정식+ Lab

Chapter 01 벡터와 선형대수 http://matrix.skku.ac.kr/EM-Sage/E-Math-Chapter-1.html

Chapter 02 미분방정식의 이해 http://matrix.skku.ac.kr/EM-Sage/E-Math-Chapter-2.html

Chapter 03 1계 상미분방정식 http://matrix.skku.ac.kr/EM-Sage/E-Math-Chapter-3.html

Chapter 04 2계 상미분방정식 http://matrix.skku.ac.kr/EM-Sage/E-Math-Chapter-4.html

Chapter 05 고계 상미분방정식 http://matrix.skku.ac.kr/EM-Sage/E-Math-Chapter-5.html

Chapter 06 연립미분방정식, 비선형미분방정식 http://matrix.skku.ac.kr/EM-Sage/E-Math-Chapter-6.html

Chapter 07 상미분방정식의 급수해법, 특수함수 http://matrix.skku.ac.kr/EM-Sage/E-Math-Chapter-7.html

Chapter 08 라플라스 변환 http://matrix.skku.ac.kr/EM-Sage/E-Math-Chapter-8.html

B. 공학수학 2 - 벡터미적분, 복소해석 + Lab

Chapter 09 벡터미분, 기울기, 발산, 회전 http://matrix.skku.ac.kr/EM-Sage/E-Math-Chapter-9.html

Chapter 10 벡터적분, 적분정리 http://matrix.skku.ac.kr/EM-Sage/E-Math-Chapter-10.html

Chapter 11 푸리에 급수, 적분 및 변환 http://matrix.skku.ac.kr/EM-Sage/E-Math-Chapter-11.html

Chapter 12 편미분방정식 http://matrix.skku.ac.kr/EM-Sage/E-Math-Chapter-12.html

Chapter 13 복소수와 복소함수, 복소미분 http://matrix.skku.ac.kr/EM-Sage/E-Math-Chapter-13.html

Chapter 14 복소적분 http://matrix.skku.ac.kr/EM-Sage/E-Math-Chapter-14.html

Chapter 15 급수, 유수 http://matrix.skku.ac.kr/EM-Sage/E-Math-Chapter-15.html

Chapter 16 등각사상 http://matrix.skku.ac.kr/EM-Sage/E-Math-Chapter-16.html

Made by Prof. Sang-Gu LEE  sglee at skku.edu

http://matrix.skku.ac.kr/sglee/   with Dr. Jae Hwa LEE