Fixed point iterations and solution of non-linear functions

Slides:



Advertisements
Similar presentations
Programming Tips: While Loops and Comparisons 1Daniel Baur / Numerical Methods for Chemical Engineerse Daniel Baur ETH Zurich, Institut für Chemie- und.
Advertisements

Boundary Value Problems and Partial Differential Equations (PDEs)
Part 2 Chapter 6 Roots: Open Methods
Numerical Computation Lecture 4: Root Finding Methods - II United International College.
Chapter 6: Roots: Open Methods
Lecture 5 Newton-Raphson Method
Part 2 Chapter 6 Roots: Open Methods
Numerical Solution of Nonlinear Equations
Introduction to Matlab 7
CSE 330: Numerical Methods
Process Control: Designing Process and Control Systems for Dynamic Performance Chapter 6. Empirical Model Identification Copyright © Thomas Marlin 2013.
Partial Differential Equations (PDEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / BVP and PDE Daniel Baur ETH Zurich, Institut für Chemie-
Numerical Differentiation and Quadrature (Integration) 1Daniel Baur / Numerical Methods for Chemical Engineers / Numerical Quadrature Daniel Baur ETH Zurich,
Linear Regression 1Daniel Baur / Numerical Methods for Chemical Engineers / Linear Regression Daniel Baur ETH Zurich, Institut für Chemie- und Bioingenieurwissenschaften.
Systems of Linear Equations
Response Surface Method Principle Component Analysis
Chapter 4 Roots of Equations
Linear Systems of Equations Ax = b Marco Lattuada Swiss Federal Institute of Technology - ETH Institut für Chemie und Bioingenieurwissenschaften ETH Hönggerberg/
Transfer Functions Convenient representation of a linear, dynamic model. A transfer function (TF) relates one input and one output: The following terminology.
Transfer Functions Convenient representation of a linear, dynamic model. A transfer function (TF) relates one input and one output: The following terminology.
Ordinary Differential Equations (ODEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / Implicit ODE Solvers Daniel Baur ETH Zurich, Institut.
Nonlinear Algebraic Systems 1.Iterative solution methods 2.Fixed-point iteration 3.Newton-Raphson method 4.Secant method 5.Matlab tutorial 6.Matlab exercise.
Lecture Notes Dr. Rakhmad Arief Siregar Universiti Malaysia Perlis
Newton's Method for Functions of Several Variables
Nonlinear Equations in Biomedical Engineering
Linear Regression Y i =  0 +  1 x i +  i Marco Lattuada Swiss Federal Institute of Technology - ETH Institut für Chemie und Bioingenieurwissenschaften.
Fin500J: Mathematical Foundations in Finance Topic 3: Numerical Methods for Solving Non-linear Equations Philip H. Dybvig Reference: Numerical Methods.
Lecture 11 Chemical Reaction Engineering (CRE) is the field that studies the rates and mechanisms of chemical reactions and the design of the reactors.
Ordinary Differential Equations (ODEs)
Differential Equations and Boundary Value Problems
Chapter 3 Root Finding.
Ordinary Differential Equations (ODEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / Explicit ODE Solvers Daniel Baur ETH Zurich, Institut.
Ordinary Differential Equations (ODEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / Implicit ODE Solvers Daniel Baur ETH Zurich, Institut.
Ordinary Differential Equations (ODEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / Explicit ODE Solvers Daniel Baur ETH Zurich, Institut.
MATH 685/ CSI 700/ OR 682 Lecture Notes Lecture 8. Nonlinear equations.
Selected Differential System Examples from Lectures.
Systems of Linear Equations Iterative Methods
Algorithms for a large sparse nonlinear eigenvalue problem Yusaku Yamamoto Dept. of Computational Science & Engineering Nagoya University.
Chapter 6 Finding the Roots of Equations
Selected Differential System Examples from Lectures
Boundary Value Problems and Least Squares Minimization
© 2014 Carl Lund, all rights reserved A First Course on Kinetics and Reaction Engineering Class 13.
© 2014 Carl Lund, all rights reserved A First Course on Kinetics and Reaction Engineering Class 23.
Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine.
Numerical Methods for Engineering MECN 3500
Quadrature rules 1Michael Sokolov / Numerical Methods for Chemical Engineers / Numerical Quadrature Michael Sokolov ETH Zurich, Institut für Chemie- und.
Numerical Differentiation and Quadrature (Integration)
Solution of Nonlinear Functions
Ordinary Differential Equations (ODEs) 1Michael Sokolov / Numerical Methods for Chemical Engineers / Explicit ODE Solvers Michael Sokolov ETH Zurich, Institut.
Newton’s Method, Root Finding with MATLAB and Excel
4 Numerical Methods Root Finding Secant Method Modified Secant
Lecture 5 - Single Variable Problems CVEN 302 June 12, 2002.
Linear Systems of Equations Iterative and Relaxation Methods Ax = b Marco Lattuada Swiss Federal Institute of Technology - ETH Institut für Chemie und.
ERT 210/4 Process Control & Dynamics DYNAMIC BEHAVIOR OF PROCESSES :
TRANSFER FUNCTION Prepared by Mrs. AZDUWIN KHASRI.
Answers for Review Questions for Lectures 1-4. Review Lectures 1-4 Problems Question 2. Derive a closed form for the estimate of the solution of the equation.
Nonlinear Regression 1Michael Sokolov / Numerical Methods for Chemical Engineers / Nonlinear Regression Michael Sokolov ETH Zurich, Institut für Chemie-
Transfer Functions Convenient representation of a linear, dynamic model. A transfer function (TF) relates one input and one output: The following terminology.
Transfer Functions Chapter 4
Numerical Methods and Analysis
Lecture 11 Chemical Reaction Engineering (CRE) is the field that studies the rates and mechanisms of chemical reactions and the design of the reactors.
Read Chapters 5 and 6 of the textbook
Zero of a Nonlinear Function f(x) = 0
Lecture 11 Chemical Reaction Engineering (CRE) is the field that studies the rates and mechanisms of chemical reactions and the design of the reactors.
Zero of a Nonlinear System of Algebraic Equations f(x) = 0
Computers in Civil Engineering 53:081 Spring 2003
SOLUTION OF NONLINEAR EQUATIONS
Lecture 11 Chemical Reaction Engineering (CRE) is the field that studies the rates and mechanisms of chemical reactions and the design of the reactors.
13. Reactor Engineering: Reactor Design
EE, NCKU Tien-Hao Chang (Darby Chang)
Presentation transcript:

Fixed point iterations and solution of non-linear functions Daniel Baur ETH Zurich, Institut für Chemie- und Bioingenieurwissenschaften ETH Hönggerberg / HCI F128 – Zürich E-Mail: daniel.baur@chem.ethz.ch http://www.morbidelli-group.ethz.ch/education/index Daniel Baur / Numerical Methods for Chemical Engineers / Nonlinear Equations

Zero of a Nonlinear Function Problem definition: Find the solution of the equation f(x) = 0 for scalar valued f and x; Look for the solution either in An interval, generally –∞ < x < ∞ In the uncertainty interval [a, b], where f(a)f(b) < 0 Types of algorithms available: Bisection method Substitution methods Methods based on function approximation Assumptions: In the defined intervals, at least one solution exists We are looking for one solution, not all of them Daniel Baur / Numerical Methods for Chemical Engineers / Nonlinear Equations

Fixed point iterations Fixed point iteration formulas generally have the form A fixed point of F is a point x*, where A fixed point iteration is called consistent with a non-linear equation f(x), if Daniel Baur / Numerical Methods for Chemical Engineers / Nonlinear Equations

Convergence order of fixed point iterations For any (converging) fixed point iteration, we can write where c is the rate of convergence and q is the convergence order If we take the logarithm on both sides, we get Which we can use to fit an average q and c Daniel Baur / Numerical Methods for Chemical Engineers / Nonlinear Equations

Bisection Method Define starting interval [a,b] (check that f(a)*f(b) < 0) Compute x = mean([a, b]) Redefine the interval Set either a = x or b = x so that f(a)*f(b) < 0 is still fulfilled Iterate 2 and 3 until the requested precision is reached Advantages After n iterations, the interval is reduced by 2n Final precision can be predicted a priori Disadvantages Function characteristics are not used to speed up the algorithm b a x a Daniel Baur / Numerical Methods for Chemical Engineers / Numerical Quadrature

Newton Method The Newton method is based on Taylor expansion Advantages It has 2nd order convergence Disadvantages Convergence is not guaranteed even if the uncertainty interval is known If the derivative must be calculated numerically, the secant method is more convenient x1 x0 Daniel Baur / Numerical Methods for Chemical Engineers / Nonlinear Equations

Secant Method The Secant is based on the same principles as the Newton method, but it approximates the derivative numerically Advantages Does not require the analytical first order derivative Disadvantages Convergence is not assured even if the uncertainty interval is known Convergence order is only 1.618 x0 = 1.8 x1 = 1.7 Secant Newton Daniel Baur / Numerical Methods for Chemical Engineers / Nonlinear Equations

How does Matlab do it? Nonlinear Functions fzero finds the zero of a scalar valued function; It uses a combination of bisection, secant, and inverse quadratic interpolation methods roots finds all the roots of a polynomial function; It computes the eigenvalues of the companion matrix, which correspond to the roots of the polynomial A = diag(ones(n-1,1),-1); A(1,:) = -c(2:n+1)./c(1); eig(A); Where c is the vector of the polynomial coefficients Daniel Baur / Numerical Methods for Chemical Engineers / Nonlinear Equations

Matlab Syntax Hints x = fzero(fun, x0); x = roots(c); fun is a function taking as input a scalar x, returning as output the scalar function value f(x) x0 is either an initial guess (if it has length 1) or an uncertainty interval (if it has length 2, then f(x0(1))*f(x0(2)) < 0 must be fulfilled) x = roots(c); c is a vector containing the polynomial coefficients in the order Daniel Baur / Numerical Methods for Chemical Engineers / Nonlinear Equations

Exercise 1: Fixed point iterations Consider the function And the following iterative formulas: Daniel Baur / Numerical Methods for Chemical Engineers / Nonlinear Equations

Assignment 1 For each of the iterative formulas try to find a fixed point Define a starting guess x0 between 0 and 1 while abs(xk – xk-1) > 1e-8, calculate the next x value Store the values calculated in a vector xvec Also terminate the while-loop if 1e5 iterations are exceeded Is there a fixed point and is it consistent with (1)? Estimate the convergence orders and the rates of convergence for the formulas which have a fixed point Calculate dX = log(abs(diff(xvec))); Set X = dX(1:end-1); and Y = dX(2:end); Perform a linear fit with p = polyfit(X,Y,1); Calculate q and c from the fitting coefficients in p, remember that Daniel Baur / Numerical Methods for Chemical Engineers / Nonlinear Equations

Exercise: CSTR Multiple Steady States Consider a CSTR where a reaction takes place We assume the following V = const., i.e. Qin = Qout = const. Perfect coolant behavior, i.e. TC,in = TC,out = const. Constant density and heat capacity of the reaction mixture Constant reaction enthalpy Constant feed, i.e. cA,in = const., Tin = const. Daniel Baur / Numerical Methods for Chemical Engineers / Nonlinear Equations

CSTR Mass and Energy Balances The mass and energy balances read With the T-dependent reaction rate constant Daniel Baur / Numerical Methods for Chemical Engineers / Nonlinear Equations

Dimensionless Mass and Energy Balances If we define We get a dimensionless form Daniel Baur / Numerical Methods for Chemical Engineers / Nonlinear Equations

CSTR Temperature Equilibrium The steady state concentration of A reads The temperature in steady state is therefore given by Daniel Baur / Numerical Methods for Chemical Engineers / Nonlinear Equations

Assignment 2 Plot the total heat flow from and to the reactor vs. the dimensionless reactor temperature for θ = 0.9...1.25 Use α = 49.46; κ0 = 2.17e20; KC = 0.83; η = 0.33 and θC = 0.9. Implement and use the secant method in a function to find the three steady state temperature of the CSTR. Use a function of the form function [x,xvec] = secantRoot(f,x0) Also return the x-values calculated as a vector xvec. The calculation steps of the secant method can be found on slide 7 The secant method uses two starting guesses; from x0, calculate x1 = (1+ε)*x0. Suggest a value for ε (not too small, why?). Loop while abs(xk – xk-1) > 1e-8 and f(xk) > 1e-6 and n < 1e5 You will have to work with three x-values at any given iteration, that is xk+1, xk and xk-1 Daniel Baur / Numerical Methods for Chemical Engineers / Nonlinear Equations

Assignment 2 (continued) In what range of x0 can you converge to the intermediate solution? What feature of the function determines which solution is found? Use one of the resulting xvec to estimate the convergence order and rate of convergence of the secant method. Daniel Baur / Numerical Methods for Chemical Engineers / Nonlinear Equations