Analysis Methods in Atmospheric and Oceanic Science

Similar documents
Analysis Methods in Atmospheric and Oceanic Science

Analysis Methods in Atmospheric and Oceanic Science

INTRODUCTION, FOUNDATIONS

FALL 2018 MATH 4211/6211 Optimization Homework 4

Two hours. To be provided by Examinations Office: Mathematical Formula Tables. THE UNIVERSITY OF MANCHESTER. 29 May :45 11:45

CS 323: Numerical Analysis and Computing

Newton s Method and Linear Approximations

Numerical Methods Lecture 3

Root Finding (and Optimisation)

Goals for This Lecture:

CS 323: Numerical Analysis and Computing

BEKG 2452 NUMERICAL METHODS Solution of Nonlinear Equations

Single Variable Minimization

Families of Functions, Taylor Polynomials, l Hopital s

CHAPTER 4 ROOTS OF EQUATIONS

Newton s Method and Linear Approximations

Solutions of Equations in One Variable. Newton s Method

TWO METHODS FOR OF EQUATIONS

Lecture 5. September 4, 2018 Math/CS 471: Introduction to Scientific Computing University of New Mexico

SECTION A. f(x) = ln(x). Sketch the graph of y = f(x), indicating the coordinates of any points where the graph crosses the axes.

i x i y i

Line Search Techniques

Use the Rational Zero Theorem to list all the possible rational zeros of the following polynomials. (1-2) 4 3 2

Newton s Method and Linear Approximations 10/19/2011

Virtual University of Pakistan

PHYS F212X FE1+FE2+FE3

PS 150 Physics I for Engineers Embry-Riddle Aeronautical University Fall 2018

Welcome to Physics 201

Chapter 3: Root Finding. September 26, 2005

6.3 METHODS FOR ADVANCED MATHEMATICS, C3 (4753) A2

MATH10001 Mathematical Workshop Graph Fitting Project part 2

5. Hand in the entire exam booklet and your computer score sheet.

Midterm Review. Igor Yanovsky (Math 151A TA)

Numerical mathematics with GeoGebra in high school

(Make-Up) Test 1: Multivariable Calculus

HEAT AND THERMODYNAMICS PHY 522 Fall, 2010

ASSIGNMENT BOOKLET. Numerical Analysis (MTE-10) (Valid from 1 st July, 2011 to 31 st March, 2012)

Design and Optimization of Energy Systems Prof. C. Balaji Department of Mechanical Engineering Indian Institute of Technology, Madras

PART I Lecture Notes on Numerical Solution of Root Finding Problems MATH 435

GENG2140, S2, 2012 Week 7: Curve fitting

Bindel, Fall 2011 Intro to Scientific Computing (CS 3220) Week 6: Monday, Mar 7. e k+1 = 1 f (ξ k ) 2 f (x k ) e2 k.

Numerical Methods Dr. Sanjeev Kumar Department of Mathematics Indian Institute of Technology Roorkee Lecture No 7 Regula Falsi and Secant Methods

Solution of Algebric & Transcendental Equations


Do not turn over until you are told to do so by the Invigilator.

Function Junction: Homework Examples from ACE

Roots of Equations. ITCS 4133/5133: Introduction to Numerical Methods 1 Roots of Equations

1.1: The bisection method. September 2017

Physics 112 Spring 2014

1 The best of all possible worlds

If you need the source code from the sample solutions, copy and paste from the PDF should work. If you re having trouble, send me an .

Linear algebra I Homework #1 due Thursday, Oct Show that the diagonals of a square are orthogonal to one another.

Math , Fall 2014 TuTh 12:30pm - 1:45pm MTH 0303 Dr. M. Machedon. Office: Math Office Hour: Tuesdays and

(f(x) P 3 (x)) dx. (a) The Lagrange formula for the error is given by

Extended Introduction to Computer Science CS1001.py. Lecture 8 part A: Finding Zeroes of Real Functions: Newton Raphson Iteration

MA 113 Calculus I Fall 2015 Exam 1 Tuesday, 22 September Multiple Choice Answers. Question

You may not use your books, notes; calculators are highly recommended.

TABLE OF CONTENTS INTRODUCTION, APPROXIMATION & ERRORS 1. Chapter Introduction to numerical methods 1 Multiple-choice test 7 Problem set 9

University of Delaware Department of Mathematical Sciences Math 353 Engineering Mathematics III 06S C. Bacuta

Pre-Calculus Room 114

Edexcel GCE Further Pure Mathematics (FP1) Required Knowledge Information Sheet. Daniel Hammocks

