esc103 course notes (2012)

Upload: chongwang2778

Post on 03-Apr-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 ESC103 Course Notes (2012)

    1/27

    Given L and V, can we solve the inverse problem? Is there always a solution to this problem? Yes, no

    shit.

    Given L and V, find u where v = L(u)

    Let M be the matrix associated with L, so Mu = v

    Can we find N such that NM=I?

    Mu= v

    NMu = Nv

    Iu = Nv

    U = Nv

    So we are looking for N (inverse of M) that satisfies NM = I

    Example:

    2x2 matrix

    M = (given)

    N =

    (unknown)Multiply NM=

    ae + fc = 1

    eb + fd = 0

    ag + hc = 0

    gb + hd = 1

    Therefore, after manipulations:

    Therefore, N =

    Therefore, we do have a solution for N if ad-bc As such, some matrices do not have an inverse.

    example:

    if given a projection, can we identify

    a vector uniquely that would have that

    projection?

    No.

    For projection:

    BUT the determinant of this matrix = 0

    Therefore, there is no solution to this.

    not unique

    Determinant

    projection on x-axis

    review projections

    Inverse and DeterminantOctober-10-12

    1:09 PM

    Anamjit Sivia Page 1

  • 7/29/2019 ESC103 Course Notes (2012)

    2/27

    For the matrix M = the quantity ad-bc is called the determinant of Matrix M.

    Denoted as:

    (not absolute value)

    Anamjit Sivia Page 2

  • 7/29/2019 ESC103 Course Notes (2012)

    3/27

    Arise frequently when modelling a wide range of engineering systems

    e.g. electric circuits

    Modelling: the art of writing a mathematical description of a system being analyzed

    Model consisting one equation and 3 unknowns:

    Continued in next section.

    Unit 11: System of Linear EquationsOctober-10-12

    1:45 PM

    Anamjit Sivia Page 3

  • 7/29/2019 ESC103 Course Notes (2012)

    4/27

    RECALL:

    We can write the solution to AX=B by starting at a single solution (particular solution) and then moving along the

    homogeneous solution (plural).

    The key is that we have been able to express each leading variable in terms of the free variables.

    AX = B

    If A = M = M =

    A matrix is in RNF if:

    The first non-zero entry in each row is A1.a.

    The other entries in the columns containing these leading 1's are zero.b.

    The leading 1's move to the right as we move down the rows.c.

    Any zero rows are collected at the bottom.d.

    Example:

    infinite number of solutions

    So, if M is already in RNF, it is easy to simply write down the solution to AX = B.

    If not, then we are going to perform operations on M to put it in reduced normal form (M'), where M' corresponds to an

    equivalent linear system with the same solution as M.

    Elementary Operations- Gaussian Elimination

    Interchange two equations (i.e. two rows of the augmented matrix)1.

    Multiply one equation (row) by a non-zero constant.2.

    Add a multiple of one equation to another equation (row).3.

    (augmented matrix)

    An electrical circuit can be described in terms of a mathematical model.

    Unit 12: Reduced Normal Form (RNF)October-17-12

    1:06 PM

    Anamjit Sivia Page 4

  • 7/29/2019 ESC103 Course Notes (2012)

    5/27

    (augmented matrix)

    Housekeeping:

    Multiply row 1 by -11.

    Subtract 1 from 2.2.

    Subtract 1 from 63.

    Multiply 2 by -14.

    Row 3 - row 25.

    Row 5 - row 26.

    And so on7.

    sivia at 18/10/2012 12:10 PM

    Summary:

    Unique solution (occurs when every variable in RNF is a leading variable i.e. free variable)a.

    Infinite solutions (occurs when there is at least one free variable)b.

    Consistent Systems:1.

    Inconsistent Systems: No solution (occurs when a contradiction is seen in the matrix)2.

    There are three possible outcomes for a linear system:

    Matrix Ranks

    One unique solution:

    Anamjit Sivia Page 5

  • 7/29/2019 ESC103 Course Notes (2012)

    6/27

    It turns out that the RNF of a matrix is a unique.

    The number of leading 1's in the RNF of the matrix A is called theRANK of A.

    r = rank(A)

    In terms of solutions to AX = B with m equations and n variables, if the rank is r, the number of

    free variables is (n -r)

    r = number of leading variables

    (n-r) = number of free variables

    n = total number of variables

    Anamjit Sivia Page 6

  • 7/29/2019 ESC103 Course Notes (2012)

    7/27

    Can you solve:

    2x1 + 3x2 - 4x3 = 1

    We are looking for all values

    Declare x1 to be a basic variable and x2 and x3 as free

    variables

    2x1 = 1-3x2 + 4x3

    + x2 +x3

    Example:

    x + y + 3w = 2

    z - 2w = 1

    two equations with four unknowns

    Are there values of x, y, z and w that satisfy both equations?

    x and z are leading (basic)

    w and y are free variables. (can be freely assigned)

    x = 2 - y - 3w

    z = 1 + 2w

    xy

    z =

    w

    20

    1 y[

    0

    -11

    0 ] z

    0

    -30

    2

    1

    Not a unique solution.

    System of Linear EquationsOctober-11-12

    12:18 PM

    Anamjit Sivia Page 7

  • 7/29/2019 ESC103 Course Notes (2012)

    8/27

    Balance the following equation:

    Converting to RNF using Gaussian elimination:

    There exists one free variable (

    There are an infinite number of solution to this system.

    x=0 is always a solution to homogeneous systems and is called the trivial solution.-

    Unique solution

    Infinite solutions (including trivial solution)

    Therefore, only two possibilities exist for homogeneous systems:-

    In general, homogeneous systems (AX=0):

    Not correct

    Unit 13: Homogeneous SystemsOctober-18-12

    12:50 PM

    Anamjit Sivia Page 8

  • 7/29/2019 ESC103 Course Notes (2012)

    9/27

    Limit to square systems-

    AX = B as a starting point. The inverse of A will be denoted as

    . It will be shown that this is

    a unique matrix.

    -

    Assume that AX = B, where A is a square matrix and has a unique solution.-

    This means the RNF of [A|B] must be of the form [I|C]-

    So we are looking for a matrix (D) such that-Formal Definition of a Matrix Inverse:

    D is called an inverse of A if we can find D such that AD = I and DA = I.-

    Let's say D and E are both inverses of A

    Therefore, DA = I = AE (= AD = EA)

    D = DI = D(AE) = (DA)E = IE = E

    Hence, there is only one inverse to a matrix. It is denoted as

    Can A have more than one inverse?-

    Going back to use of elementary operations to obtain a matrix in RNF-

    Interchange two rows:

    Referred to as apermutation matrix

    Multiply one row by a non zero scalar

    Referred to as a diagonal matrix.

    Add a multiple of one row to another row

    Referred to as a shear matrix.

    Therefore, we can conclude that there is a sequence of elementary matrices such that:

    Elementary matrices: We can associate matrices with the three elementary operations.

    Unit 14: Matrix InversesOctober-24-12

    1:32 PM

    Anamjit Sivia Page 9

  • 7/29/2019 ESC103 Course Notes (2012)

    10/27

    Algorithm to Find A:

    Note: this is an augmented matrix where A is a matrix and I is the identity matrix in the same

    dimension.

    For example, if A is 4x4, I is also 4x4

    Perform Gaussian Elimination on M to bring it to RNF.-

    Changes to: Therefore:

    Every elementary matrix is itself invertible and is also an elementary matrixcorresponding to the inverse of the row operation that produced .REVIEW:

    Every elementary matrix E is invertible and is also an elementary matrix corresponding tothe inverse of the row operation that produced E.

    sivia at 31/10/2012 1:24 PM

    Two Important properties:

    We will make use of the formal definition of an inverse to prove this property.

    Proof: Take as a candidate inverse for Therefore, is the inverse of

    Property 1: If A and B are both invertible matrices and of the same size, so is AB invertible and

    the inverse of -

    Proof: Take A as a candidate inverse of (from the inversion of A, then A is the inverse of

    Property 2: If A is invertible, so is and -

    -Using property 2:

    Using property 1:

    Anamjit Sivia Page 10

  • 7/29/2019 ESC103 Course Notes (2012)

    11/27

    Therefore, every invertible matrix can be expressed as a product of elementary matrices.

    This is a significant result, don't know why.

    Anamjit Sivia Page 11

  • 7/29/2019 ESC103 Course Notes (2012)

    12/27

    Curve Fitting: Take a set of points and fit a function to those points.

    Interpolation: Takes a curve fit and constructs new, related data points on the curve

    Extrapolation: Take a curve, extend the graph to generate new data points i.e. new data point

    outside the original data interval

    Unit 16: Curve FittingNovember-07-12

    1:51 PM

    Anamjit Sivia Page 12

  • 7/29/2019 ESC103 Course Notes (2012)

    13/27

    We are dealing with the class of AX = B problems where there is no solution.

    (where We begin by defining an error vector.

    Sizes: A m x n, X n x 1, B m x 1

    There is no solution to this problem.

    Let's extend the notion of magnitude of an or vector to If we choose X to minimize ||E||, this is the same X that minimizes the

    Another way to write matrix multiplication

    This gives us a geometric way of thinking about the consistency of AX = B, namely AX=B is consistent

    if and only if B can be expressed as a linear combination of the column vectors of A. (or B is in the

    column space of A)

    Let's define as the column space of A. Therefore, as varies over will vary over the entirecolumn space The least squares problem arisen when vector B does not lie in the column spaceN.

    Solving this problem amounts to finding such that is the closest vector in W to B. We can thinkof this as solving for: It then follows that is orthogonal to Therefore, is orthogonal to every columnvector of A. These equations are referred to as the normal equations.

    Define This is called the Least Squares Solution (Assuming that exists)Numerical Example:

    We have

    (independent variables) and

    is a dependent variable

    Y1 0 1 10 1 2 0

    Unit 17: The Least Squares ProblemNovember-08-12

    12:34 PM

    Anamjit Sivia Page 13

  • 7/29/2019 ESC103 Course Notes (2012)

    14/27

    1 -1 -1 0

    2 0 0 1

    Find a solution to AX = B where Augmented Matrix:

    Therefore, no solution.

    But, we will not give up. We are EngScis. Why don't we try a least squares solution?

    Normal System:

    Now:

    Therefore, i.e. Least Squares SolutionFind AX that is closest to B.

    Find the distance from AX to B.

    AX closest to B:

    B = Distance from AX to B

    AX - B =

    Anamjit Sivia Page 14

  • 7/29/2019 ESC103 Course Notes (2012)

    15/27

    Anamjit Sivia Page 15

  • 7/29/2019 ESC103 Course Notes (2012)

    16/27

    This is the application section of ESC103. fucking awesome.

    The Fundamental Theorem of Calculus:This theorem sates that: Where f(x) is a continuous function and F is a function such that This cannot be used when f(x) is not defined or cannot be found. We will use numerical integration

    in such cases. We will approximate: By partitioning the interval [a,b] into n evenly spaced subintervals.

    1 1 1 1 1 Step size 3 RECTANGULAR APPROXIMATIONS:

    Left hand limit, Right hand limit, average

    TRAPEZOIDAL APPROXIMATION:

    Unit 18: Numerical IntegrationOctober-31-12

    1:37 PM

    Anamjit Sivia Page 16

  • 7/29/2019 ESC103 Course Notes (2012)

    17/27

    Another approach rather than using simple rectangles to approximate area:

    Consider fitting a polynomial P(x) through the discrete values such that P(x) is approximately f(x)

    Where We can use the 2-point Newton Cotes rule to fit a polynomial of degree 1 (line) but this is just a

    trapezoid.

    Now, lets use the 3- point Newton Cotes rule to fit a polynomial of degree 2 to each triplet of points:

    Find [a,b,c] in P(x) =

    Such that: Because 'area' is unaffected by horizontal position, we will use instead solve the simpler problem

    This is a linear system of equations.

    AX = B

    Therefore, and so onB =

    Unit 19: Simpson's RuleNovember-01-12

    12:51 PM

    Anamjit Sivia Page 17

  • 7/29/2019 ESC103 Course Notes (2012)

    18/27

    Therefore, the estimate of the total area:

    Where n is an even number:As such: This is known as Simpson's Rule

    Anamjit Sivia Page 18

  • 7/29/2019 ESC103 Course Notes (2012)

    19/27

    Errors pervade all areas of Science. Therefore, it is important to understand, quantify and control

    them.

    Derivation of Error Bounds

    Recall, that if we use Simpson's rule to get a quadratic for three collinear points parallel to the x-axis,

    b and c would be zero. Similarly, if it is any straight line, we would have c=0.

    We use the Taylor Series expansion to derive these.

    Trapezoid Rule:

    The slope of the function does not affect the function much; rather, it is the second derivative that

    gives us an estimate of the error we can expect. (e.g. slope may change faster and yield a greater

    error in a given function)

    Example:

    Given:

    Evaluate: Since 1 then Therefore, K = 2.

    Take n =5. Therefore, This is an estimate on the upper bound of the error. In order to adjust this, we can increase n.

    Therefore,will get smaller.

    Actual Error: Calculate

    Unit 20: Errors in Numerical IntegrationNovember-07-12

    1:07 PM

    Anamjit Sivia Page 19

  • 7/29/2019 ESC103 Course Notes (2012)

    20/27

    Simpson's Rule:

    The order of the integration method is the first integer m such that the method does not compute exactly.

    Simpson's Rule: Fourth Order

    For example, in the Trapezoid Rule: Second Order

    Curve Fitting

    Sometimes we need to fit data where the data points do not follow a linear/ quadratic/ perfect

    solution Use gaussian elimination to obtain a =2, b = -3, c = 1

    What if we had tried to fit a straight line rather than a quadratic?

    We obtain no solution. Through gaussian elimination.

    Transpose

    If A is an m x n matrix, the transpose (

    is the n x m matrix, where the rows of a transpose are the

    columns ofA written in the same order.

    Example: and 1. 2. 3. 4.IfA is invertible, so is its transpose and 5.

    Properties:

    Proof of property 5: exists by assumption. Similarly, for the other case for non-commutative multiplication.

    Anamjit Sivia Page 20

  • 7/29/2019 ESC103 Course Notes (2012)

    21/27

    We haven't yet done any fucking differential equations but we still do this shit.

    Circuit Example:

    (Ohm's Law)A change in resistance represents an instant change in voltage. This is a static system.Spring Example: (Newton's Law)A mass is attached to a spring, on a frictionless surface. The spring does not instantaneously change

    its position when it is stretched or compressed; it oscillates.. This is a dynamic system.

    In terms of derivatives:

    We are trying to solve for

    , a function.

    Initial Value ProblemsExample:

    A system is described by Find .Propose that where A is a constant.(t) only becomes unique with an initial value.Say, Therefore, What if ?In this case, numerical methods may have to be used as it is not intuitive to guess a function thatfulfills the conditions.Euler's MethodWe are going to make use of the fact the derivative is always known. Start at Use of slope at this point . Lets take a step, .

    Algorithm (Euler's Method) Where gives appropriate values to S is our slope estimate(L- left and R- right). Consider

    Unit 21: Numerically Solving Differential EquationsNovember-15-12

    12:24 PM

    Anamjit Sivia Page 21

  • 7/29/2019 ESC103 Course Notes (2012)

    22/27

    The Euler's Method is a numerical approach to solving first order IVP's that makes use of derivative

    information.

    Given: Start at and move forward in time by using the 'slope' to estimate the change in y.Algorithm: ----> slopeWhere are approximate values of

    The formula for going from to , is not exact.1. The information going into the formula is not exact.2.Sources of Error:

    How may we improve on the formula? Consider

    : slope estimate at : slope estimate at

    Q: What do we use for A: Replace by the estimate obtained using Euler's Method Summary of Algorithm:

    Unit 22: Euler's MethodNovember-21-12

    1:07 PM

    Anamjit Sivia Page 22

  • 7/29/2019 ESC103 Course Notes (2012)

    23/27

    (a second order system)Introducing vector notation: Therefore, F transforms to Example:

    Given that is a solution to this problem since and -Solve for .

    We will solve for both y and y'.

    The system equation enters here

    Euler's Method:

    OR

    These types of equations are called difference equations. These equations allow us to solve for y at different times.

    For example, if we choose

    Improved Euler's Method:

    Choose

    Unit 23: Higher Order SystemsNovember-21-12

    1:28 PM

    Anamjit Sivia Page 23

  • 7/29/2019 ESC103 Course Notes (2012)

    24/27

    Recap:

    Euler's Method, improved Euler's method-

    In a class of predictor-corrector methods (Runge-Kutta)-

    Numerical solutions to differential equations (Initial Value Problems)

    A general approach to representing higher order systems.

    For example, consider two springs attached together.

    Let be the compression of the spring with and similarly Equations of motion describing this system: Let's introduce two new variables:

    This representation is referred to as the STATE-SPACE DESCRIPTION.

    Anamjit Sivia Page 24

  • 7/29/2019 ESC103 Course Notes (2012)

    25/27

    Suppose we want to solve an equation of the following form:

    on the interval [0,1], with the boundary conditions

    This is distinct from the previous chapter as we are given an endpoint, and two points on y but nothing about thederivative of y.

    Looking at the beam example:

    The function Represents the vertical displacement of the beam Young's Modulus and I = the second moment of area = linear load densityIf the beam is hinged at 0 and free at x = L, the Boundary Conditions are: As with numerical integration, we are going to partition the interval into evenly spaced sub-intervals.1 1 1 1 1

    A = [a,b]We will simultaneously estimate the solution at the grid points where are approximate values of We will approximate the derivatives in the differential equation using finite differences keeping in mind that: Different differences may be used:

    Forward difference denotes the 'forward difference'Backward difference Central Difference:

    Second derivatives can be difined:

    x = 0 X = L

    Unit 24: Boundary Value Problems (BVP)November-22-12

    12:28 PM

    Anamjit Sivia Page 25

  • 7/29/2019 ESC103 Course Notes (2012)

    26/27

    for and for This is now an algebraic equation in terms of the unknown values of y. This can be further simplified:

    This equation can be easily solved. LOL

    Next, approximate the derivatives using finite differences.

    For this example:

    Next, substitute finite differences into the differential equation: Let's choose n = 5 We want to now simultaneously estimate

    at the grid points using the given boundary conditions.

    Substitute Now, let's write this equation at each interior grid point. Keep in mind boundary conditions.

    Anamjit Sivia Page 26

  • 7/29/2019 ESC103 Course Notes (2012)

    27/27

    Use Gaussian elimination to solve this system.

    For this problem, there is an exact solution. Actual Values: We can change the grid point (n) to increase the accuracy which increases the accuracy of finite differences. Theseresults are approximate to two decimal places. However, doing so would involve solving a larger matrix.