Module 10.2: nag nlin eqn Roots of a Single Nonlinear Equation. Contents

Similar documents
Module 10.1: nag polynom eqn Roots of Polynomials. Contents

Module 3.9: nag kelvin fun Kelvin Functions. Contents

Module 5.2: nag sym lin sys Symmetric Systems of Linear Equations. Contents

Module 6.6: nag nsym gen eig Nonsymmetric Generalized Eigenvalue Problems. Contents

Module 29.3: nag tsa spectral Time Series Spectral Analysis. Contents

Module 11.4: nag quad util Numerical Integration Utilities. Contents

Chapter 2 Solutions of Equations of One Variable

D03PEF NAG Fortran Library Routine Document

F04JGF NAG Fortran Library Routine Document

Comments on An Improvement to the Brent s Method

Bisection and False Position Dr. Marco A. Arocha Aug, 2014

SOLVING EQUATIONS OF ONE VARIABLE

D02TYF NAG Fortran Library Routine Document

NAG Library Routine Document F08JDF (DSTEVR)

NAG Fortran Library Routine Document D02JAF.1

NAG Library Routine Document F08UBF (DSBGVX)

NAG Library Routine Document F08FPF (ZHEEVX)

NAG Library Routine Document D02JAF.1

Root Finding: Close Methods. Bisection and False Position Dr. Marco A. Arocha Aug, 2014

MATH 3795 Lecture 12. Numerical Solution of Nonlinear Equations.

NAG Library Routine Document F08FAF (DSYEV)

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

Finding the Roots of f(x) = 0

NAG Library Routine Document C02AGF.1

NAG Library Routine Document F08PNF (ZGEES)

Scientific Computing: An Introductory Survey

Solutions of Equations in One Variable. Newton s Method

NAG Library Routine Document F07HAF (DPBSV)

Scientific Computing. Roots of Equations

Numerical Solution of f(x) = 0

Nonlinear Equations and Continuous Optimization

NAG Library Routine Document F08QUF (ZTRSEN)

NAG Library Routine Document F08FNF (ZHEEV).1

INTRODUCTION, FOUNDATIONS

INTRODUCTION TO NUMERICAL ANALYSIS

Nonlinear Equations. Chapter The Bisection Method

Lecture Notes to Accompany. Scientific Computing An Introductory Survey. by Michael T. Heath. Chapter 5. Nonlinear Equations

MATH 3795 Lecture 13. Numerical Solution of Nonlinear Equations in R N.

THE SECANT METHOD. q(x) = a 0 + a 1 x. with

Homework and Computer Problems for Math*2130 (W17).

Outline. Scientific Computing: An Introductory Survey. Nonlinear Equations. Nonlinear Equations. Examples: Nonlinear Equations

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

UNCONSTRAINED OPTIMIZATION

[k,g,gfin] = hinfsyn(p,nmeas,ncon,gmin,gmax,tol)

Discontinuous Distributions in Mechanics of Materials

G01NBF NAG Fortran Library Routine Document

Today s class. Numerical differentiation Roots of equation Bracketing methods. Numerical Methods, Fall 2011 Lecture 4. Prof. Jinbo Bi CSE, UConn

Line Search Methods. Shefali Kulkarni-Thaker

Practical Information

NAG Toolbox for Matlab. g08cd.1

NAG Fortran Library Routine Document F04CFF.1

NAG Library Routine Document F08VAF (DGGSVD)

Midterm Review. Igor Yanovsky (Math 151A TA)

F08BEF (SGEQPF/DGEQPF) NAG Fortran Library Routine Document

G13CCF NAG Fortran Library Routine Document

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

NAG Library Routine Document F02HDF.1

Computational Methods for Engineers Programming in Engineering Problem Solving

NAG Library Routine Document F08QVF (ZTRSYL)

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

15 Nonlinear Equations and Zero-Finders

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP

G12MAN Mathematical Analysis Fully-justified answers to Revision Quiz questions

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP

Numerical Integration

G03ACF NAG Fortran Library Routine Document

Numerical Methods I Solving Nonlinear Equations

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP

Math 320: Real Analysis MWF 1pm, Campion Hall 302 Homework 2 Solutions Please write neatly, and in complete sentences when possible.

SECTION 1. Introduction to MD NASTRAN SOL 400

Single Variable Minimization

6.3 METHODS FOR ADVANCED MATHEMATICS, C3 (4753) A2

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

