Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)

Slides:



Advertisements
Similar presentations
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
Advertisements

Arc-length computation and arc-length parameterization
3- 1 Chapter 3 Introduction to Numerical Methods Second-order polynomial equation: analytical solution (closed-form solution): For many types of problems,
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
SEQUENCES and INFINITE SERIES
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
Asymptotic error expansion Example 1: Numerical differentiation –Truncation error via Taylor expansion.
Today’s class Romberg integration Gauss quadrature Numerical Methods
Error Measurement and Iterative Methods
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
Infinite Sequences and Series
CSC401 – Analysis of Algorithms Lecture Notes 1 Introduction
Chapter 4 Roots of Equations
Function Optimization Newton’s Method. Conjugate Gradients
Lecture #18 EEE 574 Dr. Dan Tylavsky Nonlinear Problem Solvers.
Analysis of Algorithms Algorithm Input Output. Analysis of Algorithms2 Outline and Reading Running time (§1.1) Pseudo-code (§1.1) Counting primitive operations.
Analysis of Algorithms1 Estimate the running time Estimate the memory space required. Time and space depend on the input size.
Evaluating Hypotheses
16/27/ :53 PM6/27/ :53 PM6/27/ :53 PMLogic Control Structures Arithmetic Expressions Used to do arithmetic. Operations consist of +,
Discrete Mathematics Recursion and Sequences
Dr. Marco A. Arocha Aug,  “Roots” problems occur when some function f can be written in terms of one or more dependent variables x, where the.
Lecture Notes Dr. Rakhmad Arief Siregar Universiti Malaysia Perlis
Chapter 3 Root Finding.
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
Fundamentals of Python: From First Programs Through Data Structures
MATH 175: NUMERICAL ANALYSIS II Lecturer: Jomar Fajardo Rabajante IMSP, UPLB 2 nd Semester AY
Standard Error and Research Methods
Analysis of Performance
Scientific Computing Algorithm Convergence and Root Finding Methods.
Chapter 5 Algorithm Analysis 1CSCI 3333 Data Structures.
Ch 8.1 Numerical Methods: The Euler or Tangent Line Method
Integrals 5.
Fundamentals of Python: First Programs
Chapter 6 Finding the Roots of Equations
Numerical Methods Applications of Loops: The power of MATLAB Mathematics + Coding 1.
Analysis of Algorithms
Guillaume De l'Hôpital Actually, L’Hôpital’s Rule was developed by his teacher Johann Bernoulli. De L’Hôpital paid Bernoulli for private lessons,
Module 1: Statistical Issues in Micro simulation Paul Sousa.
1 Analysis of Algorithms CS 105 Introduction to Data Structures and Algorithms.
MECN 3500 Inter - Bayamon Lecture 3 Numerical Methods for Engineering MECN 3500 Professor: Dr. Omar E. Meza Castillo
Program Efficiency & Complexity Analysis. Algorithm Review An algorithm is a definite procedure for solving a problem in finite number of steps Algorithm.
Definition of Terms Software/Programs Programs that directs the operation of a computer system Set of instructions Codes Programming Process of planning,
Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine.
Quadrature rules 1Michael Sokolov / Numerical Methods for Chemical Engineers / Numerical Quadrature Michael Sokolov ETH Zurich, Institut für Chemie- und.
Numerical Methods.
Sequences Lesson 8.1. Definition A __________________ of numbers Listed according to a given ___________________ Typically written as a 1, a 2, … a n.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 3.
Program Design. The design process How do you go about writing a program? –It’s like many other things in life Understand the problem to be solved Develop.
4 Numerical Methods Root Finding Secant Method Modified Secant
Numerical Methods Solution of Equation.
Analysis of algorithms. What are we going to learn? Need to say that some algorithms are “better” than others Criteria for evaluation Structure of programs.
4 Numerical Methods Root Finding Secant Method Modified Secant
Root Finding UC Berkeley Fall 2004, E77 Copyright 2005, Andy Packard. This work is licensed under the Creative.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
CIE Centre A-level Further Pure Maths
Chapter 3 Chapter Summary  Algorithms o Example Algorithms searching for an element in a list sorting a list so its elements are in some prescribed.
NUMERICAL ANALYSIS I. Introduction Numerical analysis is concerned with the process by which mathematical problems are solved by the operations.
Algorithms and Programming
Numerical Methods Some example applications in C++
Analysis of Algorithms
COP 3503 FALL 2012 Shayan Javed Lecture 15
ALGORITHMS AND FLOWCHARTS
Class Notes 18: Numerical Methods (1/2)
Introduction to Data Structures
SOLUTION OF NONLINEAR EQUATIONS
Analysis of Algorithms
1 Newton’s Method.
EE, NCKU Tien-Hao Chang (Darby Chang)
Presentation transcript:

Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)

Summary 2 2 exams, some exercises

Target 3 Solve problems with numerical methods

In this slide Why numerical methods? –differences between human and computer –a very simple numerical method What is algorithm? –definition and components –three problems and three algorithms Convergence –compare rate of convergence 4

Why such methods? 5 Computer is stupid

x-2=0 6 Human says, “ x=2, easy!”

{ x-2=0; } 7 Computer says, “compile error!”

