(* Look for Information about ASCEND at the bottom of this page *) (* This example written by Krishnan Chittur (chitturk@uah.edu) Chemical Engineering Department, University of Alabama in Huntsville, Huntsville, AL 35899 (256) 890 6850 (V), (256) 890 6839 (FAX) *) (* Look at David Himmelblau's Text - Basic Principles and Calculations in Chemical Engineering, 6th Edition - page 121. You want to calculate a root of the equation x/(1.0 - x) - 5.0*ln( 0.4*(1.0 - x)/(0.4 - 0.5*x) ) + 4.45977 = 0.0; It appears from the book that this is a difficult equation to solve, the author points out that it "will converge to a solution only for initial guesses for x between 0.705 and 0.799". In the ASCEND model below, the equation is rearranged a bit to avoid all divisions - x is a fraction (so lies between 0 and 1.0), term_insidelog is some number - The equation so written and solved converges - easily - under ASCEND - quite impressive I'd say! By the way, if you DO NOT rearrange the equation and leave it as shown on page 121 (and as shown above) - it will not converge unless you identify a narrow range for the initial guesses for x *) REQUIRE "atoms.a4l"; MODEL hmpg121; x IS_A fraction; term_insidelog IS_A factor; eq1: x - 5.0*ln(term_insidelog)*(1.0 - x) + 4.45977*(1.0 - x) = 0.0; eq2: term_insidelog*(0.4 - 0.5*x) = 0.4*(1.0 - x); METHODS METHOD clear; x.fixed := FALSE; term_insidelog.fixed := FALSE; END clear; END hmpg121; (* This is written in the ASCEND Language ... ASCEND is an environment to pose modeling problems and solve the resulting equations in an object oriented fashion ... ASCEND is copyrighted by Carnegie Mellon University ... the project has been directed by Prof. Art Westerberg in the Chemical Engineering Department ...*) (* ASCEND is free software, released under GNU ... and you can get it from http://www.cs.cmu.edu/~ascend ... The software has been released WITH source code ... it compiles under Solaris, Linux and IRIX (SGI) ... thanks to the excellent job in putting the software together by the folks at CMU! ... and autoconf ... I have no idea of how people compiled things before ./configure ! *)