CS412: Introduction to Numerical Methods

Instructor: Vikki Maurer Class: M 1-3, W 1-3, F 1-2

Intro to Scientific Computing: How long does it take to find a needle in a haystack?

Introductory Numerical Analysis

Computational Methods CMSC/AMSC/MAPL 460. Solving nonlinear equations and zero finding. Finding zeroes of functions

Chapter 4. Solution of Non-linear Equation. Module No. 1. Newton s Method to Solve Transcendental Equation

Numerical analysis meets number theory: using rootfinding methods to calculate inverses mod p n

NON-LINEAR ALGEBRAIC EQUATIONS Lec. 5.1: Nonlinear Equation in Single Variable

Examples 2: Composite Functions, Piecewise Functions, Partial Fractions

Regent College Maths Department. Further Pure 1 Numerical Solutions of Equations

Module 5 : Linear and Quadratic Approximations, Error Estimates, Taylor's Theorem, Newton and Picard Methods

Mathematical Focus 1 Complex numbers adhere to certain arithmetic properties for which they and their complex conjugates are defined.

Fall 2016 Exam 3 NAME: PIN:

ARE202A, Fall 2005 CONTENTS. 1. Graphical Overview of Optimization Theory (cont) Separating Hyperplanes 1

Optimization and Calculus

Mon 3 Nov Tuesday 4 Nov: Quiz 8 ( ) Friday 7 Nov: Exam 2!!! Today: 4.5 Wednesday: REVIEW. In class Covers

Multivariable Calculus

Theory of Equations. Lesson 5. Barry H. Dayton Northeastern Illinois University Chicago, IL 60625, USA. bhdayton/theq/

Due: Fri Nov :31 AM MST. Question Instructions Read today's Notes and Learning Goals

General Chemistry I Chemistry 101B Fall 2002 Department of Chemistry Colgate University

MA 126 CALCULUS II Wednesday, December 10, 2014 FINAL EXAM. Closed book - Calculators and One Index Card are allowed! PART I

Roots of Equations Roots of Polynomials

Calculus, Series and Differential Equations

Week 12: Optimisation and Course Review.

Newton-Raphson Type Methods

Chapter 2 notes from powerpoints

S56 (5.3) Further Calculus.notebook March 24, 2016

GTECH 380/722 Analytical and Computer Cartography Hunter College, CUNY Department of Geography

Course Syllabus Phy320L - Modern Physics Laboratory Spring 1999

CALCULUS. Department of Mathematical Sciences Rensselaer Polytechnic Institute. May 8, 2013

Variable. Peter W. White Fall 2018 / Numerical Analysis. Department of Mathematics Tarleton State University

3.1 Introduction. Solve non-linear real equation f(x) = 0 for real root or zero x. E.g. x x 1.5 =0, tan x x =0.

x 2 x n r n J(x + t(x x ))(x x )dt. For warming-up we start with methods for solving a single equation of one variable.

Finding the Roots of f(x) = 0. Gerald W. Recktenwald Department of Mechanical Engineering Portland State University

Finding the Roots of f(x) = 0

Department of Applied Mathematics and Theoretical Physics. AMA 204 Numerical analysis. Exam Winter 2004

Nonlinearity Root-finding Bisection Fixed Point Iteration Newton s Method Secant Method Conclusion. Nonlinear Systems

FINITE DIFFERENCES. Lecture 1: (a) Operators (b) Forward Differences and their calculations. (c) Backward Differences and their calculations.

Empirical And Molecular Formula Worksheet Answers 6-10

Transcription:

Analysis Methods in Atmospheric and Oceanic Science 1 AOSC 652 Week 7, Day 1 10 Oct 2016

Student projects: 20% of the final grade: you will receive a numerical score for the project and final grade will be found via: Final Grade = (0.1) (Attendance + Participation) + (0.7) (Homework) + (0.2) (Final Project) 28, 30 Nov, 2, 5, and 7 Dec set aside for in class work on your project Thurs 8 & Fri 9 Dec: students present their project (10 minute talks), prepared using either Powerpoint, Open Office, etc and converted to PDF prior to the start of class Each student must turn in a brief written description of the project as well as all code used to complete the project Good to begin thinking about your project: application of techniques learned in class to a scientific problem of your interest I am available to discuss potential projects at any time 2

3 Modular Tracts: Next week, Python will meet here, and IDL will meet in CSS 3408 Please order the appropriate book ASAP

4 Solution of many scientific problems requires finding either the root or the minimum of an equation (or set of equations) which can be highly non-linear: What is meant by root?

