Top Banner
CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department of Computer Science & Engineering http://www.engr.uconn.edu/~jinbo 1
32

Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

Sep 07, 2018

Download

Documents

lekiet
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

CSE 3802 / ECE 3431Numerical Methods in Scientific

Computation

Jinbo BiDepartment of Computer Science & Engineering

http://www.engr.uconn.edu/~jinbo

1

Page 2: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

The Instructor• Ph.D in Mathematics• Previous professional experience:

– Siemens Medical Solutions Inc.– Department of Defense, Bioanalysis– Massachusetts General Hospital

• Research interests: biomedical informatics, machine learning, data mining, optimization, mathematical programming,

• Apply machine learning techniques in medical image analysis, patient health records analysis

• Resume is at http://www.engr.uconn.edu/~jinbo2

Page 3: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

Numerical Methods, Fall 2011 Lecture 1 3

• Lectures are Tuesday and Thursday, 9:30 –10:45 am

• No specific lab time, but significantcomputer time expected.

• Computers are available in ITEB C25 and C27.

Class Meetings

Prof. Jinbo Bi CSE, UConn

Page 4: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

4

• Homework will be assigned once every week or two and due usually the following week.

• You may collaborate on the homework, but your submissions should be your own work.

• Grading:• Homework 30%• Exam 1 and 2 40%• Final Exam 30%

Class Assignments

Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 5: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

5

• MATH 2110Q Multivariate Calculus• Taylor series• MATH 2410Q Introduction to Differential

Equations • Integration• Linear Algebra

Mathematical Background

Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 6: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

6

• Languages to be used:• Matlab, C, C++

• CSE 1100/1010 programming experience

• Any OS is acceptable

Computer Background

Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 7: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

7

• Go over the course syllabus• Course websitehttp://www.engr.uconn.edu/~jinbo/Fall2011_

Numerical_Methods.htm

Syllabus

Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 8: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

8

Today’s Class:• Introduction to numerical methods• Basic content of course and class

expectations• Mathematical modeling

Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 9: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

9

Introduction• What are numerical methods?

• “… techniques by which mathematical problems are formulated so that they can be solved with arithmetic operations.” (Chopra and Canale)

• What type of mathematical problems?• Roots, Integration, Optimization, Curve

Fitting, Differential Equations, and Linear Systems

Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 10: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

Introduction• How do you solve these difficult

mathematical problems?• Example: What are the roots of x2-

7x+12?• Three general non-computer methods

• Analytical• Graphical• Manual

10Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 11: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

• This is what you learned in math class• Gives exact solutions• Example:

• Roots at 3 and 4• Not always possible for all problems and

usually restricted to simple problems with few variables or axes

• The real world is more complex than the simple problems in math class

Analytical Solutions

)4)(3(1272 −−=+− xxxx

11Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 12: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

Graphical Solution

12Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 13: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

• Using pen and paper, slide rules, etc. to solve an engineering problem

• Very time consuming• Error-prone

Manual Solution

13Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 14: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

Numerical Methods• What are numerical methods?

• “… techniques by which mathematical problems are formulated so that they can be solved with arithmetic operations.” (Chopra and Canale)

• Arithmetic operations map into computer arithmetic instructions

• Numerical methods allow us to formulate mathematical problems so they can be solved numerically (e.g., by computer)

14Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 15: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

• What is this course about?• Using numerical methods to solve

mathematical problems that arise in engineering

• Most of the focus will be on engineering problems

Course Overview

15Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 16: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

• Introduction• Programming• Mathematical Modeling• Error Analysis

• Mathematical Problems• Roots, Integration, Optimization, Curve

Fitting, Differential Equations, and Linear Systems

Basic Materials

16Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 17: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

A mathematical model is the formulation of a physical or engineering system in mathematical terms.

• Empirical• Theoretical

Mathematical Modeling

17Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 18: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

• Dependent variable = f ( independent variables, parameters, forcing functions )

• In an electrical circuit, I = V/R; The current, I, is dependent on resistance parameter, R, and forcing voltage function, V.

Mathematical Modeling

18Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 19: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

• What is the velocity of a falling object?• First step is to model the system• Newton’s second law

• Total force is gravity and air resistance

Example 1

mF

dtdv

mFamaF =⇒=⇒=

cvmgFFF AirGravity −=+=

19Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 20: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

• First order differential equation• Analytical solution

Example 1

vmcg

mcvmg

mF

dtdv

−=−

==

)1()( tmc

ec

gmtv −=

20Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 21: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

• m=68.1kg, c=12.5 kg/s

Example 1

21Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 22: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

• What if we can’t find an analytical solution?

• How do you get a computer to solve the differential equation?

• Use numerical methods

Example 1

22Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 23: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

• Use the finite divided difference approximation of the derivative

• The approximation becomes exact as Δt → 0

Euler’s Method

ii

ii

tttvtv

dtdv

−−

=+

+

1

1 )()(

23Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 24: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

• Using Euler’s method, we can approximate the velocity curve

Euler’s Method

)()()(

1

1i

ii

ii tvmcg

tttvtv

dtdv

−=−−

=+

+

−−+= ++ )()()()( 11 iiiii tv

mcgtttvtv

24Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 25: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

• Assume Δt=2

Euler’s Method

0)0( =v

6.19)0(2)0()2( =

−+= v

mcgvv

0.32)2(2)2()4( =

−+= v

mcgvv

……

25Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 26: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

Euler’s method

26Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 27: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

• Avoids solving differential equation• Not an exact approximation of the

function• Gets more exact as Δt→0• How do we choose Δt? Dependent on

the tolerance of error.• How do we estimate the error?

Euler’s Method

27Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 28: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

Example 2• Find i(t)

resistor

capacitorVolt supply

switch

28Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 29: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

Example 2

• Analytical solution

)()( tvtRiV c+=

dtdvCti c=)(

))((1 tvVRCdt

dvc

c −=

−= RC

t

c eVtv 1)(

RCt

c eRV

dtdvCti

−==)(

29Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 30: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

Example 2• Numerical solution

)()( tvtRiV c+=

dtdv

dtdiR c+=0

Cti

dtdiR )(0 +=

)(1 tiRCdt

di−=

30Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 31: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

Example 2

• Initial value of i(t)=V/R

jj

jjj tt

tititi

RCdtdi

−−

=−=+

+

1

1 )()()(1

RCti

tttiti jjjjj

)()()()( 11 −−= ++

RVi =)0(

−=−=

RCRV

RCiii 21)0(2)0()2(

…..

31Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn

Page 32: Numerical Methods in Scientific Computation - …jinbo/courses/NumericalMethods_Fall2011/jb... · CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation Jinbo Bi Department

Next class• Programming and Software• Read Chapters 1 & 2

32Numerical Methods, Fall 2011 Lecture 1

Prof. Jinbo Bi CSE, UConn