NUMERICAL METHODS. x n+1 = 2x n x 2 n. In particular: which of them gives faster convergence, and why? [Work to four decimal places.

If you like us, please share us on social media. The latest UCD Hyperlibrary newsletter is now complete, check it out.

G13BAF NAG Fortran Library Routine Document

Delay Differential Equations Part II: Time and State dependent Lags

G13BHF NAG Fortran Library Routine Document

Motor-CAD combined electromagnetic and thermal model (January 2015)

G13CGF NAG Fortran Library Routine Document

MA 137: Calculus I for the Life Sciences

EDSA IEC 909 SHORT CIRCUIT ANALYSIS

On Iterated Numerical Integration

4 Nonlinear Equations

Numerical Study of Some Iterative Methods for Solving Nonlinear Equations

NAG Library Chapter Introduction d02 Ordinary Differential Equations

Numerical differentiation

Lecture 44. Better and successive approximations x2, x3,, xn to the root are obtained from

Math Numerical Analysis

Outline. Math Numerical Analysis. Intermediate Value Theorem. Lecture Notes Zeros and Roots. Joseph M. Mahaffy,

NAG Library Routine Document F08YUF (ZTGSEN).1

CHAPTER 1: Functions

1. Method 1: bisection. The bisection methods starts from two points a 0 and b 0 such that

Numerical Methods in Informatics

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

AIMMS Function Reference - GMPLinearization Procedures and Functions

Section 4.2 The Mean Value Theorem

ECE Information theory Final (Fall 2008)

BEKG 2452 NUMERICAL METHODS Solution of Nonlinear Equations

Find all points where the function is discontinuous. 1) Find all vertical asymptotes of the given function. x(x - 1) 2) f(x) =

Transcription:

Nonlinear Equations Module Contents Module 10.2: nag nlin eqn Roots of a Single Nonlinear Equation nag nlin eqn provides a procedure for computing a single root of a continuous function in a given interval. Contents Procedures nag nlin eqn sol... 10.2.3 Finds a solution of a single nonlinear equation Examples Example 1: Solution of a single transcendental equation... 10.2.7 Additional Examples... 10.2.9 References... 10.2.10 [NP3245/3/pdf] Module 10.2: nag nlin eqn 10.2.1

Module Contents Nonlinear Equations 10.2.2 Module 10.2: nag nlin eqn [NP3245/3/pdf]

Nonlinear Equations nag nlin eqn sol Procedure: nag nlin eqn sol 1 Description nag nlin eqn sol attempts to obtain an approximation to a simple root of the continuous function f(x) given an initial interval [a, b] such that f(a) f(b) 0. This condition implies that there is at least one root of f in the interval [a, b]. The procedure combines the methods of bisection, linear interpolation and linear extrapolation (see Dahlquist and Björck [2]), to find a sequence of subintervals [a i,b i ] of the initial interval such that the final interval contains the root. The approximation, x, totheroot, α, is such that one or both of the following criteria are satisfied: x α < x tol, f(x) < f tol. Since the intervals [a i,b i ] are determined only so that f(a i ) f(b i ) 0, it is possible that the final interval may contain a discontinuity or a pole of f (violating the requirement that f be continuous). This procedure also checks if the sign change is likely to correspond to a pole of f. 2 Usage USE nag nlin eqn CALL nag nlin eqn sol(f, x, a, b [, optional arguments]) 3 A rguments 3.1 Mandatory Arguments f function f must evaluate the function f at the point x. function f(x) real(kind=wp), intent(in) :: x Input: the point x at which the function must be evaluated. real(kind=wp) :: f Result: the value of the function at the point x. x real(kind=wp), intent(out) Output: the approximation to the root. a real(kind=wp), intent(in) b real(kind=wp), intent(in) Input: the lower bound, a, and the upper bound, b, oftheinterval. Constraints: a b, f(a) f(b) 0. [NP3245/3/pdf] Module 10.2: nag nlin eqn 10.2.3

