Finding roots of equations using the Newton-Raphson method

Slides:



Advertisements
Similar presentations
Lecture 5 Newton-Raphson Method
Advertisements

Coursework Requirements Numerical Methods. 1.Front Cover indicating that the coursework is about the numerical Solution of Equations. Include your name,
SOLVING QUADRATICS General Form: Where a, b and c are constants.
Chapter 16 Chemical and Phase Equilibrium Study Guide in PowerPoint to accompany Thermodynamics: An Engineering Approach, 5th edition by Yunus.
PHYS2020 NUMERICAL ALGORITHM NOTES ROOTS OF EQUATIONS.
VBA Macros for Solving Problems in Water Chemistry Chad Jafvert Purdue University The Educational Objectives of the Tools: Students will: Design and create.
458 Interlude (Optimization and other Numerical Methods) Fish 458, Lecture 8.
A few words about convergence We have been looking at e a as our measure of convergence A more technical means of differentiating the speed of convergence.
Open Methods (Part 1) Fixed Point Iteration & Newton-Raphson Methods
APPLICATIONS OF DIFFERENTIATION Newton’s Method In this section, we will learn: How to solve high-degree equations using Newton’s method. APPLICATIONS.
07 Aug 2007 KKKQ 3013 PENGIRAAN BERANGKA Week 5 – Systems of Nonlinear Equations 07 August am – 9.00 am.
Open Methods Chapter 6 The Islamic University of Gaza
Lecture Notes Dr. Rakhmad Arief Siregar Universiti Malaysia Perlis
Roots of Equations Open Methods Second Term 05/06.
Numerical Solutions of Differential Equations Taylor Methods.
DERIVING LINEAR REGRESSION COEFFICIENTS
Ideal Gas Law. Do you remember the values for STP? Chemists have figured out how to calculate the number of gas particles in a sample of gas if they know.
N 58 Graphical Solutions to Quadratic Functions Subject Content Reference: N6.7h GCSE Maths Number & Algebra.
Logarithms are important in many applications of mathematics to everyday problems, particularly in biology, engineering, economics and social science.
Use of Matlab for Analysis and Plotting of Accoustic Well Data.
Newton-Raphson Method
Activity Set 3.5.i PREP PPTX Visual Algebra for Teachers.
Copyright © by Holt, Rinehart and Winston. All rights reserved. ResourcesChapter menu Main AR Standards.
Lecture Notes Dr. Rakhmad Arief Siregar Universiti Malaysia Perlis
Copyright © Cengage Learning. All rights reserved. 4 Applications of Differentiation.
Analytical Solution of the Diffusivity Equation. FAQReferencesSummaryInfo Learning Objectives Introduction Analytical Solution Linear Systems Radial Systems.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 ~ Roots of Equations ~ Open Methods Chapter 6 Credit:
Sorting Data. FAQReferencesSummaryInfo Learning Objectives Introduction Arrays Subroutine subprograms Program Exercise Resources Quiz Home HOME Arrays.
NEWTON’S METHOD/ MATLAB GRAPHICAL USER INTERFACE Caitlyn Davis-McDaniel and Dr. Scott Sarra Department of Mathematics, Marshall University, Huntington,
Lecture 6 Numerical Analysis. Solution of Non-Linear Equations Chapter 2.
Solution of a System of ODEs with POLYMATH and MATLAB, Boundary Value Iterations with MATLAB For a system of n simultaneous first-order ODEs: where x is.
Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine.
4.5: Linear Approximations, Differentials and Newton’s Method.
Numerical Solution of the Diffusivity Equation. FAQReferencesSummaryInfo Learning Objectives Introduction Discrete Systems Taylor Series Approximation.
Real Gas Relationships
Copyright © by Holt, Rinehart and Winston. All rights reserved. ResourcesChapter menu Main AR Standards.
Numerical Methods.
Physical Property Modeling from Equations of State David Schaich Hope College REU 2003 Evaluation of Series Coefficients for the Peng-Robinson Equation.
Introduction To UNIX. FAQReferencesSummaryInfo Resources Introduction Learning Objectives Log on User Interface Commands List of Commands Useful Info.
The Software Development Process
CHAPTER 3 NUMERICAL METHODS
1 §3.2 Some Differentiation Formulas The student will learn about derivatives of constants, the product rule,notation, of constants, powers,of constants,
Newton’s Method, Root Finding with MATLAB and Excel
Dr. Jie Zou PHY Chapter 2 Solution of Nonlinear Equations: Lecture (II)
Newton-Raphson Method. Figure 1 Geometrical illustration of the Newton-Raphson method. 2.
Lecture 5 - Single Variable Problems CVEN 302 June 12, 2002.
Numerical Methods Solution of Equation.
3 DIFFERENTIATION RULES. We have:  Seen how to interpret derivatives as slopes and rates of change  Seen how to estimate derivatives of functions given.
§3.6 Newton’s Method. The student will learn about
Advanced Engineering Mathematics, 7 th Edition Peter V. O’Neil © 2012 Cengage Learning Engineering. All Rights Reserved. CHAPTER 4 Series Solutions.
10-4 Solving Quadratic Equations by Using the Quadratic Formula Objectives Students will be able to: 1)Solve quadratic equations by using the Quadratic.
Linearization, Newton’s Method
Solving Quadratic Equations by Factoring. Zero Product Property For any real numbers a and b, if the product ab = 0, then either a = 0, b = 0, or both.
Topics 1 Specific topics to be covered are: Discrete-time signals Z-transforms Sampling and reconstruction Aliasing and anti-aliasing filters Sampled-data.
Chapter 1 Limits and Their Properties Unit Outcomes – At the end of this unit you will be able to: Understand what calculus is and how it differs from.
Solving Quadratic Equations by Factoring
Project on Newton’s Iteration Method Presented by Dol Nath Khanal Project Advisor- Professor Dexuan Xie 05/11/2015.
Announcements Topics: -Introduction to (review of) Differential Equations (Chapter 6) -Euler’s Method for Solving DEs (introduced in 6.1) -Analysis of.
Solution of linear equations using Gaussian elimination Author: Jon Kleppe NTNU Assistant producer: Joachim Tro.
P2 Chapter 8 CIE Centre A-level Pure Maths © Adam Gibson.
Modeling of geochemical processes Numeric Mathematics Refreshment
Today's Contents Review Elliptic expansion parallelogram.
Computing Oil Reserves Using Statistical Distribution of Porosities
Solving Equations Graphically
MODULE 4 EQUATIONS AND INEQUALITIES.
Computers in Civil Engineering 53:081 Spring 2003
Differentiation.
1 Newton’s Method.
Presentation transcript:

