1 / 4

Programming Tips: While Loops and Comparisons

Programming Tips: While Loops and Comparisons. 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 . While Loops with limited Iterations.

shakti
Download Presentation

Programming Tips: While Loops and Comparisons

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Programming Tips:While Loops and Comparisons Daniel BaurETH Zurich, Institut für Chemie- und BioingenieurwissenschaftenETH Hönggerberg / HCI F128 – ZürichE-Mail: daniel.baur@chem.ethz.chhttp://www.morbidelli-group.ethz.ch/education/index Daniel Baur / Numerical Methods for Chemical Engineerse

  2. While Loops with limited Iterations • In order to keep a while loop from iterating forever, use one of the following two schemes: Daniel 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: Daniel 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); Daniel Baur / Numerical Methods for Chemical Engineerse

More Related