nag nlin eqn sol Nonlinear Equations 3.2 Optional Arguments Note. Optional arguments must be supplied by keyword, not by position. The order in which they are described below may differ from the order in which they occur in the argument list. x tol real(kind=wp), intent(in), optional Input: the absolute tolerance to which the root is required (see Section 1). Constraints: x tol > 0.0. Default: x tol = SQRT(EPSILON(1.0 wp)). f tol real(kind=wp), intent(in), optional Input: a value such that if f(x) < f tol, x is accepted as the root (see Section 6.2). Constraints: f tol 0.0. Default: f tol =0.0. error type(nagerror), intent(inout), optional The NAG fl 90 error-handling argument. See the Essential Introduction, or the module document nag error handling (1.2). You are recommended to omit this argument if you are unsure how to use it. If this argument is supplied, it must be initialized by a call to nag set error before this procedure is called. 4 Error Codes Fatal errors (error%level = 3): error%code Description 301 An input argument has an invalid value. 399 An unexpected Library error. Check all procedure calls. If you cannot find any error in your calling program, please report this error to NAG. Failures (error%level = 2): error%code Description 201 f(x) changes sign at a pole. A change in sign of f(x) has been determined as occurring near the point defined by the final value of x. There is some evidence that this sign change corresponds to a pole of f(x). Warnings (error%level = 1): error%code Description 101 Too much accuracy requested. x tol is too small for the computer being used. The final value of x is an accurate approximation to the root. 5 Examples of Usage A complete example of the use of this procedure appears in Example 1 of this module document. 10.2.4 Module 10.2: nag nlin eqn [NP3245/3/pdf]

Nonlinear Equations nag nlin eqn sol 6 Further Comments 6.1 Algorithmic Detail This procedure is a modified version of procedure ZEROIN given in Bus and Dekker [1]. 6.2 Accuracy This depends on the values of x tol and f tol. If full machine accuracy is required, x tol and f tol may be set very small, resulting in an error exit with error%code = 101. This may involve more iterations than are required for a less accurate solution. You should use x tol to control the accuracy (with the default value for f tol) unless you have considerable knowledge of the size of f(x) for values of x near the root. [NP3245/3/pdf] Module 10.2: nag nlin eqn 10.2.5

nag nlin eqn sol Nonlinear Equations 10.2.6 Module 10.2: nag nlin eqn [NP3245/3/pdf]

Nonlinear Equations Example 1 Example 1: Solution of a single transcendental equation To calculate the root of e x x within the interval [0,1]. 1 Program Text Note. The listing of the example program presented below is double precision. Single precision users are referred to Section 5.2 of the Essential Introduction for further information. MODULE nlin_eqn_ex01_mod!.. Implicit None Statement.. IMPLICIT NONE!.. Intrinsic Functions.. INTRINSIC KIND!.. Parameters.. INTEGER, PARAMETER :: wp = KIND(1.0D0) CONTAINS FUNCTION f(x)!.. Implicit None Statement.. IMPLICIT NONE!.. Intrinsic Functions.. INTRINSIC EXP!.. Scalar Arguments.. REAL (wp), INTENT (IN) :: x!.. Function Return Value.. REAL (wp) :: f!.. Executable Statements.. f = EXP(-x) - x END FUNCTION f END MODULE nlin_eqn_ex01_mod PROGRAM nag_nlin_eqn_ex01! Example Program Text for nag_nlin_eqn! NAG fl90, Release 3. NAG Copyright 1997.!.. Use Statements.. USE nag_examples_io, ONLY : nag_std_out USE nag_nlin_eqn, ONLY : nag_nlin_eqn_sol USE nlin_eqn_ex01_mod, ONLY : f, wp!.. Implicit None Statement.. IMPLICIT NONE!.. Local Scalars.. REAL (wp) :: a, b, x!.. Executable Statements.. WRITE (nag_std_out,*) Example Program Results for nag_nlin_eqn_ex01 a = 0.0_wp b = 1.0_wp! Find a zero of the function in the interval [a,b] CALL nag_nlin_eqn_sol(f,x,a,b) [NP3245/3/pdf] Module 10.2: nag nlin eqn 10.2.7

Example 1 Nonlinear Equations WRITE (nag_std_out, (/,1X,A,F12.5) ) Zero =, x END PROGRAM nag_nlin_eqn_ex01 2 Program Data None. 3 Program Results Example Program Results for nag_nlin_eqn_ex01 Zero = 0.56714 10.2.8 Module 10.2: nag nlin eqn [NP3245/3/pdf]

Nonlinear Equations Additional Examples Additional Examples Not all example programs supplied with NAG fl 90 appear in full in this module document. The following additional examples, associated with this module, are available. nag nlin eqn ex02 Solution of a single transcendental equation, with user-supplied x tol. [NP3245/3/pdf] Module 10.2: nag nlin eqn 10.2.9

References Nonlinear Equations References [1] Bus J C P and Dekker T J (1975) Two efficient algorithms with guaranteed convergence for finding a zero of a function ACM Trans. Math. Software 1 330 345 [2] Dahlquist G and Björck Å (1974) Numerical Methods Prentice-Hall 10.2.10 Module 10.2: nag nlin eqn [NP3245/3/pdf]