What is the difference? 8

9 Human is logical (thinking)

10 Can do inference ©

11 Computer is procedural (executing)

An example (((x+3)-2)+6)=0 –Human requires only the rules (in this case, arithmetic), –and can inference the steps for the solution 12

Computer (((x+3)-2)+6)=0 –Requires exact procedure (steps) { x0=0–6; } { x1=x0+2; } { x=x1–3; } –These steps is numerical method 13

14 Does computer have any advantage?

15 It is fast

So, why numerical methods? Computer is stupid Computer is fast (and works hard) Sometimes, stupid methods can solve difficult problems 16

17

18

19 t d is the time of death, which cannot be solved explicitly

We know that 20 t d is no earlier than PM 7:15, and t d is no later than PM 8:00. So…

t d could be PM 7:38 21 rubbish =.=

A systematic procedure 1. Let t d as PM 7:38 2. Evaluate the above formula 3. If the result exceeds 98.6, we use PM 7:27, otherwise, we use PM 7:49 instead 4. Repeat step 2 & 3 until the result is close to 98.6 enough 22

Bisection method 23

Bisection method The concept is –1) find the mid-point, 2) evaluate it, and 3) shrink the solution range It is stupid: just trial and error But it works, because t d is ascending And… 24

And very accurate 25 Actually, it is getting accurate after every trial

When #trails → ∞ 26 Computer works hard, so it could happen

Any Questions? 27

Algorithm 28 The heart of numerical analysis

Algorithm Definition –A precisely defined sequence of steps In this course –design; –implement; and –examine the performance 29

30 How to implement?

By hand 31 too painful (but you might need to)

With computer 32 in other words, do programming

Programming 33 Even scared!

34 Algorithm could be simple

An example from statistics Mean and standard deviation on n values 35

36

In action 37 input is { 1, 2, 3, 4, 5 }

38

It is also an algorithm 39 (a precisely defined sequence of steps)

Not 40 A difficult sequence of steps

Any Questions? 41

Another example 42 Definite integral using trapezoidal rule

43 A partition a = x 0 < x 1 < x 2 < … < x n-1 < x n = b

44 where x i = a + i h, and h = ( b – a ) / n

45

In action 46 f(x) = 1 / x, n = 4

47

Error The analytic solution is ln2 The absolute error is 48

49

Observations of the errors |e n |, the absolute error, is a decreasing function of n When n is doubled, |e n | is reduced by a factor (roughly 1/4) From the numerical evidence where c is independent of n 50

Any Questions? 51

The third example Square root – a is a nonnegative real number – x n+1 converges to sqrt(a) 52

53

Stopping condition |x n+1 – sqrt(a)| <ε – |x n+1 – x n | <ε provides an estimate Prevent infinite loop –give a limit of the number of iterations 54

In action 55 sqrt(2), i.e., a=2 x 0 = 2, ε = 0.005, Nmax = 10

56

So far 57 a statistics problem, the integral problem, and the square root problem

Any Questions? 58

59 What is the differences among them? (hint: the concepts of the output)

Type of methods The statistics algorithm –generates an exact (analytic) solution The integral algorithm –generates an approximate (numerical) solution –many numerical methods work in much the same way The square root algorithm –generates a sequence of approximations which converge to the solution –another typical class of numerical methods 60

Poll 61 Programming ability

Learnt 62 C/C++ (??/23) Java (??/23) Other (??/23)

Learnt 63 Data structure (??/23) Algorithm (??/23)

Language vs. algorithm Two languages –The same concept, different patterns –e.g., Chinese and English – 想睡覺, feel sleepy English vs. C –Increase i by 1 –{ ++i; } Language is/defines the pattern Algorithm is/describes the concept 64

Pseudo-code 65 Not any real programming language

A pseudo-code example 66

Can You 67 Read/write pseudo-code?

Convergence 68 When several numerical methods are available, choose the fastest one

69 The sequence {x n } converges to the value L, and L is called the limit of the sequence

Rate of convergence Let {p n } converges to p, {β n } converges to 0, λ is a constant, and Rate of convergence of {p n } is O(β n ) O(β n ) is typically of the form – 1/n a – 1/a n 70

71

72

73

74

Any Questions? 75

Which Is Better? 76 O(1/n 2 ), O(1/n 10 ), or O(1/2 n )

Using L'Hôpital's rule This is provided by a student 陳攀任 In its simplest form, l'Hôpital's rule states that for functions ƒ and g : To compare n 10 and 2 n 77

78

Rate of Convergence 79 There is another definition for function

Another definition of rate of convergence for function 80

81

Rate of convergence Let {p n } converges to p, {β n } converges to 0, λ is a constant, and Rate of convergence of {p n } is O(β n ) O(β n ) is typically of the form – 1/n a – 1/a n 82

Order of Convergence A different measure of convergence speed than rate of convergence Examines the relationship between successive error values 83

Order of Convergence Iterative Method An iterative method is said to be of order α if the sequence it generates converges of order α The most common values of α in practice are –α = 1 (linear convergence) –α = 2 (quadratic convergence) –α = 3 (cubic convergence) Non-integer values for α are possible 84

85 Note the dramatic difference between 1 and 2, and the slight difference between 2 and 3

86