Finding roots of equations using the Newton-Raphson method

Home Quiz Introduction Petroleum Exercise: Preliminaries Useful Info Resources Quiz

Learning objectives in this module Develop problem solution skills using computers and numerical methods Review of the Newton-Raphson method Develop programming skills using FORTRAN FORTRAN elements in this module input/output loops format

Introduction Finding roots of equations is one of the oldest applications of mathematics, and is required for a large variety of applications, also in the petroleum area. A familiar equation is the simple quadratic equation (1) where the roots of the equation are given by  (2) These two roots to the quadratic equation are simply the values of x for which the equation is satisfied, i.e. the left side of eq. (1) is zero. How would you do this in Fortran? Think it through and see this of how it could be done Example More

Fortran Sample PROGRAM QUADRATIC REAL A, B, C, D, SOL1, SOL2 WRITE(*,*) ’Type the constants A,B and C’ READ* ,A,B,C D = B**2 - 4*A*C IF (D .LT. 0) THEN WRITE(*,*) ’The equation has a complex solution' ELSE SOL1 = (-B+SQRT(D)) / (2*A) SOL2 = (-B-SQRT(D)) / (2*A) WRITE(*,*) 'X1=',SOL1,'X2=',SOL2 ENDIF END

Introduction In a more general form, we are given a function of x, F(x), and we wish to find a value for x for which: The function F(x) may be algebraic or transcendental, and we generally assume that it may be differentiated. In practice, the functions we deal with in petroleum applications have no simple closed formula for their roots, as the quadratic equation above has. Instead, we turn to methods for approximation of the roots, and two steps are involved: 1 Finding an approximate root Refining the approximation to wanted accuracy The first step will normally be a qualified guess based on the physics of the system. For the second step, a variety of methods exists. Please see the textbook for a discussion of various methods. More

