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

Slides:



Advertisements
Similar presentations
Boundary Value Problems and Partial Differential Equations (PDEs)
Advertisements

Fixed point iterations and solution of non-linear functions
Introduction to Matlab 7
Example 1 Matrix Solution of Linear Systems Chapter 7.2 Use matrix row operations to solve the system of equations  2009 PBLPathways.
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.
Solving Equations = 4x – 5(6x – 10) -132 = 4x – 30x = -26x = -26x 7 = x.
Systems of Linear Equations
Response Surface Method Principle Component Analysis
Linear Systems of Equations Ax = b Marco Lattuada Swiss Federal Institute of Technology - ETH Institut für Chemie und Bioingenieurwissenschaften ETH Hönggerberg/
Response Surfaces max(S(  )) Marco Lattuada Swiss Federal Institute of Technology - ETH Institut für Chemie und Bioingenieurwissenschaften ETH Hönggerberg/
TRIVIA Click for Question What kind of matrix contains the coefficients and constants of a system of linear equations? An augmented matrix Click for:
Non Linear Regression Y i = f(  x i ) +  i Marco Lattuada Swiss Federal Institute of Technology - ETH Institut für Chemie und Bioingenieurwissenschaften.
Ordinary Differential Equations (ODEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / Implicit ODE Solvers Daniel Baur ETH Zurich, Institut.
Introduction to Matlab 7 Part I 1Daniel Baur / Introduction to Matlab Part I Daniel Baur ETH Zurich, Institut für Chemie- und Bioingenieurwissenschaften.
Linear Regression Y i =  0 +  1 x i +  i Marco Lattuada Swiss Federal Institute of Technology - ETH Institut für Chemie und Bioingenieurwissenschaften.
Ordinary Differential Equations (ODEs)
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.
Using Matrices to Solve a 3-Variable System
Using Inverse Matrices Solving Systems. You can use the inverse of the coefficient matrix to find the solution. 3x + 2y = 7 4x - 5y = 11 Solve the system.
Section 8.3 – Systems of Linear Equations - Determinants Using Determinants to Solve Systems of Equations A determinant is a value that is obtained from.
ITERATIVE TECHNIQUES FOR SOLVING NON-LINEAR SYSTEMS (AND LINEAR SYSTEMS)
Systems of Linear Equations Iterative Methods
Reduced Row Echelon Form Matrices and the Calculator.
AN INTRODUCTION TO ELEMENTARY ROW OPERATIONS Tools to Solve Matrices.
4.5 Solving Systems using Matrix Equations and Inverses.
Matrix Solutions to Linear Systems. 1. Write the augmented matrix for each system of linear equations.
Solving Systems of 3 or More Variables Why a Matrix? In previous math classes you solved systems of two linear equations using the following method:
4.5 Solving Systems using Matrix Equations and Inverses OBJ: To solve systems of linear equations using inverse matrices & use systems of linear equations.
Boundary Value Problems and Least Squares Minimization
Do Now: Evaluate: 3AB. Algebra II 3.7: Evaluate Determinants HW: p.207 (4-14 even) Test : Friday, 12/6.
1 Ch. 4 Linear Models & Matrix Algebra Matrix algebra can be used: a. To express the system of equations in a compact manner. b. To find out whether solution.
Advanced Trig Exam Review Day Three: Matrices. Solving Systems of Equations.
Class Opener:. Identifying Matrices Student Check:
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.
Circuits Theory Examples Newton-Raphson Method. Formula for one-dimensional case: Series of successive solutions: If the iteration process is converged,
Introduction to Matlab Part II 1Daniel Baur / Introduction to Matlab Part II Daniel Baur / Michael Sokolov ETH Zurich, Institut für Chemie- und Bioingenieurwissenschaften.
3.6 Solving Systems Using Matrices You can use a matrix to represent and solve a system of equations without writing the variables. A matrix is a rectangular.
4.7 Solving Systems using Matrix Equations and Inverses
Principal Component Analysis (PCA)
Linear Systems of Equations Iterative and Relaxation Methods Ax = b Marco Lattuada Swiss Federal Institute of Technology - ETH Institut für Chemie und.
GUIDED PRACTICE for Example – – 2 12 – 4 – 6 A = Use a graphing calculator to find the inverse of the matrix A. Check the result by showing.
1.7 Linear Independence. in R n is said to be linearly independent if has only the trivial solution. in R n is said to be linearly dependent if there.
Worksheet Answers Matrix worksheet And Matrices Review.
Math 1320 Chapter 3: Systems of Linear Equations and Matrices 3.2 Using Matrices to Solve Systems of Equations.
3.8B Solving Systems using Matrix Equations and Inverses.
Nonlinear Regression 1Michael Sokolov / Numerical Methods for Chemical Engineers / Nonlinear Regression Michael Sokolov ETH Zurich, Institut für Chemie-
Using Matrices to Solve a 3-Variable System
Use Inverse Matrices to Solve Linear Systems
PreCalculus Section 14.3 Solve linear equations using matrices
Daily Vocabulary Coefficient matrix Matrix of constants.
Use Inverse Matrices to Solve Linear Systems
Modeling of geochemical processes Linear system of differential equations J. Faimon.
Review Problems Matrices
Zero of a Nonlinear Function f(x) = 0
Zero of a Nonlinear System of Algebraic Equations f(x) = 0
Multiplicative Inverses of Matrices and Matrix Equations
Use Inverse Matrices to Solve 2 Variable Linear Systems
Matrix Solutions to Linear Systems
Find the area of the Triangle
Ch 9-10 Subsetting Ordering Array operations Iteration
Solving a System of Linear Equations
Numerical Analysis – Solving Nonlinear Equations
Matrices and Linear Equations
Presentation transcript:

Programming Tips: While Loops and Comparisons 1Daniel Baur / Numerical Methods for Chemical Engineerse Daniel Baur ETH Zurich, Institut für Chemie- und Bioingenieurwissenschaften ETH Hönggerberg / HCI F128 – Zürich

While Loops with limited Iterations In order to keep a while loop from iterating forever, use one of the following two schemes: 2Daniel Baur / Numerical Methods for Chemical Engineerse

Comparing Entire Vectors and Matrices The easiest way to compare two vectors or matrices is to do it directly: 3Daniel Baur / Numerical Methods for Chemical Engineerse

Addendum: Implicit Trapezoid Method If the Jacobian matrix is constant, there is no need to solve linear systems in the iteration equations: Where A can be calculated once using A = (I – h/2*J) \ (I + h/2*J); A = (I – h/2*J) \ (I + h/2*J); 4Daniel Baur / Numerical Methods for Chemical Engineerse