Math 428: Algorithms and Numerical Solutions of ... rossi/courses/2002_spring/Math428/notes_quaآ  Algorithms

  • View
    0

  • Download
    0

Embed Size (px)

Text of Math 428: Algorithms and Numerical Solutions of ... rossi/courses/2002_spring/Math428/notes_quaآ ...

  • Math 428: Algorithms and Numerical Solutions

    of Differential Equations

    L. F. Rossi

    rossi@math.udel.edu

    University of Delaware

    Math 428 lecture notes - c©2002 - Prof. Louis F Rossi – p.1/30

  • Part 0: Course logistics

    Math 428 lecture notes - c©2002 - Prof. Louis F Rossi – p.2/30

  • Course overview and syllabus

    Description

    Objectives

    Resources

    Grading

    Exams, homework, projects, etc.

    A word on student conduct...

    Math 428 lecture notes - c©2002 - Prof. Louis F Rossi – p.3/30

  • Course overview and syllabus

    Description ... Scientific computation can be studied abstractly, and it can be practiced by professionals to solve problems. This course emphasizes both in equal parts. ...

    Objectives

    Resources

    Grading

    Exams, homework, projects, etc.

    A word on student conduct...

    Math 428 lecture notes - c©2002 - Prof. Louis F Rossi – p.3/30

  • Course overview and syllabus

    Description

    Objectives

    Resources

    Grading

    Exams, homework, projects, etc.

    A word on student conduct...

    Math 428 lecture notes - c©2002 - Prof. Louis F Rossi – p.3/30

  • Course overview and syllabus

    Description

    Objectives

    Resources → Time, textbook, office hours, etc.

    Grading

    Exams, homework, projects, etc.

    A word on student conduct...

    Math 428 lecture notes - c©2002 - Prof. Louis F Rossi – p.3/30

  • Course overview and syllabus

    Description

    Objectives

    Resources

    Grading → Straight scale

    Exams, homework, projects, etc.

    A word on student conduct...

    Math 428 lecture notes - c©2002 - Prof. Louis F Rossi – p.3/30

  • Course overview and syllabus

    Description

    Objectives

    Resources

    Grading

    Exams, homework, projects, etc.

    A word on student conduct...

    Math 428 lecture notes - c©2002 - Prof. Louis F Rossi – p.3/30

  • Course overview and syllabus

    Description

    Objectives

    Resources

    Grading

    Exams, homework, projects, etc.

    A word on student conduct...

    Math 428 lecture notes - c©2002 - Prof. Louis F Rossi – p.3/30

  • Part 1: Essentials

    Math 428 lecture notes - c©2002 - Prof. Louis F Rossi – p.4/30

  • Essentials - Taylor’s theorem (1D)

    Taylor’s theorem is the first (and often best) tool to locally analyze an approximation. (See KC, pp 6-9 for a primer.) Theorem (Taylor): If f ∈ Cn+1([a, b]), then for any points x and x + h in the interval [a, b],

    f(x + h) = n∑

    k=0

    1

    k! f (k)(x)hk +

    1

    (n + 1)! f (n+1)(ξ)hn+1

    where ξ lies between x and x+h. The latter term, called the

    remainder, often corresponds to the error in some approxi-

    mate scheme.

    Math 428 lecture notes - c©2002 - Prof. Louis F Rossi – p.5/30

  • Taylor’s theorem (n-D)

    Theorem (Taylor): If f ∈ Cn+1(D), then for any points ~x = [x1, x2, . . . xm]T and ~x + ~h in a region D ∈ Rm containing the line segment from ~x to ~x + ~h,

    f(~x + ~h) =

    n∑

    k=0

    1

    k!

    |~i|=k

    ∂kf

    ∂xi11 ∂x i2 2 . . . ∂x

    im m

    (~x)hi11 h i2 2 . . . h

    im m +

    1

    (n + 1)!

    |~i|=n+1

    ∂n+1f

    ∂xi11 ∂x i2 2 . . . ∂x

    im m

    (~ξ)hi11 h i2 2 . . . h

    im m

    where ~ξ lies between ~x and ~x + ~h, and~i is a multi-index. Math 428 lecture notes - c©2002 - Prof. Louis F Rossi – p.6/30

  • Taylor’s theorem (n-D)

    D

    x

    x+h

    Math 428 lecture notes - c©2002 - Prof. Louis F Rossi – p.6/30

  • Taylor’s theorem (n-D)

    For example, consider a first order approximation in 3 dimensions.

    f(~x + ~h) =

    f(~x) + ∂f

    ∂x1 (~x)h1 +

    ∂f

    ∂x2 (~x)h2 +

    ∂f

    ∂x3 (~x)h3+

    1

    2

    ∂2f

    ∂x21 (~ξ)h21 +

    1

    2

    ∂2f

    ∂x22 (~ξ)h22 +

    1

    2

    ∂2f

    ∂x23 (~ξ)h23+

    ∂2f

    ∂x1∂x2 (~ξ)h1h2 +

    ∂2f

    ∂x2∂x3 (~ξ)h2h3 +

    ∂2f

    ∂x1∂x3 (~ξ)h1h3

    Math 428 lecture notes - c©2002 - Prof. Louis F Rossi – p.6/30

  • Part 2: Numerical quadrature

    Math 428 lecture notes - c©2002 - Prof. Louis F Rossi – p.7/30

  • A naive look at numerical quadrature

    Suppose we would like to compute the area under the curve of some function f(x) on the interval [a, b]. Remember, midpoint rule from calculus...

    ∫ b

    a

    f(x)dx ≈ N∑

    i=1

    f

    ( xi+1 + xi

    2

    ) h

    x2 x3 x4 x(N+1) = bx1 = a

    Math 428 lecture notes - c©2002 - Prof. Louis F Rossi – p.8/30

  • A naive look at numerical quadrature

    Suppose we would like to compute the area under the curve of some function f(x) on the interval [a, b]. Remember, midpoint rule from calculus...

    ∫ b

    a

    f(x)dx ≈ N∑

    i=1

    f

    ( xi+1 + xi

    2

    ) h

    ∫ b

    a

    f(x)dx = N∑

    i=1

    ∫ xi+1

    xi

    f(x)dx

    Math 428 lecture notes - c©2002 - Prof. Louis F Rossi – p.8/30

  • A naive look at numerical quadrature

    Suppose we would like to compute the area under the curve of some function f(x) on the interval [a, b]. Remember, midpoint rule from calculus...

    ∫ b

    a

    f(x)dx ≈ N∑

    i=1

    f

    ( xi+1 + xi

    2

    ) h

    ∫ b

    a

    f(x)dx = N∑

    i=1

    ∫ xi+1

    xi

    { f

    ( xi+1 + xi

    2

    ) +

    f ′ (

    xi+1 + xi 2

    ) ( x −

    xi+1 + xi 2

    ) +

    1

    2 f ′′(ξi)

    ( x −

    xi+1 + xi 2

    )2} dx

    Note: ξi depends upon x, the variable of integration.Math 428 lecture notes - c©2002 - Prof. Louis F Rossi – p.8/30

  • A naive look at numerical quadrature

    Suppose we would like to compute the area under the curve of some function f(x) on the interval [a, b]. Remember, midpoint rule from calculus...

    ∫ b

    a

    f(x)dx ≈ N∑

    i=1

    f

    ( xi+1 + xi

    2

    ) h

    ∫ b

    a

    f(x)dx = N∑

    i=1

    ∫ xi+1

    xi

    { f

    ( xi+1 + xi

    2

    ) +

    f ′ (

    xi+1 + xi 2

    ) ( x −

    xi+1 + xi 2

    ) +

    1

    2 f ′′(ξi)

    ( x −

    xi+1 + xi 2

    )2} dx

    Note: ξi depends upon x, the variable of integration.Math 428 lecture notes - c©2002 - Prof. Louis F Rossi – p.8/30

  • A naive look at numerical quadrature

    Suppose we would like to compute the area under the curve of some function f(x) on the interval [a, b]. Remember, midpoint rule from calculus... Let’s remember why that red term is zero. This will be a very common theme in this course.

    ∫ xi+1

    xi

    f ′ (

    xi+1 + xi 2

    ) ( x −

    xi+1 + xi 2

    ) dx =

    f ′ (

    xi+1 + xi 2

    ) ∫ xi+1

    xi

    ( x −

    xi+1 + xi 2

    ) dx =

    f ′ (

    xi+1 + xi 2

    ) · 0 = 0

    � � � � � � � � � � � �

    � � � � � � � � � � � �

    � � � � � � � � � � � �

    � � � � � � � � � � � �

    � � � � � � � � � � � �

    � � � � � � � � � � � �

    � � � � � � � � � � � �

    � � � � � � � � � � � �

    � � � � � � � � � � � �

    � � � � � � � � � � � �

    � � � � � � � � � � � �

    � � � � � � � � � � � �

    � � � � � � � � � � � �

    � � � � � � � � � � � �

    � � � � � � � � � � � �

    � � � � � � � � � � � �

    � � � � � � � � � � � �

    � � � � � � � � � � � �

    � � � � � � � � � � � �

    � � � � � � � � � � � �

    � � � � � � � � � � � �

    � � � � � � � � � � � �

    � � � � � � � � � � � �

    � � � � � � � � � � � �

    x(i) x(i+1) x(i+1/2)

    Math 428 lecture notes - c©2002 - Prof. Louis F Rossi – p.8/30

  • A naive look at numerical quadrature

    Suppose we would like to compute the area under the curve of some function f(x) on the interval [a, b]. Remember, midpoint rule from calculus... And, this is true for any odd function of a symmetric interval.

    For instance... ∫ xi+1

    xi

    ( x −

    xi+1 + xi 2

    )3 dx = 0

    � � � � � � � � � � �

    � � � � � � � � � � �

    � � � � � � � �