Introduction Here, we will concern ourselves with the Newton-Raphson method. For the derivation of the formula used for solving a one-dimensional problem, we simply make a first-order Taylor series expansion of the function F(x) (4) Let us use the following notation for the x-values: (5) Then, eq. (4) may be rewritten as (6) More

View Graphic Illustration Introduction Setting Eq. (6) to zero and solving for xk+1 yields the following expression (7) This is the one-dimensional Newton-Raphson iterative equation, where represents the refined approximation at iteration level k+1, and is the approximation at the previous iteration level (k). View Graphic Illustration

See the Newton-Raphson method - animated Graphic Illustration Graphically, the method is illustrated in the figure below. The first approximation (qualified guess) of the solution (x1) is around 1,6. The tangent to the function at that x-value intersects the x-axis at around 3,3 (x2). The tangent at that point intersects at around 2,4 (x3), and the fourth value (x4) is getting very close to the solution at around x=2,7 F(x) x See the Newton-Raphson method - animated HERE

Petroleum Exercise:Preliminaries Equations of State (EOS) are used for description of PVT-behavior (Pressure-Volume-Temperature) of hydrocarbon gases. One such equation is the Beattie-Bridgeman equation: (8) P is pressure in atmospheres (atm) V is molar volume (liter/g mole) T is temperature (oK) R is the universal gas constant (0,08205 liter-atm / oK-g mole) Next

Beta Equations of State (EOS) are used for description of PVT-behavior (Pressure-Volume-Temperature) of hydrocarbon gases. One such equation is the Beattie-Bridgeman equation: (8) P is pressure in atmospheres (atm) V is molar volume (l/g mole) T is temperature (oK) R is the universal gas constant (0,08205 liter-atm / oK-g mole) A0, B0, a, b, c are gas specific constants Next

Gamma Equations of State (EOS) are used for description of PVT-behavior (Pressure-Volume-Temperature) of hydrocarbon gases. One such equation is the Beattie-Bridgeman equation: (8) P is pressure in atmospheres (atm) V is molar volume (l/g mole) T is temperature (oK) R is the universal gas constant (0,08205 liter-atm / oK-g mole) A0, B0, a, b, c are gas specific constants Next

Delta Equations of State (EOS) are used for description of PVT-behavior (Pressure-Volume-Temperature) of hydrocarbon gases. One such equation is the Beattie-Bridgeman equation: (8) P is pressure in atmospheres (atm) V is molar volume (l/g mole) T is temperature (oK) R is the universal gas constant (0,08205 liter-atm / oK-g mole) A0, B0, a, b, c are gas specific constants Next

Petroleum Exercise:Preliminaries After solving for the root of the eq. (8), ie. for the value for V that satisfies the equation for one particular set of pressure and temperature, we may find the corresponding compressibility factor (Z-factor) for the gas using the formula (the gas law for a real gas): (12) PV = ZRT Which can be rearranged to ... (obviously) Z = PV RT Next

Petroleum Exercise:Preliminaries The procedure for the exercise is described in the following. First, we rewrite the Beattie-Bridgeman equation as: (13) Then, we take the derivative of the function F(V) at constant P and T Try yourself! What is the derivative of F (V)? then check the Answer (click)