5 Solution of many scientific problems requires finding either the root or the minimum of an equation (or set of equations) which can be highly non-linear: Roots of quadratic equation: + + = 2 ax bx c Roots are: 0 x = 2 ± b b 4ac 2a

6 Solution of many scientific problems requires finding either the root or the minimum of an equation (or set of equations) which can be highly non-linear: Roots of quadratic equation: x = Roots of cubic equation? ± 4 2a 2 b b ac

7 Solution of many scientific problems requires finding either the root or the minimum of an equation (or set of equations) which can be highly non-linear: Roots of quadratic equation: x = Roots of cubic equation: ± 4 2a 2 b b ac Can be expressed in closed form, but very few people can state the solution from memory http://en.wikipedia.org/wiki/cubic_function

8 Solution of many scientific problems requires finding either the root or the minimum of an equation (or set of equations) which can be highly non-linear: Roots of quadratic equation: x = ± 4 2a 2 b b ac Higher order polynomials?

9 Solution of many scientific problems requires finding either the root or the minimum of an equation (or set of equations) which can be highly non-linear: Roots of quadratic equation: x = ± 4 2a 2 b b ac Even an equation as simple as cos(x) x 2 = 0 cannot be solved analytically!

10 Method #1: Direct Search Specify interval, x 1 to x 2, where root(s) is assumed (or known) to occur Divide x 1 to x 2 into various sub-intervals, spaced by a distance x Tolerance that represents the accuracy of the root(s) Search through each interval to see where root(s) is (are) present

Method #1: Direct Search Specify interval, x 1 to x 2, where root(s) is assumed (or known) to occur Divide x 1 to x 2 into various sub-intervals, spaced by a distance x Tolerance that represents the accuracy of the root(s) Search through each interval to see where root(s) is (are) present f(x) f(x) 0 x f(x 1 ) > 0 & f(x 2 ) > 0 : No Root between x 1 and x 2 0 x f(x) f(x) 0 x f(x 1 ) > 0 & f(x 2 ) < 0 : One Root between x 1 and x 2 0 x f(x 1 ) < 0 & f(x 2 ) < 0 : No Root between x 1 and x 2 f(x 1 ) < 0 & f(x 2 ) > 0 : One Root between x 1 and x 2 11

Method #1: Direct Search Many pathological situations can occur some related to spacing not being fine enough some related to inherent behavior of function Press et al., Numerical Recipes 12

13 Method #1: Direct Search Let s apply the direct search method to the function cos(x) x 2 = 0

14 Method #1: Direct Search Let s apply the direct search method to the function cos(x) x 2 = 0 Exercise: plot cos(x) x 2, from x = 0 to 1, and ascertain: number of roots between 0 and 1 approximate value of root(s) Note: treat x as radians

15 Method #1: Direct Search Let s apply the direct search method to the function cos(x) x 2 = 0 Let s find the root using direct search copy file ~rjs/aosc652/week_07/direct_search.f to your work area have a look at the code (handout); then, compile and run find the root to an accuracy of 1.E 2 repeat for accuracy of 1.E 4

16 Method #1: Direct Search Let s apply the direct search method to the function cos(x) x 2 = 0 Let s find the root using direct search copy file ~rjs/aosc652/week_07/direct_search.f to your work area have a look at the code (handout); then, compile and run find the root to an accuracy of 1.E 2 repeat for accuracy of 1.E 4 How many times was the function called? How long would this process have taken if the function, rather than cos(x) x 2, was a multiple scattering, radiative transfer calculation that took ~2 mins to converge (for each call)?

17 Method #2: Bisection Method Advancement on the direct search method that is applicable when only one root is known to occur within a specified interval 1. Evaluate function at x S, x E, and midpoint x M : f(x S ), f(x E ), and f(x M ) 2. If f(x S ) f(x M ) > 0 and f(x M ) f(x E ) < 0, root must lie between x M and x E (i.e., root lies within interval for which product is negative) f(x S ) f(x M ) > 0 f(x M ) f(x S ) < 0 Root lies between x M and x S

Method #2: Bisection Method Advancement on the direct search method that is applicable when only one root is known to occur within a specified interval 1. Evaluate function at x S, x E, and midpoint x M : f(x S ), f(x E ), and f(x E ) 2. If f(x S ) f(x M ) > 0 and f(x M ) f(x E ) < 0, root must lie between x M and x E (i.e., root lies within interval for which product is negative) Root lies between x m and x 2 3. x M is used as estimate of root for this iteration 4. Convergence if: a) f(x M ) = 0 or f(x M ) lies within a certain distance of 0 or b) update to x M < x Tolerance 5. If convergence criteria not met: a) let end points of the half-interval in which root is located be end points of new interval b) return to function evaluation (#1) above 18

