Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


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

1 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

2 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

3 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

4 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


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

Similar presentations


Ads by Google