Quiz Did you really try?? Click the correct solution and see if you still know your maths A) B)

Right Answer Right Answer!! BACK

Wrong Answer Sorry, Wrong Answer!! BACK

Petroleum Exercise:Preliminaries Now, the derivate of the function F(V) at constant P & T being (14) using the Newton-Raphson formula of eq. (7), we may find the root of Eq. (13) iteratively and after reducing the fraction, we get where k is the iteration counter More

Petroleum Exercise:Preliminaries For the first iteration (k=1) we need a start value V1. Here, we estimate a value using the ideal gas law (assuming Z=1): PV=RT or V1=RT / P The iterative procedure is terminated when the relative change in V is less than a prescribed convergence criterion, e, i.e.

Petroleum Exercise Tasks to be completed Make a FORTRAN program that uses the Newton-Raphson method to solve the Beattie-Bridgeman equation for molar volume (V ) for any gas (i.e.. for any set of the parameters A0, B0, a, b, c) at a given pressure (P ) and a given temperature (T ). After finding the volume (V ), the compressibility factor (Z ) should be computed. The computer program will read all parameters, and pressure and temperature, from the input file, and should write the computed parameters, pressure and temperature, and computed compressibility factor, for each set of pressure and temperature to the output file. Run the computer program for This data set Make a plot of compressibility factor vs. pressure for the two different temperatures (on the same figure). 1 2 3

Petroleum Exercise (continued) P (atm) T (C) 1 2 5 10 20 40 60 80 100 120 140 160 180 200 Use the following set of data for the gas (methane) Make computations for the following pressures and temperatures. (Remember that K=273,15+0C) Parameter Value Ao 2,2789 Bo 0,05587 a 0,01855 b -0,01587 c 128000 Use a convergence criterion of 0.000001, and set max allowed number of iterations to 20 Useful info and tip on the Fortran Program HERE

For the Newton-Raphson program Useful Info For the Newton-Raphson program Include an input and an output file. For the iterative operation, the DO loop is recommended. The convergence criterion should be tested with the IF statement Find a reasonable format in which to present your calculations All clear? Go to Work!! Resources

Resources Introduction to Fortran Fortran Template here The whole exercise in a printable format here Web sites Numerical Recipes Fortran Tutorial Professional Programmer's Guide to Fortran77 Programming in Fortran77

Quiz This section includes a quiz on the topics covered by this module. The quiz is meant as a control to see if you have learned some of the most important features Hit object to start quiz

General information About the author Title: Finding roots of equations using the Newton-Raphson method Teacher(s): Professor Jon Kleppe Assistant(s): Per Jørgen Dahl Svendsen Abstract: Provide a good background for solving problems within petroleum related topics using numerical methods 4 keywords: Newtons Method, Loops, Fortran, Input/Output Topic discipline: Level: 2 Prerequisites: None Learning goals: Develop problem solution skills using computers and numerical methods Size in megabytes: 0.7 MB Software requirements: MS Power Point 2002 or later, Flash Player 6.0 Estimated time to complete: Copyright information: The author has copyright to the module and use of the content must be in agreement with the responsible author or in agreement with http://www.learningjournals.net. About the author

FAQ No questions have been posted yet. However, when questions are asked they will be posted here. Remember, if something is unclear to you, it is a good chance that there are more people that have the same question For more general questions and definitions try these Dataleksikon Webopedia Schlumberger Oilfield Glossary

References W. H. Preuss, et al., “Numerical Recipes in Fortran”, 2nd edition Cambridge University Press, 1992 References to the textbook : Newton-Raphson Method Using Derivative: page 355 The Textbook can also be accessed online: Numerical Recipes in Fortran

Summary Subsequent to this module you should... be able to translate a problem to Fortran code write and handle DO loops have a feel for the output format know the conditional statements and use the IF structure

Newton-Raphson Method Movie (Just click on image to start movie) Back