19 Method #2: Bisection Method Copy file ~rjs/aosc652/week_07/bisection.f to your work area Have a look at the code (handout); then, compile and run Find the root to an accuracy of 1.E 2 Repeat for accuracy of 1.E 4

20 Method #2: Bisection Method Copy file ~rjs/aosc652/week_07/bisection.f to your work area Have a look at the code (handout); then, compile and run Find the root to an accuracy of 1.E 2 Repeat for accuracy of 1.E 4 How many calls to function were required to find the root for each call? NOTE: when finding roots or minimizing functions, always important to place a limit on the number of iterations and to pay attention to the tolerance (accuracy) of the result How is the number of iterations limited in code bisection.f?

21 Method #2: Bisection Method Copy file ~rjs/aosc652/week_07/bisection.f to your work area Have a look at the code (handout); then, compile and run Find the root to an accuracy of 1.E 2 Repeat for accuracy of 1.E 4 How many calls to function were required to find the root for each call? Convergence behavior of the bisection method is not bad (for the chosen function), but the bisection method is rarely used in modern scientific applications

22 Method #2: Bisection Method Copy file ~rjs/aosc652/week_07/bisection.f to your work area Have a look at the code (handout); then, compile and run Find the root to an accuracy of 1.E 2 Repeat for accuracy of 1.E 4 How many calls to function were required to find the root for each call? Convergence behavior of the bisection method is not bad (for the chosen function), but the bisection method is rarely used in modern scientific applications How can we use calculus to help us find the root?

23 Method #3: Newton-Raphson Let s use calculus to help us find the root: Taylor series expansion of a function f evaluated near point x f ( x) f x+ δ f x f x δ δ 2 2 ( ) ( ) + ( ) + +...

24 Method #3: Newton-Raphson Let s use calculus to help us find the root: Taylor series expansion of a function f evaluated near point x Let s convert this calculus to a form that will help us find the root of f(x) : or f ( x) f x+ δ f x f x δ δ 2 2 ( ) ( ) + ( ) + +... f( x ) f( x ) + f ( x ) x 1 0 0 f( x ) f( x ) + f ( x ) ( x x ) 1 0 0 1 0

Method #3: Newton-Raphson Let s use calculus to help us find the root: Taylor series expansion of a function f evaluated near point x Let s convert this calculus to a form that will help us find the root of f(x) : or f ( x) f x+ δ f x f x δ δ 2 2 ( ) ( ) + ( ) + +... f( x ) f( x ) + f ( x ) x 1 0 0 f( x ) f( x ) + f ( x ) ( x x ) 1 0 0 1 0 Of course: df f ( x ) = the first derivative of f evaluated at x dx 0 0 x 0 25

26 Method #3: Newton-Raphson Root is place where f(x) = 0 0 f( x ) + f ( x ) x = f( x ) + f ( x )( x x ) If the derivative is evaluated at x 0 then the next value x 1 is found by: Convergence if either: 0 0 0 0 1 0 x = x 1 0 f( x0 ) f ( x ) f(x i ) = 0 or f(x i ) lies within a certain distance of 0 or update to x i < x Tolerance If not converged, next value x i+1 is found from: x = i+ 1 xi 0 f( xi ) f ( x ) i

27 Method #3: Newton-Raphson Very powerful convergence method provided: derivative is continuous and non-zero near root initial guess for root is close to root should use with iteration counter and check to see if root (or function minima) was indeed found Can read about Newton Raphson iteration on the web: http://en.wikipedia.org/wiki/newton-raphson_method

Method #3: Newton-Raphson Very powerful convergence method provided: derivative is continuous and non-zero near root initial guess for root is close to root should use with iteration counter and check to see if root (or function minima) was indeed found Can read about Newton Raphson iteration on the web: http://en.wikipedia.org/wiki/newton-raphson_method Numerical algorithm semantics: Newton-Raphson or Newton s method: derivative can be found analytically Secant method: derivative can only be found numerically 28

29 Method #3: Newton-Raphson Between now and Wednesday Copy file ~rjs/aosc652/week_07/newton_raphson.f into your work area Have a look at the code and compare / contrast to subroutine rtnewt on page 358 of Press et al. Between now and Wed: please look at this code and compare / contrast to the Press subroutine