!About\n\nWelcome to the home page for //CBE 20258 Computer Methods in Chemical Engineering//. This is a required course for Sophomores majoring in Chemical and Biomolecular Engineering at the University of Notre Dame. The course provides an introduction to the mathematical, numerical, and computational techniques used to formulate and solve problems relevant to these disciplines.\n\nThese pages provides access to course information, lecture notes, and links to other resources.
[[Working with Slugs]]\n
\n!Anonymous Functions and Function Handles\nAnonymous functions and Function Handles are very useful constructions in Matlab. They involve the use of the {{{@}}} symbol, and provide a simple way to manipulate and work with functions in Matlab. \n\n!!Function Handles\nWe often use mathematical functions to describe important physical quantities in engineering applications . An example is the Antoine Equation describing the vapor pressure of a liquid as a function of temperature. Based the on the NIST Webbook data, for liquid water the vapor pressure [bar] as a function of temperature [K] is given by\n$$\slog_{10}(P) = 4.65430 - \sfrac{1435.264}{T - 64.848}$$\nHere is a straightforward Matlab function to implement this relationship:\n{{{\nfunction P = vp_h20(T)\n\n% Vapor pressure of water from Antoine's equation and data from the NIST Webbook.\n% T: Temperature [K]\n% P: Pressure [bar]\n%\n% Jeffrey Kantor\n% February 14, 2007\n\nif (T >= 255.8) & (T <= 373)\n log10P = 4.6543 - 1435.264./(T - 64.848);\n P = 10.^log10P;\nelse\n error('Temperature out of the range of experimental data.');\nend\n}}}\nAs an aside, notice this function was carefully written so that it could accept either scalar or vector arguments for temperature. All that was needed to do this is to add a {{{./}}} in the expression for the Antoine Equation, and a {{{.^}}} when converting the logarithm. This is generally good practice in Matlab because it makes your functions much more versatile. For example, to find the vapor pressure at room temperature (converting to psia)\n{{{\n>> 14.5*vp_h20(25+273.15) % 14.5 psi/bar\n\nans =\n\n 0.4610\n}}}\nBecause it's written to accept a vector argument, we can construct a plot of vapor pressure in a single line of Matlab code:\n{{{\n% Construct a plot of Vapor Pressure\nt = 0:100;\nh = plot(t,vp_h20(t+273))\n\n% Label and dress up for presentation quality\ntitle('Vapor Pressure of Water');\nxlabel('Temperature [C]');\nylabel('Pressure [bar]');\nset(h,'LineWidth',2)\ngrid\n}}}\nwhich produces the graphic\n{{tablecenter{\n<html>\n<object type="image" data="images/vp_h20.tif" width=500 height=400></object>\n</html>\n}}}\n\nFunction handles allow us to use this function for the vapor pressure of water in different ways. For example, suppose we wanted to compute the integral of the vapor pressure as a function of temperature,\n$$\sint_{T_1}^{T_2} P(T) dT$$\nThe Matlab function {{{quad{f,a,b}}} will do this for us if we pass it a function handle {{{f}}}, a lower bound {{{a}}} and an upper bound {{{b}}}. The function handle to our to our vapor pressure function is {{{@vp_h20}}}. So, for example, the area under the curve above is given by\n{{{\n>> quad(@vp_h20, 273, 100+273)\n\nans =\n\n 24.2298\n}}}\nThe beauty of using function handles is that you can manipulate functions under program control.\n\n!!Anonymous Functions\nYou don't need to write an .m file to create a function. That's where anonymous functions come in. Using the {{{@}}} character, we simply declare a list of arguments, then give a matlab expression for evaluating the desired result.\n\nFor example, we could write the Antoine Equation as an anonymous function as the one-line expression\n{{{\nvp_h20 = @(T) 10.^(4.6543 - 1435.264./(T - 64.848));\n}}}\nBecause we're restricting ourselves to just one line of code, we can't build in the error checking that is used in the .m file. Still, this is an extraordinarily useful feature for many applications.\n\nTo illustrate, suppose we wished to compute the temperature at which the vapor pressure was 0.5 bars. Obviously this is a problem of finding the root to the equation (in Matlab notation) {{{0.5 = vp_h20(T)}}} where {{{vp_h20(T)}}} is given by either a .m file or by an anonymous function as explained above. Since the function {{{fzero(f,a)}}} computes the root of a function given a handle to the function {{{f}}} and an initial starting guess {{{a}}}, we find the answer to our problem with\n{{{\n>> fzero(@(T)(0.5-vp_h20(T)),300)\n\nans =\n\n 354.4884\n}}}\nwhich is 354.5K or 81.5 degrees C.
<!--{{{-->\n<div class='toolbar' macro='toolbar +saveTiddler -cancelTiddler deleteTiddler'></div>\n<div class='title' macro='view title'></div>\n<div class='editor' macro='edit title'></div>\n<div class='editor' macro='edit text'></div>\n<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div>\n<!--}}}-->
<<tiddler MainMenu>>\n\nAuthorMainMenu\nMainMenu\nDefaultTiddlers\nPluginManager\nPresentationIndex\n[[Documentation]]\n[[Dummy Presentation|DummyTiddler1]]
<!--{{{-->\n<div id='header' class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>\n<div class='headerShadow'>\n<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;\n<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>\n</div>\n<div class='headerForeground'>\n<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;\n<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>\n</div>\n</div>\n<div id='mainMenu' refresh='content' tiddler='AuthorMainMenu'></div>\n<div id='sidebar'>\n<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>\n<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>\n</div>\n<div id='displayArea'>\n<div id='messageArea'></div>\n<div id='tiddlerDisplay'></div>\n</div>\n<!--}}}-->
/***\nPlace your custom CSS here\n***/\n/*{{{*/\n\n\n[[StyleSheetCommon]]\n/*}}}*/\n
<!--{{{-->\n<div class='toolbar' macro='toolbar closeTiddler closeOthers +editTiddler permalink references jump'></div>\n<div class='title' macro='view title'></div>\n<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date [[DD MMM YYYY]]'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date [[DD MMM YYYY]]'></span>)</div>\n<div class='tagging' macro='tagging'></div>\n<div class='tagged' macro='tags'></div>\n<div class='viewer' macro='view text wikified'></div>\n<div class='viewer topbutton' macro='top'></div>\n<br><br>\n<div class='viewer' macro='navigation tiddlers:{{store.getTiddlerText("PresentationIndex").readBracketedList()}}}'></div>\n<div class='tagClear'></div>\n<!--}}}-->
Story.prototype.refreshTiddler_activelink = Story.prototype.refreshTiddler;\nStory.prototype.refreshTiddler = function (title,template,force)\n{\n var theTiddler = Story.prototype.refreshTiddler_activelink.apply(this,arguments);\n if (!theTiddler)\n return theTiddler\n var menu = document.getElementById("mainMenu");\n var links = menu.getElementsByTagName("a");\n for (var i=0; i<links.length; i++)\n {\n if (!links[i].getAttribute("tiddlyLink"))\n return;\n if (document.getElementById(this.idPrefix+(links[i].getAttribute("tiddlylink"))))\n addClass(links[i],"bold");\n else\n removeClass(links[i],"bold");\n }\n return theTiddler;\n}
!Numerical Solution of Chemical Equilibria Problems\nComputing solutions for chemical reaction equilibrium problems is one of the hallmarks of chemical engineering. It is a task with a wide range of important technological applications, and also full of computational challenges.\n\nBelow we outline a framework for formulating problems suitable for gas phase reactions which, with care, can yield effective numerical solutions. Though it will not be discussed here, with additional work the same framework extends to wide variety of situations beyond gas phase equilibria. This area has attracted much reseach interest, and the interested student will find a rich literature with many alternatives to the techniques outlined below.\n\n<<slideShow style:"SlideShowStyleSheet">>\n\n-s-\n!Formulation\nConsider a single reaction in the gas phase.\n$$a A + b B \sLeftrightarrow c C+ d D$$\nwhere the upper case $A, B, C, D$ denotes chemical species, and the lower case $a,b,c,d$ are the ''stoichiometic coefficients''.\n\n-s-\n!Equilibrium\nFor gas phase reactions under assumptions of ideal behavior, at equilibrium the partial pressure of the chemical species involved in the reaction satisfies an equation\n$$K_{eq} = \sfrac{P_C^cP_D^d}{P_A^aP_B^b}$$\nwhere $K_{eq}$ is the ''equilibrium constant''. The equilibrium constant is a function of temperature. \n\n-s-\nUnder ideal gas assumptions, the partial pressure $P_j$ of species $j$ is related to mole fraction by $$P_j = y_jP$$ where $P$ is the total pressure. Mole fraction, in turn, is related to the number of moles present by $$y_j = \sfrac{n_j}{\ssum_{k=1}^S n_k}$$ where $S$ is total number of species present.\n\n-s-\n!Extent of Reaction\nThe chemical reaction has the net effect of transforming one set of chemical species into another. Thus the number of moles of each species changes to due to the reaction. We use the variable $x$ to denote ''extent of reaction''. For species on the left side of the reaction, we have\n$$\sbegin{eqnarray}\nn_A & = & n_A^f - a x \s\s\nn_B & = & n_B^f - b x\n\send{eqnarray}$$\nwhere $a,b$ are the stoichiometric coefficients, $n_A, n_B$ are the moles of $A$ and $B$ present at equilibrium, and $n_A^f, n_B^f$ are the initial moles of $A$ and $B$.\n\n-s-\nWe have, for species appearing on the right hand side of the reaction,\n$$\sbegin{eqnarray}\nn_C & = & n_C^f + c x \s\s\nn_D & = & n_D^f + d x\n\send{eqnarray}$$\nOur convention is that positive values of $x$ correspond to the consumption of species on the left side of the reaction to produce species on the right hand side. This convention determines the signs appearing in these mole balance equations.\n\n-s-\nWe can conveniently represent the mole balance expressions in vector form as\n$$n = n^f + A x$$\nwhere\n$$n = \sleft[\sbegin{array}{c}n_A \s\s n_B \s\s n_C \s\s n_D \send{array}\sright]\n\sqquad\nn^f = \sleft[\sbegin{array}{c}n_A^f \s\s n_B^f \s\s n_C^f \s\s n_D^f \send{array}\sright]\n\sqquad\nA = \sleft[\sbegin{array}{c}-a \s\s -b \s\s c \s\s d \send{array}\sright]\n$$\nLater, when we deal with the case of multiple reactions, we will call $A$ the ''stoichiometric matrix''.\n\n-s-\n!Numerical Solution\nTo summarize, we are given a chemical reaction\n$$a A + b B \sLeftrightarrow c C+ d D$$\nwith known equilibrium constant $K_{eq}$, pressure $P$, an initial 'feed' composition $n_A^f, n_B^f, n_C^f, n_D^f$.\n\nOur task is to compute the equilibrium composition $n_A, n_B, n_C, n_D$ at the same temperature and pressure subject to the following equations\n$$\sbegin{eqnarray}\nn & = & n^f + A x \s\s\nK_{eq} & = & \sfrac{P_C^cP_D^d}{P_A^aP_B^b}\n\send{eqnarray}$$\nwhere for each $ j \sin \s{A, B, C,D \s}$\n$$\sbegin{eqnarray}\nP_j & = & y_j P \s\s\ny_j & = & \sfrac{n_j}{\ssum_j n_j} \send{eqnarray}$$\n\n-s-\n!Solving for Extent of Reaction\nFor the case of a single reaction, the extent of reaction, $x$, is a single variable. Our solution strategy is to manipulate our problem to form a single algebraic equation for the unknown $x$. \n\nFor convience, we set $n_T = \ssum_{j \sin \s{A, B, C, D\s}} n_j$. For this expression we have\n$$n_T = \ssum_j n_j^f + (-a - b + c + d)x$$\nand\n$$K_{eq} = \sfrac{P^{(-a - b + c + d)}}{n_T^{(-a - b + c + d)}}\sfrac{(n_C^f + c x)^c (n_D^f + d x)^d}{(n_A^f - a x)^a(n_B^f - b x)^b}$$\n\nSubstituting $n_T$ into the equilibrium expression gives us the single equation we are seeking.\n\n-s-\nThe quantity\n$$\salpha = (-a -b + c + d)$$\nrepresents the net number of molecules produced by the reaction. If $\salpha = 0$, then the number of molecules remains unchanged during the course of the reaction, and the terms \n$$P^{(-a - b + c + d)} = P^0 = 1$$\nand \n$$n_T^{(-a - b + c + d)} = n_T^0 = 1$$\nwhich simplifies the equation to be solve. \n\nIf $\salpha > 0$, then there is a net production of molecules. In this case, increasing the pressure tends to reduce the extent of reaction (Why?). This is an example of the well-known ''Le Chatelier's Principle''.\n\n-s-\n!Example (Finlayson, Chapter 4, p. 43)\nThe Finlayson textbook uses the ''Water Gas Shift'' reaction to illustrate the numerical solution of equilbrium problems involving one reaction. \n$$CO + H_2O \sLeftrightarrow CO_2 + H_2$$\nCiting thermodynamic data, the Finlayson text gives the equilibrium constant at 500K as 148.4, that is\n$$K_{eq} = \sfrac{P_{CO_2}P_{H_2}}{P_{CO}P_{H_2O}}$$\nThe stated problem is to compute the equilibrium composition for the water gas shift assuming one starts with an stoichiometric ratio of $CO$ and $H_2O$.\n\n-s-\n!Solution\nFrom the problem data, $CO$ and $H_2O$ are present in a one-to-one mole ratio. To fix scale, we'll assume one mole of each. The expressions for the equilbrium composition are then\n$$\sbegin{eqnarray}\nn_{CO} & = & 1 - x \s\s\nn_{H_2O} & = & 1 - x \s\s\nn_{CO_2} & = & x \s\s\nn_{H_2} & = & x\n\send{eqnarray}$$\n\n-s-\nSince the sum of stoichometric coefficients is zero,\n$$K_{eq} =\s \sfrac{(n_C^f + x) (n_D^f + x)}{(n_A^f - x)(n_B^f - x)}$$\nPlugging in problem data\n$$148.4 =\s \sfrac{(x)(x)}{(1-x)(1-x)}$$\nThis is easily solved with a call to {{{fzero}}}.\n\n-s-\nThe only sublety is the choice of initial solution estimate. Since we know that the extent of reaction must be in the range $ 0 < x < 1$ (Why?), so we choose 0.5.\n{{{\n>> fzero(@(x)(148.4 - x^2/(1-x)^2),0.5)\n\nans =\n 0.9241\n}}}\n\n\n\n
The tiddler 'New Tiddler' doesn't yet exist. Double-click to create it
config.options.chkAnimate = false;\nconfig.options.chkSinglePageMode = true;\nconfig.options.chkTopOfPageMode = false;
\n{{tablecenter{\n|>|!CBE 20258 Computer Methods in Chemical Engineering|\n|Course Title|Computer Methods in Chemical Engineering|\n|Course Number|CBE 20258|\n|Schedule|8:30 MWF<br>356 Fitzpatrick Hall|\n|Credits|Three|\n|Instructor|Jeffrey Kantor<br>Professor of Chemical & Biomolecular Engineering|\n|Prerequisites|Linear Algebra, Differential Equations, either as pre- or co-requisite. Thermodynamics, Mass and Energy Balances, and a working proficiency with Matlab. The course level is intended for undergraduate sophomores majoring in Chemical & Biomolecular Engineering|\n}}}
<<slideShow style:"SlideShowStyleSheet">>\n-s-\n!Course Information\n<<tiddler [[Course Information]]>>\n-s-\n!Office Hours\n<<tiddler [[Office Hours & Teaching Assistants]]>>\n-s-\n!Learning Goals\n<<tiddler [[Learning Goals]]>>\n-s-\n!Textbook\n<<tiddler [[Textbook]]>>\n-s-\n!Software\n<<tiddler [[Software]]>>\n-s-\n!Course Outline\n<<tiddler [[Course Topics]]>>\n-s-\n!Learning Activities\n<<tiddler [[Learning Activities]]>>\n-s-\n!Student Evaluations\n<<tiddler [[Student Evaluations]]>>\n-s-\n!Course Schedule\n<<tiddler [[Schedule]]>>\n\n
\n(October, 2006):\nRefined outline\n* Introduction to Computational Environments\n** Matlab\n** Spreadsheets\n** Simulink\n** Maple\n* Modeling, computers, and error analysis\n* Equation solving\n* Introduction to numerical linear algebra\n* Optimization, including linear programming\n** Algebraic Modeling Languages (e.g., AMPL)\n** Spreadsheet methods\n* Statistics, Regression, and Least Squares\n* Ordinary Differential Equations\n* Partial Differential Equations (if time permits).\n\n(June, 2006):\n\nThe course provides an introduction to computational methods for chemical engineering with application to process systems. Topics include:\n# Introduction to Engineering Computation\n## Computational Skills as an element of problem solving\n### Data + Methods/Techniques + Problem $\sRightarrow$ Engineering Solution\n### Role of computation in the CBE curriculum\n### Role of computation is professional development\n## Overview of Tools used in this course\n### Excel\n### Matlab โ€“ Matrix Oriented Computation\n# Working with Data\n## Entering, Editing, saving, and loading data\n## Importing Data\n### Example: Importing laboratory data from a file\n### Transferring spreadsheets between Matlab and Excel\n### Images as data\n## Accessing on-line information\n### Example: Yahoo financials\n### Example: NIST Webbook โ€“ Physical Properties\n### Example: Bioinformatic databases\n## Relational Databases\n### Example: DIPPR\n### Laboratory Data Management\n## XML\n### Example: ThermoML\n## Visualizing data\n## Managing and summarizing data\n# Modeling, computers, and error analysis\n## Floating point arithmetic\n## Error analysis and propogation\n# Equation solving\n## Applications\n### Thermodynamic Equilibrium\n### Bubble/Dew point calculations\n### Computing Internal Rate of Return\n# Introduction to numerical linear algebra\n# Optimization, including linear programming\n## Algebraic Modeling Languages: AMPL (or MathProg)\n## Applications\n### Transport\n# Statistics, Regression, and Least Squares\n## Applications\n### Data fitting โ€“ CBE Laboratory Example\n### Particle imaging velocimetry experiment (http://www.nd.edu/~dtl/cheg459/pivexperiment/) \n# Quadrature & Ordinary Differential Equations\n## Applications\n### Quadrature for tubular reactors\n### Multicomponent reactions using vector/matrix formulation\n### Transport problems\n### Ecology/Environmental modeling\n# Partial Differential Equations (if time permits)\n
[[About]]
\nSee it in action here: http://lewcid.googlepages.com/tots.html\n\n!!Editing this TW:\nOpen the TW with #author:true at the end of the url/file location to enable editing.\nPreview edits by using the "Presentation Mode" button in the MainMenu\n//(To make future editing easier, bookmark the file with #author:true at the end of the file name. One click and edit!)//\n\n!!Changing the content and order of the presentation:\nEdit the PresentationIndex tiddler to change the contents and order of the presentation.\n\n!! Customizing the default (viewing) interface.\nEdit the following tiddlers as needed:\n*PageTemplate\n*StyleSheet\n*ViewTemplate\n*EditTemplate\n*MainMenu\n\n!!Customizing the editing (author's) interface.\nEdit the following tiddlers as needed: //(Note that these files are optional, if any of them dont exist, the standard viewing one will be used instead. So if you only want to change the PageTemplate, you only need an AuthorPageTemplate tiddler.)//\n*AuthorPageTemplate\n*AuthorStyleSheet\n*AuthorViewTemplate\n*AuthorEditTemplate\n*AuthorMainMenu\n\n!!Using a different stylesheet or theme:\nUsing your own favorite stylesheet or theme is as simple as importing those tiddlers into this file.\nIf you are changing the presentation interface, just import the PageTemplate and StyleSheet. If you want to change the editing interface, you will need to copy over the PageTemplate and StyleSheet as AuthorPageTemplate and AuthorStyleSheet respectively.\n\n!!Other tips:\n* Use the tiddler StyleSheetCommon and include it using {{{[[StyleSheetCommon]]}}} in your StyleSheet and AuthorStyleSheet when making stlyesheet changes that you want applied to both the presentation and editing interface, to avoid having to type it out twice!\n*To provide easy control over the font-size, use the FontSizePlugin: http://lewcid.googlepages.com/lewcid.html#FontSizePlugin\n* If this presentation is going to be placed online, you might want to have a splash screen that displays while the TW is loading: http://lewcid.googlepages.com/lewcid.html#SplashScreenPlugin
!Dummy Tiddler 3\n\ndummy tiddler three
!Dummy Tiddler1\n\nThis is the first tiddler of your dummy presentation\n\nEdit the PresentationIndex tiddler to change the contents and order of the presentation.\n
!DummyTiddler2\n\nThis is the second tiddler of your dummy presentation
!Equation Solving by Newton's Method\n\nThese notes augment the textbook's discussion of multivariable equation solving. Our goal here is to provide mathematical background on solving systems of nonlinear algebraic equations by ''Newton's Method.'' This background will help you formulate problems for effective solution using standard software tools, and provide you some insight in diagnosing problems when things go wrong.\n\n!!Systems of Nonlinear Algebriac Equations\n\nYou have already formulated and solved problems involving single algebraic equations in a single unknown. For example, the [[Rachford-Rice|Vapor-Liquid Equilibrium]] equation\n$$\ssum_{i=1}^N \sfrac{(K_i - 1)z_i}{1 + (K_i - 1)x} = 0$$\nprovides an expression from which we can compute the phase fraction $x$ in an isothermal flash given data for $K_i$'s and $z_i$'s. Representing the left-hand side of this equation by $f(x)$, the task is to find value(s) of $x$ which satisfy $$f(x) = 0$$ Simple plots often provide considerable insight into the nature of single variable problems, and solutions can be found using a variety of robust numerical techniques, including bisection, Regula-Falsi, Secant, and Newton-Raphson iteration.\n\nProblems involving multiple equations equations in multiple unknowns can be considerably more challenging. For one thing, its usually difficult to visualize the full complexity of these problems with simple. Thus we are more dependent on algebraic methods. In addition, we are generally interesting in solving problems with 10's, 100's, and even 1000's of variables and equations. Thus we also need to have the mathematical and programming tools necessary to analyze and manipulate problems with this level of complexity.\n\n!!Example\n\nTo illustrate some basic concepts, the Finlayson textbook offers the following example (Eq. 4.17, page 48): which consists of two equations in the two unknowns, $x$ and $y$\n$$\sbegin{eqnarray}10 x + 3y^2 & = & 3 \s\s x^2 - \sexp(y) & = & 2\send{eqnarray}$$\nIn setting out to solve these equations, we are attempting to find values for $x$ and $y$ which cause both expressions evaluate to zero.\n\nTreating the equations separately, we can trace out contours in the $x-y$ plane where each equation is satisfied as illustrated in the following plot:\n{{tablecenter{\n<html>\n<object type="image" data="images/eqsolve01.tif" width=500 height=400></object>\n</html>\n}}}\nThe solution we seek is the intersection of these curves where both equations are simultaneously satisfied. In this case we see one such intersection. In general there may be no solution, a single unique solution, or even multiple solutions.\n\n!Some Notation\n\nTo
{{tablecenter{\n!Midsemester Examination #1\n\nCBE 20258\nComputer Methods in Chemical Engineering\nProf. Jeffrey Kantor\n\nFebruary 16, 2007\n}}}\n''Instructions:'' This is an open-book, 50 minute examination. Please take a minute to read over these instructions and problems so that you can allocate your time appropriately. This examination, like all aspects of this course, is administered in accordance with the Notre Dame Academic Code of Honor. To that end,\n** Please read and sign the pledge on the cover of your blue book.\n** Please refrain from any conversation or conduct that could be potentially miscontrued as unethical conduct.\n** I will be present initially to answer any questions. I will return about midway through the examination to respond to additional questions that may arise, and again at the end to collect the blue books. If you need to reach me during the exam, please text me or call me on my cell at 574-532-4233.\n\n1. Antoine's equation is used to model the vapor of a liquid as a function of absolute temperature.\n$$\slog(P) = A - \s \sfrac{B}{T+C}$$\nThe boiling point of a liquid is that temperature which results in the vapor pressure equal to the ambient pressure. The following code fragment assigns values for the ambient pressure {{{Pa}}}, and the Antoine coefficients {{{A, B, C}}}.\n{{{\nA = 4.654;\nB = 1465.3;\nC = -64.8;\nPa = 0.85; % bars\n}}}\n## Setup a function $f(T) = 0$ with a root that specifies the desired boiling point.\n## Prepare a Matlab code fragment that solves for the boiling point using a solver (e.g., {{{fzero}}}).\n## Prepare a Matlab code fragment that iteratively solves for the boiling boiling point by your choice of method bisection, Regula-Falsi, or Newton-Raphson method. Your Matlab code should be correct, though there will be no deduction for ''minor'' syntax errors (like missing commas, semi-colons). You might notice that Antoine's equation can be solved analytically. That's not what we're looking for here. \n\n2. In Homework 2, you had an opportunity to work with the Colebrook equation\n$$\sfrac{1}{\ssqrt{f}} = -2\slog_{10}\sleft(\sfrac{e/D}{3.7} + \sfrac{2.51}{R\ssqrt{f}}\sright)$$\nwhich needs to be solved for the friction factor, $f$. One method of solving this equation is to begin with a starting guess for $f$, then plug that into the right hand side, then evaluate the right hand to obtain an updated value of $f$. This actually converges quite rapidly in practice. We wish to exploit this fact in developing a code requiring the calculation of friction factors.\n\n** Write a mathematical expression for an appropriate convergence criterion.\n** Write a Matlab code fragment to implement an algorithm incorporating your convergence criterion. (If you have trouble formulating a convergence criterion, just indicate in the code fragment where it would it would be used.)\n\n3. A automobile catalytic converter has the challenging task of reducing nitrogen oxides to molecular nitrogen while at the same time oxidizing crrbon monoxide and unburned hydrocarbons. Consider the model system\n$$\sbegin{eqnarray}\nNO_2 + 2 CO & = & \sfrac{1}{2}N_2 + 2CO_2 \s\s\nCO + \sfrac{1}{2}O_2 & = & CO_2 \s\s\nC_8H_{10} + \sfrac{21}{2}O_2 & = & 8CO_2 + 5H_2O\n\send{eqnarray}$$\n**Write the molecular and stoichiometic matrices for this reaction. \n**Write material balance equations as a function of the extents of reaction.\n\n\n
\n!!You should review your mastery of the following topics for Exam 1:\n# Matlab Coding\n## Basic syntax.\n*** Scalar and vector variables.\n*** Manipulation of vectors and matrices, and working with vectors of data directly rather than implementing {{{for}}} loops.\n*** Function definitions, passing data to and from functions\n*** Function handles (i.e., anonymous functions)\n## Problem solving in Matlab\n*** Equation solving with {{{fzero}}}\n*** Implementing basic algorithms, e.g., bisection\n# Single Variable Equation Solving\n## Solution Algorithms. (Should be able to code).\n*** Bisection\n*** Regula-Falsi, Secant (what is the distinction?)\n*** Newton-Raphson\n## Chemical Engineering Applications\n*** Equations of State\n*** Isothermal Flash\n*** Chemical Equilibria\n**** Single reaction\n**** Atomic/Molecular matrix\n**** Stoichiometric Matrix\n**** Mathematical Formulation of the multiple reaction case\n## Measuring convergence\n*** Testing for convergence\n*** Plotting convergence\n# Multivariable Equation Solving\n## Setting up a given problem for numerical solution\n## Use of {{{mmfsolve}}} analogous to Finlayson, Chapter 4.\n\n!!Exam Format\n* 3-4 problem solving exercises.\n* At least one problem will require you to evaluate a matlab code fragment, or write (in long-hand) a matlab code fragment.\n* Several of the problems will require you to manipulate equations arising from chemical engineering applications putting them in a form appropriate for numerical solution. \n* Potential problems include\n** demonstrating the application of a single variable solution technique by executing (by hand) one step of a specified solution technique.\n** writing an appropriate convergence criterion for a specific problem\n** showing a piece of matlab code that purports to implement a specific algorithm, and asking you to diagnose possible sources of errors.\n\n!!Sample Problems from the Textbook\n# Finlayson 2.5\n# Finlayson 3.1\n# Finlayson 4.2\n
{{tablecenter{\n!Midsemester Examination #2\n\nCBE 20258\nComputer Methods in Chemical Engineering\nProf. Jeffrey Kantor\n\nApril 4, 2007\n}}}\n''Instructions:'' This is an open-book, 50 minute examination. Please take a minute to read over these instructions and problems so that you can allocate your time appropriately. This examination, like all aspects of this course, is administered in accordance with the Notre Dame Academic Code of Honor. To that end,\n** Please read and sign the pledge on the cover of your blue book.\n** Please refrain from any conversation or conduct that could be potentially miscontrued as unethical conduct.\n** I will be present initially to answer any questions. I will return about midway through the examination to respond to additional questions that may arise, and again at the end to collect the blue books. If you need to reach me during the exam, please text me or call me on my cell at 574-532-4233.\n\n1. "Langmuir - Hinshelwood Kinetics." The rate of many chemical and biochemical reactions behave according to the Langmuir - Hinshelwood expression\n$$ R = \sfrac{K_1 C}{K_2 + C}$$\nwhere $R$ is reaction rate, $C$ is concentration, and $K_1$, $K_2$ are constants determined from experimental data. Suppose you are given the following data:\n{{tablecenter{\n|! $C$ |! $R$ |\n| 0.1 | 2 |\n| 0.2 | 1.667 |\n| 0.5 | 1.25 |\n| 1 | 1 |\n| 2 | 0.5 |\n}}}\n## The model equation becomes linear in coefficients if you express $1/R$ as a function of $1/C$. Set up the least squares problem in the form $$A x = b$$ where $A$ and $b$ contains the experimental data, and $x$ contain the constants to be determined.\n## Compute $A^TA$ and $A^Tb$. I'm not looking for a final numerical solution, so no need to compute a matrix inverse.\n----\n''Solution (a)''\nComputing $1/R$ one obtains $$\sfrac{1}{R} = \sfrac{K_2}{K_1} \sfrac{1}{C} + \sfrac{1}{K_1}$$ which is linear in the coefficients $\sfrac{K_2}{K_1}$ and $\sfrac{1}{K_1}$. Setting this up in the form $Ax = b$ yields\n$$\sleft[\sbegin{matrix}10 & 1 \s\s 5 & 1 \s\s 2 & 1 \s\s 1 & 1\s\s 0.5 & 1 \send{matrix}\sright] \sleft[\sbegin{matrix}\sfrac{K_2}{K_1} \s\s \sfrac{1}{K_1} \send{matrix}\sright] = \sleft[\sbegin{matrix}0.5\s\s0.6\s\s0.8\s\s1\s\s2\send{matrix}\sright]$$ where $$A = \sleft[\sbegin{matrix}10 & 1 \s\s 5 & 1 \s\s 2 & 1 \s\s 1 & 1\s\s 0.5 & 1 \send{matrix}\sright] \sqquad x = \sleft[\sbegin{matrix}\sfrac{K_2}{K_1} \s\s \sfrac{1}{K_1} \send{matrix}\sright] \sqquad b = \sleft[\sbegin{matrix}0.5\s\s0.6\s\s0.8\s\s1\s\s2\send{matrix}\sright]$$\n''Solution (b)''\n$$A^TA = \sleft[\sbegin{matrix}10 & 5 & 2 & 1 & 0.5 \s\s1 & 1 & 1 & 1 & 1 \send{matrix}\sright]\sleft[\sbegin{matrix}10 & 1 \s\s 5 & 1 \s\s 2 & 1 \s\s 1 & 1\s\s 0.5 & 1 \send{matrix}\sright] = \sleft[\sbegin{matrix}130.25 & 18.5 \s\s18.5 & 5\send{matrix}\sright]$$\n$$A^Tb = \sleft[\sbegin{matrix}10 & 5 & 2 & 1 & 0.5 \s\s1 & 1 & 1 & 1 & 1 \send{matrix}\sright]\sleft[\sbegin{matrix} 0.5\s\s0.6\s\s0.8\s\s1\s\s2\send{matrix}\sright] = \sleft[\sbegin{matrix}11/6 \s\s 4.9\send{matrix}\sright]$$\n----\n\n2. "Singular Value Decomposition." You are given a stoichiometric matrix\n$$A = \sleft[\sbegin{matrix}\n2 & 2 \s\s\n1 & -1\s\s\n0 & 0 \n\send{matrix}\sright]$$\n##Show by direct calculation that $\ssigma_1 = \ssqrt{2}$ and $v_1 = \sleft[\sbegin{matrix}\sfrac{1}{\ssqrt{2}} \s\s -\sfrac{1}{\ssqrt{2}}\send{matrix}\sright]$ is a singular value/singular vector pair.\n## Compute\n### $|| v_1 ||_2$\n### $|| v_1 ||_1$\n### $|| v_1 ||_\sinfty$\n## What is $v_2$? (Hint: Recall the properties of the singular vectors. What is the relationship between $v_1$ and $v_2$?).\n----\n''Solution (a)''\nTo show that $v_1$ and $\ssigma_1$ are a singular value/singular vector pair, we need to show they satisfy the equation $$A^TAv_1 = \ssigma_1^2v_1$$By direct calculation $$A^TA = \sleft[\sbegin{matrix}2 & 1 & 0 \s\s2 & -1 & 0\send{matrix}\sright]\sleft[\sbegin{matrix}2 & 2 \s\s1 & -1 \s\s 0 & 0 \send{matrix}\sright] = \sleft[\sbegin{matrix}5 & 3 \s\s 3 & 5\send{matrix}\sright]$$\nPlugging in, we see that $$A^TAv_1 = \sleft[\sbegin{matrix}5 & 3 \s\s 3 & 5\send{matrix}\sright]\sleft[\sbegin{matrix}\sfrac{1}{\ssqrt{2}} \s\s -\sfrac{1}{\ssqrt{2}}\send{matrix}\sright] = \sleft[\sbegin{matrix}\ssqrt{2} \s\s -\ssqrt{2}\send{matrix}\sright]$$\nand $$\ssigma_1v_1 = 2 \sleft[\sbegin{matrix}\sfrac{1}{\ssqrt{2}} \s\s -\sfrac{1}{\ssqrt{2}}\send{matrix}\sright] = \sleft[\sbegin{matrix}\ssqrt{2} \s\s -\ssqrt{2}\send{matrix}\sright]$$ which demonstrates the desired result.\n''Solution (b)''\n$$\sbegin{eqnarray}\n|| x ||_2 = \ssum_{i=1}^n x_i^2 & \sRightarrow & \n|| v_1 ||_2 = \ssqrt{\sfrac{1}{2} + \sfrac{1}{2}} = 1\s\s\n|| x ||_1 = \ssum_{i=1}^n |x_i| & \sRightarrow &\n|| v_1 ||_1 = \sfrac{1}{\ssqrt{2}} + \sfrac{1}{\ssqrt{2}} = \ssqrt{2}\s\s\n|| x ||_\sinfty = \smax_i|x_i| & \sRightarrow &\n|| v_1 ||_\sinfty = \sfrac{1}{\ssqrt{2}}\n\send{eqnarray}$$\n''Solution (c)''\nThe singular vectors are orthogonal to one another, thus $$v_1^Tv_2 = 0$$. By inspection, $$v_2 = \sleft[\sbegin{matrix}\sfrac{1}{\ssqrt{2}} \s\s \sfrac{1}{\ssqrt{2}}\send{matrix}\sright]$$You could obtain this result in many different ways, for example by sketching $v_1$ in the $x-y$ plane and looking for a vector normal to $v_1$, or by solving for values of two coefficients making up the entries of $v_2$.\n----\n\n3. Suppose you are given a Matlab function {{{x = fmings(f,a,b)}}} that executes a Golden Section search for a ''minimum'' where {{{f}}} is a function handle, and {{{a,b}}} define a starting interval. You are also given a reaction rate expression\n$$r(C) = \sfrac{K_1 C}{1 + K_2 C + K_3 C^2}$$\nwhich you wish to ''maximize.'' Write a Matlab code fragment(s) which \n## Properly finds an initial starting interval.\n## Incorporates the rate expression as a separate matlab function\n## Which executes the desired calculation.\n----\n''Solution (a)''\nThe starting interval are two values of $C$ which bound the maximum. $r(C)$ is zero when $C=0$. Starting at this point, we simply march forward until examining values of $r(C)$ until we find one that decreases. Here's one way to do this in Matlab:\n{{{\nc = 0;\ndc = 0.05;\nwhile (rate(c+dc) >= rate(c))\n c = c + dc\nend\nc = c + dc;\n}}}\n''Solution (b)''\nThe suitable Matlab function might be\n{{{\nfunction r = rate(c)\nK1 = 1; K2 = 1; K3 = 1;\nr = K1*c/(1 + K2*c + K3*c*c);\n}}}\n''Solution (c)''\nThe easiest method is to use the interval found in part (a), and negative of the function from part (b) as follows \n{{{\nfmin_gs(@(c)-rate(c), 0, c)\n}}}\nSome of you minimized the inverse of the rate, that is $1/rate(c)$. That will also work in this case, but you would need to have an interval not starting at zero. So in that case\n{{{\nfmin_gs(@(c)1/rate(c), dc, c)\n}}}\n----\n\n
\n!!You should review the following topics for Exam 2:\n# Optimization\n## Golden Section Searching\n## Measuring convergence\n# Multivariable Equation Solving\n## Setting up a given problem for numerical solution\n## Sequential Solution and convergence\n## Linear Systems of Equations\n## Least Squares Solution \n# Singular Value Decomposition\n## Singular values as eigenvalues of $A^TA$\n## Singular vectors\n## Orthogonality\n\n!!Exam Format\n* 3-4 problem solving exercises.\n* At least one problem will require you to evaluate a matlab code fragment, or write (in long-hand) a matlab code fragment.\n* Potential problems include\n** setting up an optimization problem for numerical solution\n** writing an appropriate convergence criterion for a specific problem\n** setting up a least squares data fitting problem\n** recreating a mathematical derivation in least squares analysis, or singular value analysis\n\n!! Textbook References\n# Chapter 5\n# Appendix E - Parameter Estimation\n
!Exercises\n\n''The following exercises were developed by Professor David Leighton while teaching Cheg 258 during the period 1996-2001.''\n\n#<<tiddler exercise_001>>\n#<<tiddler exercise_002>>\n#<<tiddler exercise_003>>\n#<<tiddler exercise_004>>\n#<<tiddler exercise_005>>\n#<<tiddler exercise_006>>\n#<<tiddler exercise_007>>\n#<<tiddler exercise_008>>\n#<<tiddler exercise_009>>\n#<<tiddler exercise_010>>\n#<<tiddler exercise_011>>\n#<<tiddler exercise_012>>\n#<<tiddler exercise_013>>\n#<<tiddler exercise_014>>\n#<<tiddler exercise_015>>\n#<<tiddler exercise_016>>\n#<<tiddler exercise_017>>\n#<<tiddler exercise_018>>\n#<<tiddler exercise_019>>\n#<<tiddler exercise_020>>\n#<<tiddler exercise_021>>\n#<<tiddler exercise_022>>\n#<<tiddler exercise_023>>\n#<<tiddler exercise_024>>\n#<<tiddler exercise_025>>\n#<<tiddler exercise_026>>\n#<<tiddler exercise_027>>\n#<<tiddler exercise_028>>\n#<<tiddler exercise_029>>\n#<<tiddler exercise_030>>\n
!!Semester Grading\n\nWith the elimination of the semster project, many of you have asked how your major evaluations (homework, mid-semeter examinations, and final examination) will be weighted to determine a final coure grade. I've given this much thought, and have appreciated the quality of the advice offered by many of you. My goals, of course, are to prepare grades indicative of your mastery of the material in the course, and that are consistent and fair to all enrolled in the course.\n\nThe major components comprising the final grade will consist of \n* Homework, total of all points earned on all homeworks (2 units)\n* Mid-Semester Exam 1 (2 units)\n* Mid-Semester Exam 2 (2 units)\n* Final Exam (3 units)\nThis forms a total of 9 'units' for the course. Your score for each unit will be determined by computing the difference between your score and the class mean, and then divided by the standard deviation. Commonly called the 't-score', this well-known technique forms a beter statistical means of properly weighting performance in the various components. For each component you will receive either 2 or 3 units with an associated scores.\n\nIn order to make allowances for an anomolously low performance, one of your lowest unit scores will be changed to be equal to one of highest unit scores. So there be still 9 units, but with the effect of discounting your lowest score and amplifying your highest score. For example, if the units were associated with the mid-semester exams, then you low score would be discounted 50%, and your high score have an additional 50% weighting.\n\nIn determining a final letter grade, in the case of someone on the borderline between two letter grades, I reserve the perogative to raise to the higher grade based on my qualitative judgement of classroom participation. In no case will I lower a grade on this basis.\n\nPlease let me know if you have any questions or concerns with this grading method. \n\n!!Exam Format\n* 4-5 problem solving exercises.\n* Several problems will require you to evaluate a matlab code fragments, or write (in long-hand) a matlab code fragment.\n* Potential problems include\n** setting up an optimization problem for numerical solution\n** writing an appropriate convergence criterion for a specific problem\n** setting up a least squares data fitting problem\n** numerical solution of an ODE and the interpretation of the solution\n** recreating a mathematical derivation in singular value analysis\n* Several of the problems will require you to manipulate equations arising from chemical engineering applications putting them in a form appropriate for numerical solution. \n* Potential problems include\n** demonstrating the application of a single variable solution technique by executing (by hand) one step of a specified solution technique.\n** writing an appropriate convergence criterion for a specific problem\n** showing a piece of matlab code that purports to implement a specific algorithm, and asking you to diagnose possible sources of errors.\n* Integrating Solution techniques, that is combining equation solving, optimization, and differential equations to simulate a chemical process.\n\n!!Topics\n# Matlab Coding\n## Basic syntax.\n*** Scalar and vector variables.\n*** Manipulation of vectors and matrices, and working with vectors of data directly rather than implementing {{{for}}} loops.\n*** Function definitions, passing data to and from functions\n*** Function handles (i.e., anonymous functions)\n## Problem solving in Matlab\n*** Equation solving with {{{fzero}}}\n*** Implementing basic algorithms, e.g., bisection\n# Single Variable Equation Solving\n## Solution Algorithms. (Should be able to code).\n*** Bisection\n*** Regula-Falsi, Secant (what is the distinction?)\n*** Newton-Raphson\n## Chemical Engineering Applications\n*** Equations of State\n*** Isothermal Flash\n*** Chemical Equilibria\n**** Single reaction\n**** Atomic/Molecular matrix\n**** Stoichiometric Matrix\n**** Mathematical Formulation of the multiple reaction case\n## Measuring convergence\n*** Testing for convergence\n*** Plotting convergence\n# Optimization\n## Golden Section Searching\n## Measuring convergence\n# Multivariable Equation Solving\n## Setting up a given problem for numerical solution\n## Sequential Solution and convergence\n## Linear Systems of Equations\n## Least Squares Solution \n# Singular Value Decomposition\n## Singular values as eigenvalues of $A^TA$\n## Singular vectors\n## Orthogonality\n# Ordinary Differential Equations\n## Numerical analysis of a single equation, sketching and graphing solutions\n## Numerical methods to solve multiple equations in Matlab\n## Formulation of non-isothermal reaction equations\n## Handling of stiff systems of differential equations arising in chemical reactions.\n \n\n!! Textbook References\n# Chapter 1 -- 8\n# Appendix B - Matlab Hints\n# Appendix E - Parameter Estimation\n\n\n
function setFooter() {\n if (document.getElementById && document.getElementById("contentFooter") ) {\n var windowHeight=findWindowHeight();\n if (windowHeight>0) {\n var contentHeight= document.getElementById('mainMenu').offsetHeight + document.getElementById("header").offsetHeight + document.getElementById("contentFooter").offsetHeight;\n var menu= document.getElementById('mainMenu');\n //var footerHeight=footerElement.offsetHeight;\n if (windowHeight-(contentHeight)>=0) {\n menu.style.position='relative';\n menu.style.marginBottom=(windowHeight-(contentHeight))+'px';\n }\n else {\n menu.style.position='';\n menu.style.marginBottom='';\n }\n }\n }\n}\nwindow.onresize = function() {\n setFooter();\n}\n\nStory.prototype.refreshTiddler_footerhack=Story.prototype.refreshTiddler;\nStory.prototype.refreshTiddler = function (title,template,force)\n{ \nvar theTiddler = Story.prototype.refreshTiddler_footerhack.apply(this,arguments);\nsetFooter();\n return theTiddler;}
!Formatting Tables in Matlab\n\nWhile Matlab is well suited to numerical computation and graphing, often one needs to expresss results as tables and reports. Matlab is very flexible in this regard, but it does take a bit of programming. Here are some notes that may help you prepare tabulated results.\n\n!!! Some Matlab Basics\nTo prepare tables as text output, you should have working knowledge of these basic Matlab constructions:\n* Strings\n* Matlab commands:\n** {{{disp}}}\n** {{{sprintf}}}\n* Cell arrays\n\n''Strings''\n\nStrings are simple. Anything between two quotation marks is a string. {{{'Hello, World'}}} is a string. Strings are just Matlab vectors in disguise, with each vector element holding one character. So the expression {{{x = 'Hello, World'}}} yields a vector {{{x}}} with 1 row and 12 columns, each element of the vector holding a character of the string. {{{x(6)}}} therefore holds the comma.\n\nMatlab command ''{{{disp}}}''\n\nThe Matlab command {{{disp}}} is used to format and display any Matlab variable. So {{{disp(x)}}} displays the current value of {{{x}}}. If it's a string, then {{{disp(x)}}} displays the string. You might try these expressions to see how this works:\n{{{\n x = 'Hello, World';\n disp(x);\n disp(x(8:12));\n disp(x');\n}}}\n\nMatlab command ''{{{sprintf}}}''\n\nThe {{{sprintf}}} command is trickier. It's a tool for translating matlab numbers into strings. There are simpler commands for doing this, such as {{{num2str}}}. But {{{sprintf}}} gives the most control over the final result, so it's useful to master {{{sprintf}}} because it can be used in many different circumstances.\n\n{{{sprintf}}} requires at least two arguments, and returns a string result. The first argument says how you want the number formatted, and the second argument is the number itself. For example\n{{{\n x = 12.5;\n s = sprintf(' %8.3g', x);\n disp(s);\n}}}\ntakes the numeric value for {{{x}}}, translates it to a string {{{s}}} using the format {{{'%8.3f'}}}, then displays the resulting string. The format is a little cryptic, but you can read it as follows:\n* The {{{%}}} says to insert a number here..\n* The {{{8.3}}} says to use 8 characters for the number, and to put 3 places behind the decimal point.\n* The {{{g}}} means we want to write a general floating point result. There are many format options, for example {{{e}}} puts the number in an exponential format, {{{f}}} in a fixed format, and {{{d}}} in a decimal format. Type {{{doc sprintf}}} for a full description of all the options available. {{{g}}} is a good default to use if you want to get things done quickly.\n\nYou can do additional things with the format string in {{{sprintf}}}. For example\n{{{\n x = 12.5; y = -23.2;\n s = sprintf(' These are two numbers %8.3f and %12.5g', x, y);\n disp(s);\n}}}\nThis will plug numbers in for {{{x}}} and {{{y}}} into the spots marked with a '%' in the format string.\n\n''Cell Arrays''\n\nCell arrays are an additional Matlab variable type that useful in storing and manipulating strings. While you could live without them, they are useful for dressing up tables with row and column labels. For example,\n{{{\n rowlabels = {'Row 1', 'Row 2', 'Row 3'};\n collabels = {'Column 1', 'Column 2'};\n}}}\nsets up cell arrays holding labels for a table with three rows and two columns. Note the use of curly braces '{, }' rather than square braces '[, ]' used to demark numeric arrays. The curly braces tells Matlab that these are cell arrays. Cell arrays are arrays which can hold just about anything in the individual elements of the array, including strings. As you will see below, you also need curly braces to access these elements.\n\n!!! Formatting tables\n\nSuppose we want to format a table of numerical data contained in a Matlab array {{{a}}}. We want to put a label above each column, and a label before each row. Below is one way to do this. Note the use of the variable {{{s}}} to construct each line of text prior to displaying that line.\n{{{\n% Construct some sample data\n\na = rand(4,6);\ncols = {'Keough','Walsh','Lyons','Keenan','Farley','St. Ed'};\nrows = {'B''fast','Lunch','Dinner','Snacks'};\n\n% Print column labels\ns = sprintf('%8s',' ');\nfor j = 1:length(cols)\n s = [s,sprintf('%8s',cols{j})];\nend\ndisp(s)\n\n% Print rows with labels\nfor i = 1:length(rows)\n s = sprintf('%8s',rows{i});\n for j = 1:length(cols)\n s = [s,sprintf('%8.3f',a(i,j))];\n end\n disp(s)\nend\n\n}}}\n\nThis example produces the following table can be easily pasted into a spreadsheet or word-processing document.\n{{{\n Keough Walsh Lyons Keenan Farley St. Ed\n B'fast 0.616 0.510 0.967 0.130 0.014 0.282\n Lunch 0.662 0.714 0.822 0.254 0.562 0.065\n Dinner 0.617 0.515 0.318 0.803 0.455 0.477\n Snacks 0.685 0.606 0.588 0.668 0.905 0.984\n}}}\n\n\n
[[Problem 1]]\n[[Problem 2]]\n[[Problem 3]]\n[[Exam 1 Review]]\n[[Exam 1]]\n[[Problem 4]]\n[[Problem 5]]\n[[Problem 6]]\n[[Exam 2 Review]]\n[[Exam 2]]\n[[Problem 7]]\n[[Problem 8]]\n[[Problem 9]]\n[[Final Exam Review]]\n[[Final Exam]]\n
//{{{\nconfig.macros.def ={};\nconfig.macros.def.handler = function(place,macroName,params,wikifier,paramString,tiddler)\n{\n var sliceName = params[1]? params[1].toLowerCase() : params[0].toLowerCase();\n var def = store.getTiddlerSlice("InfoDefinitions",sliceName);\n if (def == undefined)\n {\n wikify(params[0],place);\n return false;\n }\n var theClass = params[2]? params[2] : "info";\n var container = createTiddlyElement(place,"span",null,theClass);\n wikify(params[0],container);\n if (document.all)\n {\n container.onmouseover = function(){addClass(this,"infoover");};\n container.onmouseout = function(){removeClass(this,"infoover");};\n }\n var tooltip = createTiddlyElement(container,"span",null,null);\n wikify(def, tooltip);\n\n}\n\nconfig.macros.note ={};\nconfig.macros.note.handler = function(place,macroName,params,wikifier,paramString,tiddler)\n{\n var sliceName = params[1]? params[1].toLowerCase() : params[0].toLowerCase();\n var def = store.getTiddlerSlice("InfoDefinitions",sliceName);\n if (def == undefined)\n {\n wikify(params[0],place);\n return false;\n }\n var theClass = params[2]? params[2] : "note";\n var container = createTiddlyElement(place,"span",null,theClass);\n wikify("^^"+params[0]+"^^",container);\n if (document.all)\n {\n container.onmouseover = function(){addClass(this,"noteover");};\n container.onmouseout = function(){removeClass(this,"noteover");};\n }\n var tooltip = createTiddlyElement(container,"span",null,null);\n wikify(def, tooltip);\n\n}\n\n//}}}\n
The tiddler 'InterfaceOptions' doesn't yet exist. Double-click to create it
<<slideShow style:"SlideShowStyleSheet">>\n-s-\n!Linear Programming has a Colorful History\n*[1947] George Dantzig publishes Simplex Method for Linear Programming. Works well in practice, but later found to have theoretical shortcomings, including exponential complexity in the worst case.\n*[1979] Khachiyan's Ellipsoidal Method announced for solving LP's in polynomial time. "The Great Mathematical Sputnik of 1979".\n*[1984] New York Times announces Karmarkar's interior point method\n**"Startling theoretical breakthrough" - Bell Labs\n**"It's big dollars" - American Airlines\n**"It's important when conditions are changing rapidly, for example, the price of crude oil" - Exxon\n\n-s-\n!Giapetto's Workshop\nGiapetto's Workshop produces two types of wooden toys:\n*Soldiers - Each sells for \s$27, and requires\n** \s$10 of raw materials, and \s$14 of labor and overhead\n**2 hours of finishing labor, and 1 hour of carpentry labor\n*Train - each sells for \s$21, and requires\n**\s$9 of raw materials, and \s$10 of labor and overhead\n**1 hour of finishing labor, and 1 hour of carpentry labor\n!Constraints\n*100 finishing hours, 80 carpentry hours available weekly.\n*At most 40 toy soldiers will be sold each week.\n''What is the maximum achievable weekly profit?''\n-----\nExample from <<tiddler winston1997>> and <<tiddler ceron2006>>\n\n-s-\n!Decision Variables\nWhat are the decision variables?\n*$x_1$: Weekly production of toy soldiers.\n*$x_2$: Weekly production of toy trains.\n\n-s-\n!What quantity are we trying to maximize?\n\sbegin{eqnarray}\n \stext{Revenue} & = & \s$27 x_1 + \s$21 x_2 \s\s\n \stext{Cost} & = & (\s$10 + \s$14) x_1 + (\s$9 + \s$10) x_2\n \send{eqnarray}\nMaximize\n\sbegin{eqnarray}\n\stext{Profit} & = & \stext{Revenue} - \stext{Cost} \s\s\n& = & (\s$27 - \s$10 -\s$14) x_1 + (\s$21 - \s$9 - \s$10) x_2\n\s\s\n& = & 3x_1 + 2x_2\n\send{eqnarray}\n\n-s-\n!How are decisions constrained?\nProduction must be a non-negative (integer):\n$$x_1, x_2 >= 0$$\nProduction cannot exceed demand (if there is no storage for unsold goods):\n$$x_1 <= 40$$\nLimited resources:\n*Limit of 100 hours/wk of finishing labor: $$x_1 + x_2 <= 100$$\n\n*Limit of 80 hours/wk of carpentry labor: $$2x_1 + x_2 <= 100$$\n\n-s-\n!Summary\nThe optimization problem is to maximize profit by selecting 2 decision variables subject to 5 constraints:\n*Maximize $$\stext{Profit} = 3x_1 + 2x_2$$\n\n*Subject to\n\sbegin{eqnarray}\nx_1 & >= 0 &\stext{Non-negative production}\s\s\nx_2 & >= 0 & \stext{Non-negative production }\s\s\nx_1 & <= 40 &\stext{Maximum Demand for Soldiers}\s\s\n2x_1 + x_2 & <= 100 &\stext{Finishing Constraint}\s\s\nx_1 + x_2 & <= 80 & \stext{Carpentry Constraint}\n\send{eqnarray}\n\n-s-\n!Soldiers Only Strategy ($x_2 = 0$)\nMaximize $3x_1$ subject to\n\sbegin{eqnarray}\nx_1 & >= & 0 \s\s\nx_1 & <= & 40\s\s\n2x_1 & <= & 100 \s\s\nx_1 & <= & 80\n\send{eqnarray}\nSolution: $x_1 = 40$ for a profit of \s$120/wk\n\n-s-\n!Trains Only Strategy ($x_1 = 0$)\nMaximize $2x_2$ subject to\n\sbegin{eqnarray}\nx_2 & >= & 0\s\s\nx_2 & <= & 100\s\s\nx_2 & <= & 80\s\s\n\send{eqnarray}\nSolution: $x_2 = 80$ for a profit of \s$160/wk\n\n-s-\n!Would a mixed strategy yield a higher profit?\nDecision Plane\n*Solutions will be found in the positive quadrant.\n*Constraints determine the //feasible region//.\n\n{{tablecenter{\n<html>\n<object type="image/svg+xml" data="http://www.nd.edu/~jeff/Teaching/CBE20258/S2007/images/Giapettos0.svg" width=500 height=400></object>\n</html>\n}}}\n\n-s-\n!Demand Constraint\nThe limited demand for toy soldiers ($x_1 <= 40$) limits solutions to the left of the line $x_1 = 40$.\n\n{{tablecenter{\n<html>\n<object type="image/svg+xml" data="images/Giapettos1.svg" width=500 height=400></object>\n</html>\n}}}\n\n-s-\n!Finishing Labor Constraint\nThe region satisfying the constraint on finishing labor ($2x_1 + x_2 <= 100$) lies 'below' the line $2x_1 + x_2 = 100$.\n\n{{tablecenter{\n<html>\n<object type="image/svg+xml" data="images/Giapettos2.svg" width=500 height=400></object>\n</html>\n}}}\n\n-s-\n!Carpentry Labor Constraint\nSolutions satisfying the carpentry labor constraint lie below the line $x_1 + x_2 = 80$.\n\n{{tablecenter{\n<html>\n<object type="image/svg+xml" data="images/Giapettos3.svg" width=500 height=400></object>\n</html>\n}}}\n\n-s-\n!Feasible Region\nThe //feasible region// is the set of decision variable satisfying all constraints, which, for an LP, is\n*Convex\n*If finite, a polyhedron, or\n*If infinite, a cone.\nAn LP is \n*//feasible// if the feasible region is not empty.\n*Otherwise it is //infeasible//\n\n-s-\n\n{{tablecenter{\n<html>\n<object type="image/svg+xml" data="images/Giapettos4.svg" width=500 height=400></object>\n</html>\n}}}\n\n-s-\n!Profit Contours\nContours of constant profit $p$ satisfy $3x_1 + 2x_2 = p$.\n\n{{tablecenter{\n<html>\n<object type="image/svg+xml" data="images/Giapettos5.svg" width=500 height=400></object>\n</html>\n}}}\n\n-s-\n!Solution\nExtrema are found at //vertices// representing the intersection of //active constraints//.\n\n{{tablecenter{\n<html>\n<object type="image/svg+xml" data="images/Giapettos6.svg" width=500 height=400></object>\n</html>\n}}}\n\n-s-\n!Wrapup\nWhat did we learn today?\n*Formulation of Decision variables, linear constraints, and linear objective function.\n*Review 2-D analysis of toy Linear Programs.\n*Key concepts in the solution of Linear Programs: Feasibility, active constraints, polyhedral feasibility set, vertices.\n\n-s-\n!For Next Time ...\nNext time we'll discuss the numerical solution of linear programs using two computational tools: Excel and the Mosel modeling language. So for next time ...\n*Download, Install, and test Xpress-IVE.\n*Carefully review Chapter 1 of the Xpress text.
<<slideShow style:"SlideShowStyleSheet">>\n-s-\n!Introduction to Matlab\nGoals\n# Establish a base-level understanding of Matlab, and problem solving with Matlab\n# Understand when Matlab maybe an appropriate problem-solving tool.\n# Introduction to equation-solving\n\nAgenda\n# Example Problem: Equation of State\n# Overview of the Matlab Environment\n# Matlab Demonstration\n\nStudent Follow-up\n# Reading Assignments\n# Homework Exercise\n\n-s-\n!Equation of State\nThe ''Ideal Gas Law'' $$pV = nRT$$ is a good representation for the relationship among pressure ($p$), temperature ($T$), and volume ($v$) for a gas at low pressure and well above the critical point. But seeking efficiency, industrial processes often involve gases under high pressure and extreme conditions where the using the ideal gas law yields bad predictions. (Can you think of some examples?).\n\n\n\n!!Matlab Zen\n''Zen'' -- A school of Mahayana Buddhism that asserts that enlightenment can be attained through meditation, self-contemplation, and intuition rather than through faith and devotion and that is practiced mainly in China, Japan, Korea, and Vietnam. Also called Zen Buddhism.\n\n* Matlab o\n
Class time will consist of lectures and demonstrations of the basic principles for computation methods in engineering.\n* Students will be assigned weekly or bi-weekly problem sets to complete and turn in for evaluation. Problem sets will include significant computer applications, including the use of Matlab, spreadsheet, and application specific software tools.\n* Students will be assigned a final term project. Students are assumed to have access to laptops or workstations on which to conduct their work.
\nThis course provides students an introduction to the mathematical, numerical, and computational techniques used to analyze and solve problems in chemical engineering. The major goals of the course are to:\n* Provide students with the skills necessary to implement numerical techniques to solve a wide variety of engineering problems\n* Enable students to formulate engineering problems in a manner amenable to numerical solution\n* Simulate dynamics of systems described by differential-algebraic models.\n* Estimate parameters and confidence intervals from the regression of experimental data on algebraic models, and understand the underlying statistical assumptions and their limitations.
\n\n\n\n* [[Course Overview]]\n* Introduction to Matlab\n
/***\n|''Name:''|LegacyStrikeThroughPlugin|\n|''Description:''|Support for legacy (pre 2.1) strike through formatting|\n|''Version:''|1.0.1|\n|''Date:''|Jul 21, 2006|\n|''Source:''|http://www.tiddlywiki.com/#LegacyStrikeThroughPlugin|\n|''Author:''|MartinBudden (mjbudden (at) gmail (dot) com)|\n|''License:''|[[BSD open source license]]|\n|''CoreVersion:''|2.1.0|\n|''Browser:''|Firefox 1.0.4+; Firefox 1.5; InternetExplorer 6.0|\n\n***/\n\n//{{{\n\n// Ensure that the LegacyStrikeThrough Plugin is only installed once.\nif(!version.extensions.LegacyStrikeThroughPlugin)\n {\n version.extensions.LegacyStrikeThroughPlugin = true;\n\nconfig.formatters.push(\n{\n name: "legacyStrikeByChar",\n match: "==",\n termRegExp: /(==)/mg,\n element: "strike",\n handler: config.formatterHelpers.createElementAndWikify\n});\n\n} // end of "install only once"\n//}}}\n
[[About]]\n[[Syllabus]]\n[[Schedule]]\n<<popup 'Homework & Exams' [[<<tiddler 'Homework & Exams'$))]]>>\n<<popup 'Matlab Notes' [[<<tiddler 'Matlab Notes'$))]]>>\n<<popup 'Additional Notes' [[<<tiddler 'Additional Notes'$))]]>>\n[[Reference Materials]]\n[[Software Guide]]\n[[Office Hours & TA's|Office Hours & Teaching Assistants]]\n[[Exercises]]\n[[Projects]]\n\n<<author>>\n
[[Formatting Tables in Matlab]]\n[[Anonymous Functions and Function Handles]]\n[[Multivariable root finding with mmfsolve]]\n[[Matlab code for Problem Set 4|matlab/Problem_04.m]]\n[[Matlab code for Golden Section Search|matlab/fmin_gs.m]]\n[[Integration in Matlab|matlab/integrationdemo.m]]\n
!Multivariable root finding with mmfsolve\n\nYour textbook suggests using the Matlab function {{{fsolve}}} for solving a system $n$ nonlinear algebraic equations in $n$ unknowns. Unfortunately, {{{fsolve}}} is part of the optimization toolbox, and therefore not part of the base distribution of Matlab. So for this class we'll use another function {{{mmfsolve}}} that's available from the Matlab Central file exchange. You may wish to [[download it directly|http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=8699&objectType=FILE]] from the file exchange. I've also placed a [[backup copy on the course web page|http://www.nd.edu/~jeff/Teaching/CBE20258/S2007/matlab/]] for class use.\n\nBy now you are familiar with the Matlab function {{{fzero}}} which can be used to find a real root of a function of a single variable. For example, to find a root to the equation $$ ln(1+x^2)-\ssqrt{|x|} + 1 = 0 $$ with\n{{{\n f = @(x) log(1 + x^2) - sqrt(abs(x)) + 1;\n fzero(f,10)\n}}}\nwhere have used a function handle to represent the function with a starting guess of 10. \n\nUsing {{{mmfsolve}}} is analogous to using {{{fzero}}}. The main difference is that given function must accept a vector argument and return a vector of values. Further, these must be column vectors. To illustrate, consider the example on page 48 of the Finlayson book with two equations in the two unknowns $x$ and $y$\n$$\sbegin{eqnarray}\n10x + 3y^2 & = & 3 \s\s\nx^2 - exp(y) & = & 2\n\send{eqnarray}$$\nIf we rewrite these equation by identifying $x_1 = x$ and $x_2 = y$, then \n$$\sbegin{eqnarray}\n10x_1 + 3x_2^2 & = & 3 \s\s\nx_1^2 - exp(x_2) & = & 2\n\send{eqnarray}$$\nTranslating this into Matlab commands\n{{{\n f = @(x) [10*x(1) + 3*x(2)^2 - 3; x(1)^2 - exp(x(2)) - 2];\n mmfsolve(f,[0;0])\n}}}\nwhich yields the solution\n{{{\nans =\n\n -1.4456\n -2.4122\n}}}\nNote the use of the semi-colon ';' inside the vector which separates elements of the vector into rows.\n\nAnother way of setting coding this into Matlab is given in the Finlayson text. Following that approach, we define a function {{{prob2.m}}}\n{{{\nfunction y2 = prob2(p)\n% vector components of p are transferred to x and y for \n% convenience in remembering the equation\nx = p(1);\ny = p(2);\n% the components of the two equations are calculated\ny2(1) = 10*x + 3*y*y - 3;\ny2(2) = x*x - exp(y) - 2;\ny2 = y2(:);\n}}}\nNote the last line ''which is not in the Finlayson text''. This line forces {{{y2}}} to be a column vector as required by {{{mmfsolve}}}. Solving the equations\n{{{\n>> mmfsolve('prob2',[0;0])\n\nans =\n\n -1.4456\n -2.4122\n}}}\nYou can find much more about the use of {{{mmfsolve}}} by using the {{{help mmfsolve}}} command.
// Resolves a Tiddler reference or tiddler title into a tiddler title string, or null if it doesn't exist\nresolveTitle = function(t)\n{\n if (t instanceof Tiddler) t = t.title;\n return store.tiddlerExists(t) ? t : null;\n}\n\nconfig.macros.navigation = {};\nconfig.macros.navigation.handler = function(place,macroName,params,wikifier,paramString,tiddler)\n{\n\n if (!store.tiddlerExists(tiddler.title))\n return false;\n var e = createTiddlyElement(place,"span",null,"nav");\n e.setAttribute("refresh","macro");\n e.setAttribute("macroName",macroName);\n e.setAttribute("params",paramString);\n e.setAttribute("tiddler",tiddler.title)\n this.refresh(e,paramString);\n}\n\nconfig.macros.navigation.refresh = function(place,params)\n{\n var tiddler = store.getTiddler(place.getAttribute("tiddler"));\n removeChildren(place);\n\n\n var params = place.getAttribute("params").parseParams("tiddlers",null,true);\n//alert(store.getTiddlerText(getParam(params,"index",undefined)).parseParams("tiddlers",null,false))\n var tiddlers = getParam(params,"tiddlers",undefined);\nif (typeof tiddlers == 'string')\n tiddlers = tiddlers.readBracketedList();\n if (tiddlers == undefined)\n alert("no source tiddlers defined for navigation");\n var contents = [];\n for (var i=0;i<tiddlers.length;i++)\n {\n var title = resolveTitle(tiddlers[i]);\n contents.push(title);\n}\n var navIndex = contents.indexOf(tiddler.title);\n if (navIndex == -1)\n return false;\n \n if (contents[navIndex-1])\n {\n wikify("[[<< Previous|"+contents[navIndex-1]+"]]",place);\n place.lastChild.className += " navPrev";\n }\n if (contents[navIndex+1])\n {\n wikify("[[Next >>|"+contents[navIndex+1]+"]]",place);\n place.lastChild.className += " navNext";\n }\n\n var theTable = createTiddlyElement(place,"table",null,"nav");\n var theBody = createTiddlyElement(theTable,"tbody");\n var theRow = createTiddlyElement(theBody,"tr");\n for (var i=0; i<contents.length; i++)\n {\n var box = createTiddlyElement(theRow,"td",null,"navlinkcell"," ");\n box.onclick = onClickTiddlerLink;\n box.setAttribute("tiddlyLink",contents[i]);\n box.title = (contents[i]);\n if (contents[i] ==tiddler.title)\n box.className += " activenav";\n }\n}\n\nsetStylesheet(\n".navNext {float:right;}\sn"+\n".navPrev, .navPrevious{float:left;}\sn"+\n".nav .tiddlyLink {color:#000; background:transparent;border:none;padding:0;margin:0;}\sn"+\n".nav {padding:0;margin:0;}\sn"+\n".nav table {margin:0 auto !important; border:0px solid #000;padding:0;border-collapse:separate;}\sn"+\n".nav table tr{padding:0; margin:0;border-spacing: 1px;}\sn"+\n".nav table td {padding:4px; border:1px solid #000; border-spacing: 0px;cursor:pointer;cursor:hand}\sn"+\n".nav .activenav{background:#000 !important;}\sn","NavigationPluginStyles");
The tiddler 'New Tiddler' doesn't yet exist. Double-click to create it
Here are some notes you may find useful:\n* [[Problem 3]]\n* [[Working with Slugs]]\n* [[Formatting Tables in Matlab]]\n* [[Multivariable root finding with mmfsolve]]\n* [[Vapor-Liquid Equilibrium]]
!Office Hours & Teaching Assistants\n\nThe teachings assistant and I will maintain regular office hours for the semester as listed below. Please feel free to use these office hours. You can also take your chances and check my office outside of office hours, or contact me by email or phone to make an an appointment. (I will give you the contact information in class). \n\n{{tablecenter{\n|!Instructor|!Office Hours|!Location|\n|Jeffrey Kantor|2:30 - 4:30pm Monday & Thursday | 176 Fitzpatrick Hall|\n|!Teaching Assistants|!Office Hours|!Location|\n|Anees Attarwalla|TBD|B2 Fitzpatrick Hall|\n|Xinguang Cheng|3-5pm Thursday|122 Cushing Hall|\n|Anish Gupta|2-4pm Monday & Wednesday|311 Cushing|\n}}}\n
<!--{{{-->\n<div id="header" class='header'>\n <div class='gradient' macro='gradient vert #EF9934 #C86719 '>\n <div class='titleLine' >\n <span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;\n <span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>\n </div>\n\n </div>\n\n</div>\n<div id='bodywrapper'>\n\n<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>\n<div id='displayArea'>\n <div id='messageArea'></div>\n <div id='tiddlerDisplay'></div>\n</div>\n<div id='contentFooter' refresh='content' tiddler='contentFooter'></div>\n</div>
/***\n|''Name:''|~PopupMacro|\n|''Version:''|1.0.0 (2006-05-09)|\n|''Source:''|http://tw.lewcid.org/#PopupMacro|\n|''Author:''|Saq Imtiaz|\n|''Description:''|Create popups with custom content|\n|''Documentation:''|[[PopupMacro Documentation|PopupMacroDocs]]|\n|''~Requires:''|TW Version 2.0.8 or better|\n***/\n// /%\n{{{\nconfig.macros.popup = {};\nconfig.macros.popup.arrow = (document.all?"โ–ผ":"โ–พ");\nconfig.macros.popup.handler = function(place,macroName,params,wikifier,paramString,theTiddler) {\n\n if (!params[0] || !params[1]) \n {createTiddlyError(place,'missing macro parameters','missing label or content parameter');\n return false;};\n \n var label = params[0];\n var source = (params[1]).replace(/\s$\s)\s)/g,">>"); \n var nestedId = params[2]? params[2]: 'nestedpopup'; \n\n var onclick = function(event) {\n if(!event){var event = window.event;}\n var theTarget = resolveTarget(event);\n var nested = (!isNested(theTarget));\n \n if ((Popup.stack.length > 1)&&(nested==true)) {Popup.removeFrom(1);}\n else if(Popup.stack.length > 0 && nested==false) {Popup.removeFrom(0);};\n \n var theId = (nested==false)? "popup" : nestedId; \n var popup = createTiddlyElement(document.body,"ol",theId,"popup",null);\n Popup.stack.push({root: button, popup: popup});\n\n wikify(source,popup);\n Popup.show(popup,true);\n event.cancelBubble = true;\n if (event.stopPropagation) event.stopPropagation();\n return false;\n }\n var button = createTiddlyButton(place, label+this.arrow,label, onclick, null);\n};\n\nwindow.isNested = function(e) {\n while (e != null) {\n var contentWrapper = document.getElementById("contentWrapper");\n if (contentWrapper == e) return true;\n e = e.parentNode;\n }\n return false;\n};\n\nsetStylesheet(\n".popup, .popup a, .popup a:visited {color: #fff;}\sn"+\n".popup a:hover {background: #014; color: #fff; border: none;}\sn"+\n".popup li , .popup ul, .popup ol {list-style:none !important; margin-left:0.3em !important; margin-right:0.3em; font-size:100%; padding-top:0.5px !important; padding:0px !important;}\sn"+\n"#nestedpopup {background:#2E5ADF; border: 1px solid #0331BF; margin-left:1em; }\sn"+\n"",\n"CustomPopupStyles");\n\nconfig.shadowTiddlers.PopupMacroDocs="The documentation is available [[here.|http://tw.lewcid.org/#PopupMacroDocs]]";\n}}}\n//%/
\n''If you want this documentation available offline, you will need to copy this tiddler to your TW.''\n!Description:\nUsing the popup macro you can create popups with any wiki text. The wiki text can be written in the macro call, can be generated using a different macro, or included from a tiddler.\n\n!Usage:\n*the button label is the first parameter\n*the text to put in the popup is the second parameter\n**embed macro output like forEachTiddler or tiddlerList\n***start macro calls with {{{<<}}} like normal, but end with {{{$))}}}\n**define popup content inline, or embed from a tidder using the core tiddler macro {{{<<tiddler$))}}}\n*you can nest popups up to one level\n**nested popups have an id of 'nestedpopup' for easier styling.\n**specify unique id's for nested popups by passing the id as a third parameter.\n\n----\n!Example's\n\n''Put a forEachTiddler macro generated list in a popup:''\n{{{<<popup forEachTiddlerDemo [[<<forEachTiddler where 'tiddler.tags.contains("systemConfig")']]$))}}}\n<<popup forEachTiddlerDemo [[<<forEachTiddler\nwhere\n'tiddler.tags.contains("systemConfig")'$))]]>>\n\n''Use the core {{{<<tiddler>>}}} macro to put the contents of a tiddler into a popup:''\nMainMenu popup:\n{{{<<popup MainMenu [[<<tiddler MainMenu$))]]>>}}}\n<<popup MainMenu [[<<tiddler MainMenu$))]]>>\n\n''Or create a custom menu in a tiddler using various macro's and normal tiddlylinks.''\n{{{<<popup CustomMenu '<<tiddler CustomMenu$))'>>}}}\n<<popup CustomMenu '<<tiddler CustomMenu$))'>>\nthis menu was created with a combination of forEachTiddler and normal tiddlyLinks!\nNote that the 'Plugins' button opens a second nested popup.\nSource tiddler: CustomMenu\n\n''Or define your custom menu inline.''\n{{{<<popup 'Inline Custom Menu' [[Custom Menu\n*MainMenu\n----\n<<forEachTiddler\n where\n 'tiddler.tags.contains("systemConfig")']]$))]] \n>>}}}\n<<popup 'Inline Custom Menu' [[Custom Menu\n*MainMenu\n----\n<<forEachTiddler where 'tiddler.tags.contains("systemConfig")'$))]] \n>>\n\n''Note: you can pass a third parameter and it will be set as the id of any nested popups''\nBy default, nested popups have an id of 'nestedpopup' to facilitate styling.\n\n----\n!Current Issues:\n*better support for custom classes for popups and nestedpopups\n----\n!Code\nPopupMacro\n\n
DummyTiddler1\nDummyTiddler2\n[[Dummy Tiddler 3]]
//{{{\nTiddlyWiki.prototype.removeNotification = function(title,fn) {\n for (var i=0;i<this.namedNotifications.length;i++)\n if((this.namedNotifications[i].name == title) && (this.namedNotifications[i].notify == fn))\n this.namedNotifications.splice(i,1);\n}\n \n//checks to see if a tiddler exists in store or as a shadow.\nTiddlyWiki.prototype.isTiddler= function (title)\n {return store.tiddlerExists(title) || store.isShadowTiddler(title)}\n\n// Refresh all tiddlers in the Story\nStory.prototype.lewcidrefreshAllTiddlers = function()\n{\n var place = document.getElementById(this.container);\n var e = place.firstChild;\n if(!e) return;\n this.refreshTiddler(e.getAttribute("tiddler"),null,true);\n while((e = e.nextSibling) != null)\n this.refreshTiddler(e.getAttribute("tiddler"),null,true);\n}\n\nconfig.presentationPlugin ={\n};\n\nconfig.presentationPlugin.defaults = [\n {name: "StyleSheet", notify: refreshStyles},\n {name: "PageTemplate", notify: refreshPageTemplate}\n ];\n\nwindow.presentationMode='';\n\nfunction applyPresentationMode (oldMode,Mode)\n{\n presentationMode = Mode;\n var defaults = config.presentationPlugin.defaults;\n var oldStyleElement = document.getElementById(oldMode+"StyleSheet");\n if (oldStyleElement)\n {\n oldStyleElement.parentNode.removeChild(oldStyleElement);\n }\n for (var i=0; i<defaults.length; i++)\n {\n var def = defaults[i]["name"];\n var newMode = store.isTiddler(Mode + def)? Mode + def : def;\n store.removeNotification(oldMode + def, defaults[i]["notify"]);\n store.addNotification(newMode,defaults[i]["notify"]);\n store.notify(newMode); //just one do blanket notify instead?\n }\n story.lewcidrefreshAllTiddlers();\n}\n\nconfig.macros.author={};\nconfig.macros.author.handler= function (place,macroName,params,wikifier,paramString,tiddler) {\n var e = createTiddlyElement(place,"div");\n e.setAttribute("refresh","macro");\n e.setAttribute("macroName","author");\n e.setAttribute("params",paramString);\n this.refresh(e,paramString);\n}\n\nconfig.macros.author.refresh = function(place,params){\n if (window.lewcideditmode== false)\n return false;\n removeChildren(place);\n var oldMode = window.presentationMode;\n var newMode = (oldMode == "Author")?"":"Author";\n var label = (oldMode == "Author")? "Presentation Mode":"Author Mode";\n var tooltip = label;\n createTiddlyButton(place,label,tooltip,function() {\n applyPresentationMode(oldMode,newMode);\n });\n};\n\nStory.prototype.chooseTemplateForTiddler_old_presentation = Story.prototype.chooseTemplateForTiddler;\n\nStory.prototype.chooseTemplateForTiddler = function(title,template)\n{\n if (!template)\n template = DEFAULT_VIEW_TEMPLATE;\n var mode = presentationMode;\n if (template == DEFAULT_VIEW_TEMPLATE)\n {\n if (store.isTiddler(mode+"ViewTemplate"))\n return mode+"ViewTemplate";\n }\n else if (template == DEFAULT_EDIT_TEMPLATE)\n {\n if (store.isTiddler(mode+"EditTemplate"))\n return mode+"EditTemplate";\n }\n return this.chooseTemplateForTiddler_old_presentation(title,template);\n}\n\nwindow.lewcideditmode = false;\nconfig.paramifiers.author = {\n onstart: function(v) {\n if (v!="true")\n return false;\n applyPresentationMode("","Author");\n window.lewcideditmode = true;\n if (config.options.chkSinglePageMode)\n config.options.chkSinglePageMode = false;\n refreshDisplay();\n }\n};\n//}}}
!Problem 1 (Due: Monday, January 29th)\n!!!Statement\n(after Finlayson, Prob. 2.3): Consider the following mixture going to a water-gas shift reactor to make hydrogen for the hydrogen economy. CO (630 kmol/hr); H20 (1130 kmol/hr); C02 (189 kmol/hr); H2 (63 kmol/hr); The gas is at 1 atm and 500K. Use Matlab to compute the specific volume (i.e., liter/kg) using:\n* Ideal Gas Law\n* Redlich-Kwong equation of state\n* Redlich-Kwong-Soave equation of state\nThe acentric factors for the RKS method are:\n{{tablecenter{\n|!Species|!$\somega$|\n|$CO$| 0.049|\n|$H_20$| 0.344|\n|$C0_2$| 0.225 |\n|$H_2$|-0.22|\n}}}\nYou will need to using the mixing rules described in Chap. 2 of the textbook. Do these answers differ? Comment. Redo the calculations for a pressure of 200 atm and comment on the results.\n\n!!!Solution\nA Matlab code solving this problem is available [[here|http://www.nd.edu/~jeff/Teaching/CBE20258/S2007/matlab/Problem_01.m]].\nInput and Physical Property Data:\n{{tablecenter{\n|! Species|! Mole Frac.|! Flow|! Mol. Wt.|! $T_c$|! $P_c$|! $\somega$|\n|! |! |! [kmol/hr] |! [g/gmol] |! [K] |! [atm] |! |\n|$CO$| 0.313| 630.00| 28.01| 134.45| 34.62| 0.05|\n|$H_20$| 0.562| 1130.00| 18.02| 647.00| 217.75| 0.34|\n|$CO_2$| 0.094| 189.00| 44.01| 304.20| 72.85| 0.23|\n|$H_2$| 0.031| 63.00| 2.02| 33.18| 12.83| -0.22|\n}}}\nSolution for specific volumes at the given process conditions:\n{{tablecenter{\n|! Temp.|! Pressure|! Ideal Gas|! R-K|! R-K-S|\n|! [K]|! [atm]|! [liter/g]|! [liter/g]|! [liter/g]|\n| 500| 1| 1.77708| 1.77808| 1.77809|\n| 500| 200| 0.00889| 0.00990| 0.00990|\n}}}
! Problem 2 (Due: Monday, February 5th.)\n\n!!! Statement\nCalculating the flowrate of a fluid through a pipe is a basic engineering calculation -- a topic you will learn more about in your subsequent courses on transport phenomena. Here we outline the basic equations used in the calculations, then formulate a typical application requiring numerical solution.\n\n''Theory''\n\nFor a circular pipe of diameter $D$, and a volumetric flowrate of $Q$, the average fluid velocity $V$ is given by\n$$V = \sfrac{Q}{A}$$ where $A =\sfrac{\spi D^2}{4}$ is the cross-sectional area of the pipe. For a pipe of length $L$, the pressure drop $\sDelta P$ is given by $$\sDelta P = P_2 - P_1 = -\srho g \sleft(\sDelta z + f \sfrac{L}{D}\sfrac{V^2}{2g}\sright)$$ where $\sDelta z$ is the elevation gain from one end of the pipe to the other, $\srho$ is fluid density, and $g$ is the acceleration due to gravity. Needless to say, in applying these equations you need to be consistent and careful with regard to units.\n\nThe dimensionless variable $f$ is the pipe 'friction factor' quantifying the impact of the fluid flow characteristics on pressure drop. It is generally a function of two key dimensionless parameters, $\sepsilon = \sfrac{e}{D}$ measuring the surface roughness of the pipe, and the other known as the 'Reynold's Number', $R$\n$$R = \sfrac{\srho D V}{12 \smu}$$ where $\smu$ is the fluid viscosity. For turbulent flow, the relationship between the Reynold's number and the friction factor is given by the famous 'Colebrook' equation\n$$\sfrac{1}{\ssqrt{f}} = -2\slog_{10}\sleft(\sfrac{e/D}{3.7} + \sfrac{2.51}{R\ssqrt{f}}\sright)$$\n\n''Application''\n\nYou have been asked to build a water supply system for a small village in a developing country that can deliver a minimum of 40 gallons per minute [gpm]. The task is to pump water from lake to a holding tank 2000 feet away that is elevated 25 feet above the lake level.\n* Locally supplied concrete pipe with a measured surface roughness of 3mm is available in diameters of either 2 or 3 inches. Which pumps on the [[attached page|http://www.johndeerelandscapes.com/PDFs/pump_curve_graph.pdf]] should you order?\n* An alternative solution is to buy 2" commercial grade pipe with a measured surface roughness of 0.045mm. Would require larger or smaller pump than would the use of locally produced concrete pipe?\nIn answering these questions, use an equation solving method of your choice.\n\n''Hints''\n\n* You may find the following data useful. Note the use of English units.\n{{tablecenter{\n|! Density of Water | $\srho$ | 1.94 | slugs/ft^3 |\n|! Kinematic Viscosity of Water | $\smu/\srho$ | 1.076e-5 | ft^2/sec |\n|! Acceleration of Gravity | $g$ | 32.16 | ft/sec^2 |\n}}}\n* You'll want to carefully organize your calculations, and be sure you are managing the English units correctly.\n* The Colebrook equation requires numerical solution. It may be helpful if you write a separate function, for example f = frictionfactor(R, epsilon), that takes the Reynolds number and the ratio $\sepsilon = \sfrac{e}{D}$ as arguments, and returns a solution to the Colebrook equation. This design would encapsulate the equation solving algorithm in one place where it can be more easily developed and tested.\n* In the range of interest to use, it is save to assume the friction factor is between 0.001 and 0.1. If you'd like to see typical values, do a Google search on "Moody Chart".
!Problem 3 (Due: Friday, February 9th)\n\n!!! Statement\nA natural gas stream containing a relatively high proportion of heavier hydrocarbons is available to your plant. You are considering flashing this stream at final condition of $P = 110 bar$ and a temperature $T = 50 C$. We are given the following data at these conditions:\n{{tablecenter{\n|! Component |! $z_i$ |! $K_i$ |\n| Carbon Dioxide | 0.0046 | 1.65 |\n| Methane | 0.8345 | 3.09 |\n| Ethane | 0.0381 | 0.72 |\n| Propane | 0.0163 | 0.39 |\n| Isobutane | 0.0050 | 0.21 |\n| n-Butane | 0.0074 | 0.175 |\n| Pentanes | 0.0287 | 0.093 |\n| Hexanes | 0.0220 | 0.065 |\n| Heptanes+ | 0.0434 | 0.036 |\n}}}\nAssume a flowrate of $F = 1000$ g-moles/hour. What fraction of the this stream is recovered as a liquid? What is the mole fraction of Methane in the exiting vapor?\n
!Problem 4 (Due: Friday, March 2nd)\n\n!!! Ammonia Production, (adapted from Problem 4.2, Finlayson)\n## Using Matlab, find the molar flow rates of all species out of an equilibrium reactor at a pressure of 220 [atm] when the inlet values of nitrogen, hydrogen, and ammonia are 1.2, 3, and 0.2, respectively. The equilibrium constant is 0.05 at 589K. $$K_{eq} =\s \sfrac{P_{NH_3}}{P_{N_2}^{1/2}P_{H_2}^{3/2}}$$ for the reaction $$\sfrac{1}{2} N_2 + \sfrac{3}{2} H_2 \sLeftrightarrow NH_3$$\n\n## Plot the extent of reaction as a function of operating pressure for pressures up to 400 [atm]. \n\nThe results you turn in should include:\n* your mathematical formulation of the problem\n* a matlab script which implements the solution and which produces a printed table for the solution to part a, and a clearly labeled and titled plot for part b.\n\n!!! Multi-Reaction Equilibria\nImplementation of a reliable solution algorithm for multi-reaction equilbria generally requires computation of a Jacobian. Our formulation of the multi-reaction equilibrium problem consists of two sets of equations. The conservation of atomic species is given in matrix/vector form as\n$$0 = M(n - n^f)$$\nwhere $M$ is the $E$ by $C$ ''atomic'' matrix representing the atomic formula for the molecular species involved in the reaction, and $n$ and $n^f$ are vectors of molar compositions. The $R$ reaction equilibrium equations are given by \n$$ 0 = -\slog(K_i) - \sleft(\ssum_{j = 1}^C a_{ji} \sright)\sleft(\slog(P) - \slog(\ssum_{j=1}^C n_j) \sright) + \ssum_{j=1}^C a_{ji} \slog(n_j)$$\nwhere $a_{ji}$ is the stoichiometric coefficient of the $j$th species in the $i$th reaction.\n\nFor computational reliability, we substitute $$x_j = \slog(n_j)$$ Compute an expression for the Jacobian of this system of equations in terms of the computational variables $x_j$.\n\n\n\n
!Problem 5 (Due: Friday, March 9th)\n\n!!! Optimization of an Ammonia Process\n\nThis problem set integrates a number of techniques and applications you have been learning in the course. The challenge will be to successfully integrate tools for equation solving and optimization in order to simulate and optimize a simple process flowsheet. The process flowsheet is based on Figure 5.11 (page 65) of the Finlayson text. \n{{tablecenter{\n<html>\n<object type="image" data="images/AmmoniaProcess.tif" width=400 height=200></object>\n</html>\n}}}\nThe feed stream to the process consists of $N_2$, $H_2$, and $CO_2$ as indicated in the following table.\n{{tablecenter{\n|!Species|!K-value|!Feedrate [kmol/hr]|\n| $N_2$ | 4.8 | 10 |\n| $H_2$ | 70.0 | 30 |\n| $NH_3$ | 0.051 | 0 |\n| $CO_2$ | 0.32 | 1 |\n}}}\nThe feed and recycle streams are mixed to form the inlet stream to an equilibrium reactor. In the reactor operates near equilibrium for the reaction\n$$\sfrac{1}{2} N_2 + \sfrac{3}{2} H_2 \sLeftrightarrow NH_3$$\nwith the equilibrium expression\n $$K_{eq} =\s \sfrac{P_{NH_3}}{P_{N_2}^{1/2}P_{H_2}^{3/2}}$$. The equilibrium constant is $K_{eq} = 0.05$ at the operating temperature. The resulting stream is then cooled, and sent to an isothermal flash. K-values are given in the accompanying table. The liquid stream from the flash forms the process product stream. The vapor stream from the flash is recycled. 1% of the recycle stream is purged to avoid unnecessary build up of $CO_2$ in the process flows.\n\nThe capital and operating costs of this process depend strongly on the operating pressure. The task is to calcuate a value for the reactor operating pressure, $P$, which minimizes\n$$Cost(P) = Q(\sfrac{20,000}{P} + P)$$\nwhere $Q$ is the total molar flowrate into the reactor.\n\nFor this problem, please prepare a Matlab code which computes the operating pressure for minimum cost operation. Please report the following information:\n## Operating pressure for minimum cost operation.\n## A Stream Table listing the molar flowrates of all species in all streams.\n## The fraction of Hydrogen converted in each pass through the reactor.\n## The overall fraction of Hydrogen that is converted to product Ammonia.\n\n* Hints\n** Draw and number each stream on the process flowsheet. For each of $S$ streams you will calculate a molar flowrate for each of $C$ species. Therefore you may find it helpful to organize the flowrate information in a $C$ by $S$ matrix of molar flowrates.\n** Prepare a function which simulates the process flowsheet. To 'divide and conquer' this problem, you may wish to write and debug additional Matlab functions to calculate to solve for the outlet streams for the equilibrium reactor and flash. You can use any solution technique you wish, but be sure these functions are well tested before attempting to integrate them into the flowsheet simulation.\n** Successive interation will converge, albeit slowly.\n** The optimal operating pressure will be less than 400 [atm]. You are free to use the golden section search code demonstrated in class.\n\n\n\n
!Problem 6 (Due: Monday, April 2nd)\n\n!!! Least Squares Regression\n\nHeat Capacity of gases and liquids is a function of temperature. Typical expressions are \n$$\sbegin{eqnarray}\nc_p & = & a + bT + cT^2 + dT^3 \s\s\nc_p & = & a + bT + cT^{-2}\n\send{eqnarray}$$\nThe following table was obtained for the heat capacities of three different materials. Develop a Matlab code to fit each of these data sets with each model equation, discuss your results, and recommend which equation gives the best representation of the data.\n{{tablecenter{\n|!Temp [C] |! Set 1 [J/gmol-C] |! Set 2 [J/gmol-C] |! Set 3 [J/gmol-C] |\n| 100 | 29.38 | 30.04 | 28.52 |\n| 200 | 29.88 | 29.08 | 29.79 |\n| 300 | 30.42 | 30.18 | 31.41 |\n| 400 | 30.98 | 30.14 | 31.18 |\n| 500 | 31.57 | 32.27 | 31.16 |\n| 600 | 32.15 | 31.79 | 32.81 |\n| 700 | 32.78 | 32.97 | 32.38 |\n| 800 | 33.29 | 32.56 | 34.26 |\n| 900 | 33.82 | 34.24 | 34.72 |\n| 1000 | 34.31 | 35.27 | 33.69 |\n}}}\n\nYour solution should consist of \n# Data stored as a {{{.mat}}} file.\n# Functions which accept a Temperature and $c_p$ data vectors, and return estimated values of the coefficients $a$, $b$, $c$, and $d$, as appropriate, for each model.\n# A figure which compares experimental and best model fits\n# An evaluation of the quality of fit for each model to all three data sets. If you had to choose one model to use for all three data sets, which would you choose?
!Problem 7 (Due: Wednesday, April 18)\n\n!!! Time Series Data\n\nData from engineering experiments is often given in the form of lengthy time series data representing sequential measurements of a single variable. In this homework problem we will analyze a long time series. Before you start, download the file [[ydata.mat|http://www.nd.edu/~jeff/Teaching/CBE20258/S2007/matlab/ydata.mat]]. Loading this file into Matlab will produce a vector {{{y}}} containing a data series with over 7000 entries. (These are daily prices of a commodity, but the details don't matter for this homework.)\n\nWe wish to fit the data to a model\n$$y(k+1) = a_1 y(k) + a_2 y(k-1) + a_3 y(k-2) + \scdots + a_{n}y(k-n+1)$$\nwhere the parameters $a_1, a_2, \sldots, a_n$ are to be determined. \n\n* Plot the data $y$. Find $N$, where $N$ is the length of the data set.\n* Write matlab code which, for arbitrary values of $n$, prepare the data in the following format $Ax = b$\n$$\sleft[\sbegin{matrix} y(N-1) & y(N-2) & \scdots & y(N-n) \s\s y(N-2) & y(N-3) & \scdots & y(N-n-1) \s\s \svdots & \svdots & \sddots & \svdots \s\s y(n) & y(n-1) & \scdots & y(1)\send{matrix}\sright]\sleft[\sbegin{matrix}a_1 \s\s a_2 \s\s \svdots \s\s a_n\send{matrix}\sright] = \sleft[\sbegin{matrix}y(N) \s\s y(N-1) \s\s \svdots \s\s y(n+1)\send{matrix}\sright]$$\n* What is the condition number of $A$? for $n = 10$? For $n=20$? Be sure you understand the dimensions of $A$, $x$, and $b$. \n* Find a solution for $a_1, a_2, \sldots, a_n$ for $n = 20$. Use the singular value decomposition to obtain robust solutions.\n
!Problem 8 (Due: Friday, April 27)\n\n!!! Ordinary Differential Equations\n\n(After problems 8.5 and 8.6, Finlayson)\n\nThe growth rate for cells in a bioreactor can follow a variety of growth equations. Monod kinetics is represented by part (1) of Problem 8.3. A substrate-inhibition growth rate is given by \n$$\smbox{growth rate} = \sfrac{\smu_mS}{K_s + S + \sfrac{S^2}{K_1}}$$\nwhere $\smu_m$ is the maximum specific growth reaction rate, $K_s$ is the Monod constant, $K_I$ is the inhibition constant, and $S$ represents the substrate concentration. The equation describing growing cells in a CSTR is \n$$Q(S-S_0) = -V\sfrac{\smu_mS}{K_s + S + \sfrac{S^2}{K_1}}$$\nIn nondimensionless form this is \n$$(\ssigma-1) = -{Da}\sfrac{\ssigma}{\somega + \ssigma + \sepsilon\ssigma^2}$$\nwhere\n$${Da} = \sfrac{V\smu_m}{QS_{in}}, \sqquad \somega = \sfrac{K_s}{S_{in}}, \sqquad \sepsilon = \sfrac{S_{in}}{K_I}$$\n# Solve this problem (i.e., find the steady state value of $\ssigma$) for ${Da} = 1.19$, $\somega = 0.00356$, $\sepsilon = 2.53$. There may be mulitple solutions.\n# The same reaction may be conducted in a plug flow reactor. The equations are then\n$$\sfrac{d\ssigma}{dz} = -\s {Da}\sfrac{\ssigma}{\somega + \ssigma + \sepsilon\ssigma^2}$$\nwhere $z$ goes from 0 to 1, and where $\ssigma(0) = 1$. Plot $\ssigma$ as a function of length for the same parameter values.\n# What is the relationship between the solution of these two different problems?
!Problem 9 (Due: Wednesday, May 2)\n\n!!! Analysis of a Catalytic Converter\n(after Finlayson, problems 8.10 and 8.15)\n\nThe catalytic converter on most automobiles can be modeled as a non-isothermal CSTR. One model is\n$$\sbegin{eqnarray}\n\sepsilon VC_{tot}\sfrac{dy}{dt} & = & Q C_{tot}(y_{in}-y) - \salpha V r(y,T) \s\s\nV[\sepsilon\srho_gC_{pg} + (1 - \sepsilon)\srho_sC_{ps}]\sfrac{dT}{dt} & = & Q C_{tot} \shat{M} C_{pg} (T_{in}-T) - \salpha V (-\sDelta H_{rxn})r(y,T)\n\send{eqnarray}$$\n\n$y$ is the mole fraction of Carbon Monoxide in the gas phase, and $T$ is temperature. Values for the expressions and coefficients are given in problems 8.10 and 8.15 on pages 144 -146 of the Finlayson textbook.\n\nThe problem is to simulate the response of the catalytic converter to a change in the inlet gases. Problem 8.15 outlines a test case. Assume the initial value of $y_{in}$ is 0.01, and the initial value of $T_{in}$ is 600K, and that these values then change as indicated in Problem 8.15. Simulate the behavior of the reactor for a 10 second period. Plot the outlet temperature and Carbon Monoxide concentration. Approximately how long does it take for the catalytic converter to reach a new steady state?\n\n\n\n
!Course Textbooks\n#<<tiddler finlayson>>\n#<<tiddler matlab>>\n\n!References\n#<<tiddler beer2006>>\n#<<tiddler bourg2006>>\n#<<tiddler chapra2001>>\n#<<tiddler constantinides1999>>\n#<<tiddler gilat2004>>\n#<<tiddler moler2004>>\n#<<tiddler recktenwald2000>>\n#<<tiddler riggs1998>>\n#<<tiddler winston1997>>\n-----\n!~On-Line Resources\n#<<tiddler ceron2006>>\n#<<tiddler cheg258>>\n# Similar courses at other universities:\n## MIT Opencourseware: [[10.34: Numerical Methods Applied to Chemical Engineering (Spring, 2005) |http://ocw.mit.edu/OcwWeb/Chemical-Engineering/index.htm]]\n## Portland State University: [[ME 352: Numerical Methods for Engineers (Fall, 2005)|http://web.cecs.pdx.edu/..]] This is a rich source of materials built around the Rectanwald textbook.\n## Princeton University: [[ChE 201 Introduction to Scientific Computing (Fall, 2005)|kea.princeton.edu/...]]\n## Rice: [[CHBE 303: Computing in Chemical and Biomolecular Engineering (Fall,2005)|http://www.owlnet.rice.edu/...]]\n## Technological University, Delft: [[Numerical Techniques for Chemical Engineering|http://www.dct.tudelft.nl/~verheijen/education/numtech/]]\n## University of Houston: [[Statistical/Numerical Techniques for Chemical Engineers | http://www.chee.uh.edu/course/syllabi_2005/CHEE%203334.pdf]]\n## University of Maryland: [[ENCH 250: Computer Methods in Chemical Engineering (Summer, 2002)| http://www.glue.umd.edu/~nsw/ench250/ench250.htm]]\n## University of Minnesota: [[ChEn 4201: Numerical Methods in ChEn Applications (Spring, 2006) |http://www.cems.umn.edu/courses/spring06/chen4201]]\n## University of Texas: [[ChE 348: Numerical Methods in Chemical Engineering (Spring, 2004)|http://www.engr.utexas.edu/...]]\n## University of Washington: [[http://courses.washington.edu/checomp/]]
!Schedule\n\n|>|>|>|! Week 1|\n|! Day|! Date|! Notes|! Homework|\n|Wed |1/17|[[Course Overview|Course Overview]] |(1) Install Matlab. (2) Verify that you can successfully read the [[course wiki page| http://www.nd.edu/~jeff/Teaching/CBE20258/S2007/CBE20258.html]]|\n|Fri |1/19|Introduction to Matlab.| |\n|>|>|>|! Week 2|\n|Mon|1/22|Introduction to Matlab (Cont.) | |\n|Wed|1/24|Solving an equation $f(x) = 0$ | |\n|Fri|1/26|Bisection |[[Problem 1]] due |\n|>|>|>|! Week 3|\n|Mon|1/29|Regula-Falsi, Newton-Raphson | |\n|Wed|1/31|[[Vapor-Liquid Equilibrium]] |Read: Chapter 3, Finlayson |\n|Fri|2/2|Continued |Read: Chapter 4, Finlayson |\n|>|>|>|! Week 4|\n|Mon|2/5|Chemical Equilibria |[[Problem 2]] due |\n|Wed|2/7|Chemical Equilibria | |\n|Fri|2/9|[[Chemical Equilibria]] |[[Problem 3]] due|\n|>|>|>|! Week 5|\n|Mon|2/12|[[Solving Systems of non-linear equations|Equation Solving]] |Finlayson Prob. 4.7 |\n|Wed|2/14|Application to process flowsheets | |\n|Fri|2/16|First Mid-Semester Exam | |\n|>|>|>|! Week 6|\n|Mon|2/19|Newton-Raphson | |\n|Wed|2/21|Systems of Equations | |\n|Fri|2/23|Multiple Reaction Equilibria | |\n|>|>|>|! Week 7|\n|Mon|2/26|Single Variable Optimization | |\n|Wed|2/28| | |\n|Fri|3/2| |[[Problem 4]] due|\n|>|>|>|! Week 8|\n|Mon|3/5| | |\n|Wed|3/7| |[[Problem 5]] due|\n|Fri|3/9| | |\n|>|>|>|! Spring Break 3/10-3/18|\n|>|>|>|! Week 9|\n|Mon|3/19| | |\n|Wed|3/21| | |\n|Fri|3/23| | |\n|>|>|>|! Week 10|\n|Mon|3/26| | |\n|Wed|3/28| | |\n|Fri|3/30|| |\n|>|>|>|! Week 11|\n|Mon|4/2| | |\n|Wed|4/4| Second Mid-Semester Exam | |\n|>|>|>|! Easter Break 4/6 - 4/9|\n|>|>|>|! Week 12|\n|Wed|4/11| | |\n|Fri|4/13| | |\n|>|>|>|! Week 13|\n|Mon|4/16| | |\n|Wed|4/18| | |\n|Fri|4/20| | |\n|>|>|>|! Week 14|\n|Mon|4/23| | |\n|Wed|4/25| | |\n|Fri|4/27| | |\n|>|>|>|! Week 15|\n|Mon|4/30| | Final Project Due|\n|>|>|>|! Final Exam|\n|Wed|5/9|8:00-10:00am, Location TBD | |\n\n
The tiddler 'New Tiddler' doesn't yet exist. Double-click to create it
/***\n|''Name:''|SinglePageModePlugin|\n|''Source:''|http://www.TiddlyTools.com/#SinglePageModePlugin|\n|''Author:''|Eric Shulman - ELS Design Studios|\n|''License:''|[[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|\n|''~CoreVersion:''|2.0.10|\n\nNormally, as you click on the links in TiddlyWiki, more and more tiddlers are displayed on the page. The order of this tiddler display depends upon when and where you have clicked. Some people like this non-linear method of reading the document, while others have reported that when many tiddlers have been opened, it can get somewhat confusing.\n\n!!!!!Usage\n<<<\nSinglePageMode allows you to configure TiddlyWiki to navigate more like a traditional multipage web site with only one item displayed at a time. When SinglePageMode is enabled, the title of the current tiddler is automatically displayed in the browser window's titlebar and the browser's location URL is updated with a 'permalink' for the current tiddler so that it is easier to create a browser 'bookmark' for the current tiddler.\n\nEven when SinglePageMode is disabled (i.e., displaying multiple tiddlers is permitted), you can reduce the potential for confusion by enable TopOfPageMode, which forces tiddlers to always open at the top of the page instead of being displayed following the tiddler containing the link that was clicked.\n<<<\n!!!!!Configuration\n<<<\nWhen installed, this plugin automatically adds checkboxes in the AdvancedOptions tiddler so you can enable/disable the plugin behavior. For convenience, these checkboxes are also included here:\n\n<<option chkSinglePageMode>> Display one tiddler at a time\n<<option chkTopOfPageMode>> Always open tiddlers at the top of the page\n<<<\n!!!!!Installation\n<<<\nimport (or copy/paste) the following tiddlers into your document:\n''SinglePageModePlugin'' (tagged with <<tag systemConfig>>)\n^^documentation and javascript for SinglePageMode handling^^\n\nWhen installed, this plugin automatically adds checkboxes in the ''shadow'' AdvancedOptions tiddler so you can enable/disable this behavior. However, if you have customized your AdvancedOptions, you will need to ''manually add these checkboxes to your customized tiddler.''\n<<<\n!!!!!Revision History\n<<<\n''2006.07.04 [2.2.1]'' in hijack for displayTiddlers(), suspend TPM as well as SPM so that DefaultTiddlers displays in the correct order.\n''2006.06.01 [2.2.0]'' added chkTopOfPageMode (TPM) handling\n''2006.02.04 [2.1.1]'' moved global variable declarations to config.* to avoid FireFox 1.5.0.1 crash bug when assigning to globals\n''2005.12.27 [2.1.0]'' hijack displayTiddlers() so that SPM can be suspended during startup while displaying the DefaultTiddlers (or #hash list). Also, corrected initialization for undefined SPM flag to "false", so default behavior is to display multiple tiddlers\n''2005.12.27 [2.0.0]'' Update for TW2.0\n''2005.11.24 [1.1.2]'' When the back and forward buttons are used, the page now changes to match the URL. Based on code added by Clint Checketts\n''2005.10.14 [1.1.1]'' permalink creation now calls encodeTiddlyLink() to handle tiddler titles with spaces in them\n''2005.10.14 [1.1.0]'' added automatic setting of window title and location bar ('auto-permalink'). feature suggestion by David Dickens.\n''2005.10.09 [1.0.1]'' combined documentation and code in a single tiddler\n''2005.08.15 [1.0.0]'' Initial Release\n<<<\n!!!!!Credits\n<<<\nThis feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]].\nSupport for BACK/FORWARD buttons adapted from code developed by Clint Checketts\n<<<\n!!!!!Code\n***/\n//{{{\nStory.prototype.displayTiddler = function(srcElement,title,template,animate,slowly)\n{\n var place = document.getElementById(this.container);\n var theTiddler = document.getElementById(this.idPrefix + title);\n if(theTiddler)\n this.refreshTiddler(title,template);\n else\n {\n var before = this.positionTiddler(srcElement);\n theTiddler = this.createTiddler(place,before,title,template);\n }\n if(srcElement && typeof srcElement !== "string")\n {\n if(anim && config.options.chkAnimate && (animate == undefined || animate == true))\n anim.startAnimating(new Cascade(title,srcElement,theTiddler,slowly),new Scroller(theTiddler,slowly));\n else\n window.scrollTo(0,0);\n }\n}\n\n\n\nversion.extensions.SinglePageMode= {major: 2, minor: 2, revision: 1, date: new Date(2006,7,3)};\n\nconfig.options.chkSinglePageMode=true;\n\nif (config.options.chkSinglePageMode==undefined) config.options.chkSinglePageMode=false;\nconfig.shadowTiddlers.AdvancedOptions += "\sn<<option chkSinglePageMode>> Display one tiddler at a time";\n\nif (config.options.chkTopOfPageMode==undefined) config.options.chkTopOfPageMode=false;\nconfig.shadowTiddlers.AdvancedOptions += "\sn<<option chkTopOfPageMode>> Always open tiddlers at the top of the page";\n\nconfig.SPMTimer = 0;\nconfig.lastURL = window.location.hash;\nfunction checkLastURL()\n{\n if (!config.options.chkSinglePageMode)\n { window.clearInterval(config.SPMTimer); config.SPMTimer=0; return; }\n if (config.lastURL == window.location.hash)\n return;\n var tiddlerName = convertUTF8ToUnicode(decodeURI(window.location.hash.substr(1)));\n tiddlerName=tiddlerName.replace(/\s[\s[/,"").replace(/\s]\s]/,""); // strip any [[ ]] bracketing\n if (tiddlerName.length) story.displayTiddler(null,tiddlerName,1,null,null);\n}\n\nif (Story.prototype.SPM_coreDisplayTiddler==undefined) Story.prototype.SPM_coreDisplayTiddler=Story.prototype.displayTiddler;\nStory.prototype.displayTiddler = function(srcElement,title,template,animate,slowly)\n{\n if (config.options.chkSinglePageMode) {\n window.location.hash = encodeURIComponent(String.encodeTiddlyLink(title));\n config.lastURL = window.location.hash;\n document.title = wikifyPlain("SiteTitle") + " - " + title;\n story.closeAllTiddlers();\n if (!config.SPMTimer) config.SPMTimer=window.setInterval(function() {checkLastURL();},1000);\n }\n if (config.options.chkTopOfPageMode) { story.closeTiddler(title); window.scrollTo(0,0); srcElement=null; }\n this.SPM_coreDisplayTiddler(srcElement,title,template,animate,slowly)\n}\n\nif (Story.prototype.SPM_coreDisplayTiddlers==undefined) Story.prototype.SPM_coreDisplayTiddlers=Story.prototype.displayTiddlers;\nStory.prototype.displayTiddlers = function(srcElement,titles,template,unused1,unused2,animate,slowly)\n{\n // suspend single-page mode when displaying multiple tiddlers\n var saveSPM=config.options.chkSinglePageMode; config.options.chkSinglePageMode=false;\n var saveTPM=config.options.chkTopOfPageMode; config.options.chkTopOfPageMode=false;\n this.SPM_coreDisplayTiddlers(srcElement,titles,template,unused1,unused2,animate,slowly);\n config.options.chkSinglePageMode=saveSPM; config.options.chkTopOfPageMode=saveTPM;\n}\n//}}}
Spring, 2007
CBE 20258 Computer Methods in Chemical Engineering
http://www.nd.edu/~jeff/Teaching/CBE20258/S2007/CBE20258.html
<!--{{{-->\n<div id='displayArea'>\n<div id='tiddlerDisplay'></div>\n</div>\n<!--}}}-->
/***\n|''Name:''|SlideShowPlugin|\n|''Description:''|Creates a simple slide show type display|\n|''Version:''|1.5.1|\n|''Date:''|Nov 10, 2006|\n|''Source:''|http://www.math.ist.utl.pt/~psoares/addons.html|\n|''Author:''|Paulo Soares (psoares (at) math (dot) ist (dot) utl (dot) pt) and [[Clint Checketts|http://www.checkettsweb.com]]|\n|''License:''|[[BSD open source license]]|\n|''~CoreVersion:''|2.1.0|\n|''Browser:''|Firefox 1.0.4+; Firefox 1.5; InternetExplorer 6.0|\n<<tiddler SlideShowPluginDoc>>\n!Code\n***/\n//{{{\nconfig.macros.slideShow = {label: "slide show", maxTOCLength: 30};\nconfig.macros.slideShow.messages = {gotoLabel: "Go to slide:"};\nconfig.views.wikified.slideShow = {text: "slide show", tooltip: "Start slide show"};\nconfig.views.wikified.slideShow.quit = {text: "end", tooltip: "Quit the slide show"};\nconfig.views.wikified.slideShow.firstSlide = {text: "<<", tooltip: "first slide"};\nconfig.views.wikified.slideShow.previousSlide = {text: "<", tooltip: "previous slide"};\nconfig.views.wikified.slideShow.nextSlide = {text: ">", tooltip: "next slide"};\nconfig.views.wikified.slideShow.lastSlide = {text: ">>", tooltip: "last slide"};\nconfig.views.wikified.slideShow.resetClock = {text: " ", tooltip: "reset"};\n\nconfig.formatters.push( {\n name: "SlideSeparator",\n match: "^-s-+$\s\sn?",\n handler: function(w)\n {\n createTiddlyElement(w.output,"hr",null,'slideSeparator');\n }\n}\n)\n\nfunction changeStyleSheet(tiddlerName) {\n if (tiddlerName == null) tiddlerName = "StyleSheet";\n setStylesheet(store.getRecursiveTiddlerText("StyleSheetColors"),"StyleSheetColors");\n setStylesheet(store.getRecursiveTiddlerText("StyleSheetLayout"),"StyleSheetLayout");\n var theCSS = store.getRecursiveTiddlerText(tiddlerName,"");\n setStylesheet(theCSS,"StyleSheet");\n}\n\n//Excellent (and versatile) reparser created by Paul Petterson for parsing the paramString in a macro\nfunction reparse( params ) {\n var re = /([^:\ss]+)(?:\s:((?:\sd+)|(?:["'](?:[^"']+)["']))|\ss|$)/g;\n var ret = new Array() ;\n var m ;\n while( (m = re.exec( params )) != null ) ret[ m[1] ] = m[2]?m[2]:true ;\n return ret ;\n}\n\nfunction getElementsByClass(searchClass,node,tag) {\n var classElements = new Array();\n if ( node == null ) node = document;\n if ( tag == null ) tag = '*';\n var els = node.getElementsByTagName(tag);\n var elsLen = els.length;\n var pattern = new RegExp("(^|\s\ss)"+searchClass+"(\s\ss|$)");\n var j=0;\n for (var i = 0; i < elsLen; i++) {\n if ( pattern.test(els[i].className) ) {\n classElements[j] = els[i];\n j++;\n }\n }\n return classElements;\n}\n\n// 'keys' code adapted from S5 which in turn was adapted from MozPoint (http://mozpoint.mozdev.org/)\nfunction keys(key) {\n if (document.getElementById('contentWrapper').className == "slideShowMode"){\n if (!key) {\n key = event;\n key.which = key.keyCode;\n }\n switch (key.which) {\n case 32: // spacebar\n if(time>0){\n if(autoAdvance){\n clearInterval(autoAdvance);\n autoAdvance = null;\n } else {\n autoAdvance=setInterval("GoToSlide(1)", time);\n }\n }\n break;\n case 34: // page down\n case 39: // rightkey\n GoToSlide("n");\n break;\n case 40: // downkey\n GoToSlide(-1);\n break;\n case 33: // page up\n case 37: // leftkey\n GoToSlide("p");\n break;\n case 38: // upkey\n GoToSlide(1);\n break;\n case 36: // home\n GoToSlide("f");\n break;\n case 35: // end\n GoToSlide("l");\n break;\n case 27: // escape\n endSlideShow();\n break;\n }\n\n }\n return false;\n}\n\nfunction clicker(e) {\n if (!e) var e = window.event;\n var target = resolveTarget(e);\n //Whenever something is clicked that won't advance the slide make sure that the table of contents gets hidden\n if (target.getAttribute('href') != null || isParentOrSelf(target, 'toc') || isParentOrSelf(target,'embed') || isParentOrSelf(target,'object') || isParentOrSelf(target, 'pageFooter') || isParentOrSelf(target, 'navigator')){\n //Don't hide the TOC if the indexNumbers (which trigger the index) is clicked\n if(isParentOrSelf(target,'indexNumbers') || isParentOrSelf(target,'jumpInput')){\n return true;\n }\n showHideTOC('none');\n return true;\n }\n \n //Advance a slide if the TOC is visible otherwise make sure that the TOC gets hidden\n if ((!e.which && e.button == 1) || e.which == 1) {\n if (document.getElementById('toc').style.display != 'block'){\n GoToSlide("n");\n } else {\n showHideTOC('none');\n }\n }\n \n if ((!e.which && e.button == 2) || e.which == 3) {\n if (document.getElementById('toc').style.display != 'block'){\n GoToSlide("p");\n } else {\n showHideTOC('none');\n }\n return false;\n }\n}\n\nfunction isParentOrSelf(element, id) {\n if (element == null || element.nodeName=='BODY') return false;\n else if (element.id == id) return true;\n else return isParentOrSelf(element.parentNode, id);\n}\n\nGoToSlide=function(step) {\n var new_pos;\n var slideHolder = document.getElementById('slideContainer');\n //The parse float ensures that the attribute is returned as a number and not a string.\n var cur_pos = parseFloat(slideHolder.getAttribute('currentslide'));\n var numberSlides = parseFloat(slideHolder.getAttribute('numberSlides'));\n switch (step) {\n case "f":\n new_pos=0;\n break;\n case "l":\n new_pos=numberSlides-1;\n break;\n case "n":\n var numberOverlays = parseFloat(slideHolder.childNodes[cur_pos].getAttribute('numberOverlays'));\n var currentOverlay = parseFloat(slideHolder.getAttribute('currentOverlay'));\n if(numberOverlays==0 || currentOverlay==numberOverlays){\n new_pos=cur_pos+1;\n } else {\n var className="Overlay"+currentOverlay;\n var overlay=getElementsByClass(className,slideHolder.childNodes[cur_pos]);\n for(var i=0; i<overlay.length; i++) {overlay[i].className=className+' previousOverlay';}\n currentOverlay++;\n slideHolder.setAttribute('currentOverlay',currentOverlay);\n className="Overlay"+currentOverlay;\n overlay=getElementsByClass(className,slideHolder.childNodes[cur_pos]);\n for(i=0; i<overlay.length; i++) {overlay[i].className=className+' currentOverlay';}\n return false;\n }\n break;\n case "p":\n var numberOverlays = parseFloat(slideHolder.childNodes[cur_pos].getAttribute('numberOverlays'));\n var currentOverlay = parseFloat(slideHolder.getAttribute('currentOverlay'));\n if(numberOverlays==0 || currentOverlay==0){\n new_pos=cur_pos-1;\n } else {\n var className="Overlay"+currentOverlay;\n var overlays=getElementsByClass(className,slideHolder.childNodes[cur_pos]);\n for(var i=0; i<overlays.length; i++) {overlays[i].className=className+' nextOverlay';}\n currentOverlay--;\n className="Overlay"+currentOverlay;\n overlays=getElementsByClass(className,slideHolder.childNodes[cur_pos]);\n for(i=0; i<overlays.length; i++) {overlays[i].className=className+' currentOverlay';}\n slideHolder.setAttribute('currentOverlay',currentOverlay);\n return false;\n }\n break;\n default:\n new_pos=cur_pos+step;\n }\n\n if(slideShowCircularMode && new_pos == numberSlides) new_pos=0;\n if(slideShowCircularMode && new_pos<0) new_pos=(numberSlides - 1);\n if(step!=0 && new_pos>=0 && new_pos<numberSlides) {\n slideHolder.childNodes[cur_pos].style.display='none';\n slideHolder.childNodes[new_pos].style.display='block';\n slideHolder.setAttribute('currentslide',new_pos);\n var numberOverlays = parseFloat(slideHolder.childNodes[new_pos].getAttribute('numberOverlays'));\n if(step=="p"){\n var currentOverlay=numberOverlays;\n var state=' previousOverlay';\n } else {\n var currentOverlay=0;\n var state=' nextOverlay';\n }\n slideHolder.setAttribute('currentOverlay',currentOverlay);\n if(numberOverlays>0) {\n for(var i=1; i<=numberOverlays; i++){\n var className="Overlay"+i;\n var overlays=getElementsByClass(className,slideHolder.childNodes[new_pos]);\n for(var j=0; j<overlays.length; j++) {overlays[j].className=className+state;}\n }\n if(step=="p"){\n var className="Overlay"+numberOverlays;\n var overlays=getElementsByClass(className,slideHolder.childNodes[new_pos]);\n for(var j=0; j<overlays.length; j++) {overlays[j].className=className+' currentOverlay';}\n }\n }\n new_pos++;\n var indexNumbers = document.getElementById('indexNumbers');\n indexNumbers.firstChild.data = new_pos+'/'+numberSlides;\n if((new_pos==numberSlides) && !slideShowCircularMode && autoAdvance) clearInterval(autoAdvance);\n return true;\n }\n return false;\n}\n\nfunction tocShowSlide(e) {\n if (!e) var e = window.event;\n var target = resolveTarget(e);\n var slide = target.getAttribute('slideNumber');\n var cur_pos = document.getElementById('slideContainer').getAttribute('currentslide');\n var step = slide-cur_pos;\n if(step!=0) GoToSlide(step);\n showHideTOC('none');\n return;\n}\n\n//Toggle the display of the table of contents\nfunction showHideTOC(display){\n var toc = document.getElementById('toc');\n //Reset the input box\n document.getElementById('jumpInput').value = "";\n\n if (display == null || display.length == null){\n if (toc.style.display == 'none' || toc.style.display == ''){\n toc.style.display = 'block';\n document.getElementById('jumpInput').focus();\n } else {\n toc.style.display = 'none';\n }\n } else {\n toc.style.display = display;\n if (display == 'block')\n document.getElementById('jumpInput').focus();\n }\n}\n\nfunction makeSignature(title,params){\n var signature = title+store.getTiddler(title).modified;\n if(params['style']) signature += params['style'];\n if(params['repeat']) signature += "repeat";\n if(params['slidePause'] > 0) signature += params['slidePause'];\n if(params['autostart']) signature += "autostart";\n if(params['clock']) signature += params['clock'];\n if(params['noOverlays']) signature += "noOverlays";\n return signature;\n}\n\nfunction padZero(x){\n return (x>=10 || x<0 ? "" : "0")+x;\n}\n\nsetClock=function(){\n var actualTime = new Date();\n var newTime = actualTime.getTime() - clockStartTime;\n newTime = clockMultiplier*newTime+clockInterval+clockCorrection;\n actualTime.setTime(newTime);\n newTime = padZero(actualTime.getHours()) + ":" + padZero(actualTime.getMinutes())+ ":" + padZero(actualTime.getSeconds());\n var clock = document.getElementById('slideClock');\n clock.firstChild.nodeValue = newTime;\n}\n\nresetClock=function(){\n var time = new Date(0);\n if(clockStartTime>time){\n var startTime = new Date();\n clockStartTime=startTime.getTime();\n }\n}\n\nvar title;\nvar place;\nvar autoAdvance=null;\nvar autoStart=null;\nvar slideClock=null;\nvar noOverlays=false;\nvar time = 0;\nvar slideShowCircularMode;\nvar slideShowStyleSheet;\nvar slideShowParams;\nvar clockMultiplier;\nvar clockInterval;\nvar clockCorrection=0;\nvar clockStartTime;\nvar openTiddlers;\n\nconfig.macros.slideShow.handler = function(aPlace,macroName,params,wikifier,paramString,tiddler){\n if(tiddler instanceof Tiddler){\n var lingo = config.views.wikified.slideShow;\n var autostart = false;\n if (!e) var e = window.event;\n \n place = aPlace;\n title = tiddler.title;\n params = reparse(paramString);\n var onclick = function(){config.macros.slideShow.onClickSlideShow(params);};\n createTiddlyButton(aPlace,lingo.text,lingo.tooltip,onclick);\n \n var slideShowHolder = document.getElementById('slideShowWrapper');\n //If no show exist previously, create it\n if(params['autostart']){\n if(slideShowHolder != null){\n var signature = slideShowHolder.getAttribute('showSignature');\n if(signature.indexOf("autostart")==-1) autostart = true;\n } else {autostart = true;}\n if(autostart){\n slideShowParams = params;\n setTimeout(config.macros.slideShow.onClickSlideShow,100);\n }\n }\n }\n}\n\nvar disableFunction = function(e){return false;}\nvar enableFunction = function(e){}\n\nconfig.macros.slideShow.onClickSlideShow = function(newParams) {\n if(typeof(newParams)=="number") newParams=slideShowParams;\n openTiddlers = new Array;\n var viewer=document.getElementById('tiddlerDisplay');\n for(var i=0; i<viewer.childNodes.length; i++){\n var name = viewer.childNodes[i].getAttribute('tiddler');\n openTiddlers.push(name);\n }\n document.oncontextmenu = disableFunction;\n clockMultiplier = 1;\n clockInterval = 0;\n var startTime = new Date(0);\n slideShowCircularMode = false;\n time = 0;\n slideShowStyleSheet = null;\n if(newParams['style']){\n slideShowStyleSheet = eval(newParams['style']);\n } \n if(newParams['repeat']){\n slideShowCircularMode = true;\n }\n if(newParams['slidePause'] > 0){\n time = newParams['slidePause'];\n }\n if(newParams['clock']){\n clockCorrection=startTime.getTimezoneOffset()*60000;\n startTime = new Date();\n var clockType= eval(newParams['clock']);\n if(clockType != '+') {\n clockMultiplier = -1;\n clockInterval = -clockType*60000;\n }\n }\n clockStartTime=startTime.getTime();\n if(newParams['noOverlays']){\n noOverlays = true;\n }\n var contentWrapper = document.getElementById('contentWrapper');\n if (contentWrapper.className != "slideShowMode"){\n clearMessage();\n //Attach the key and mouse listeners\n document.onkeyup = keys;\n document.onmouseup = clicker;\n \n var slideShowHolder = document.getElementById('slideShowWrapper');\n story.refreshTiddler(title,"SlideShowViewTemplate",true);\n //If no show exist previously, create it\n if(slideShowHolder == null){\n createSlides(newParams);\n //If there was once waiting in the background and it matches the one we just started, resume it\n } else if (slideShowHolder.getAttribute('showSignature') == makeSignature(title,newParams)){\n \n //Remove dblClick on edit function\n var theTiddler = document.getElementById("tiddler"+title);\n theTiddler.ondblclick = function() {};\n\n // Grab the 'viewer' element and give it a signature so the show can be resumed if stopped\n var tiddlerElements = theTiddler.childNodes;\n var viewer;\n for (var i = 0; i < tiddlerElements.length; i++){\n if (tiddlerElements[i].className == "viewer") viewer = tiddlerElements[i];\n }\n theTiddler.insertBefore(slideShowHolder,viewer);\n theTiddler.removeChild(viewer);\n slideShowHolder.style.display = 'block';\n document.getElementById("pageFooter").className = "pageFooterOff";\n \n //If the show we started it totally new than the resumable one, create the new one and kill the resumable one\n } else {\n slideShowHolder.parentNode.removeChild(slideShowHolder);\n createSlides(newParams);\n }\n slideClock=setInterval("setClock()", 1000); \n if(time>0) autoAdvance=setInterval("GoToSlide(1)", time); \n story.closeAllTiddlers(title);\n toggleSlideStyles();\n } else {\n endSlideShow();\n }\n return ;\n \n}\n\nfunction endSlideShow(){\n //Set aside show so it can be resumed later\n var showHolder = document.getElementById('slideShowWrapper');\n showHolder.style.display = 'none';\n document.getElementById('contentWrapper').parentNode.appendChild(showHolder);\n document.oncontextmenu = enableFunction;\n if(autoAdvance) clearInterval(autoAdvance);\n if(slideClock) clearInterval(slideClock);\n story.refreshTiddler(title,null,true);\n story.closeAllTiddlers();\n toggleSlideStyles();\n story.displayTiddlers(null,openTiddlers,DEFAULT_VIEW_TEMPLATE);\n document.onmouseup = function(){};\n}\n\nfunction isInteger(s){\n var i;\n for (i = 0; i < s.length; i++){\n // Check that current character is number.\n var c = s.charAt(i);\n if (((c < "0") || (c > "9"))) return false;\n }\n // All characters are numbers.\n return true;\n}\n\nfunction jumpInputToSlide(e){\n if (!e) {\n e = window.event;\n e.which = e.keyCode;\n }\n if(e.which==13){\n var jumpInput= document.getElementById("jumpInput").value;\n if(isInteger(jumpInput)){\n var step=jumpInput-document.getElementById('slideContainer').getAttribute('currentslide')-1;\n if (GoToSlide(step)){\n showHideTOC('none'); \n }\n }\n }\n return;\n}\n\n//Used to shorten the TOC fields\nfunction abbreviateLabel(label){\n var maxTOCLength = config.macros.slideShow.maxTOCLength;\n if(label.length>maxTOCLength) {\n var temp = new Array();\n temp = label.split(' ');\n label = temp[0];\n for(var j=1; j<temp.length; j++){\n if((label.length+temp[j].length)<=maxTOCLength){\n label += " " + temp[j];\n } else {\n label += " ...";\n break;\n }\n }\n }\n return label;\n}\n\ncreateSlides = function(newParams){\n var lingo = config.views.wikified.slideShow;\n\n //Remove dblClick on edit function\n var theTiddler = document.getElementById("tiddler"+title);\n theTiddler.ondblclick = function() {};\n\n // Grab the 'viewer' element and give it a signature so the show can be resumed if stopped\n var tiddlerElements = theTiddler.childNodes;\n var viewer;\n for (var i = 0; i < tiddlerElements.length; i++){\n if (tiddlerElements[i].className == "viewer") viewer = tiddlerElements[i];\n }\n viewer.id = 'slideShowWrapper';\n viewer.setAttribute("showSignature",makeSignature(title,newParams));\n\n //Hide the text that comes before the first H1 element (I think I may put this into a cover page type thing)\n while(viewer.childNodes.length > 0 && viewer.firstChild.nodeName.toUpperCase() != "HR" && viewer.firstChild.className!="slideSeparator") {\n viewer.removeChild(viewer.firstChild);\n }\n \n //Cycle through the content and each time you hit an H1 begin a new slide div\n var slideNumber = 0;\n var slideHolder = document.createElement('DIV');\n slideHolder.id = "slideContainer";\n \n while(viewer.childNodes.length > 0){\n //Create a new slide a append it to the slide holder\n if (viewer.firstChild.nodeName.toUpperCase() == "HR" && viewer.firstChild.className=="slideSeparator"){\n slideNumber++;\n var slide = document.createElement('DIV');\n slide.id = "slideNumber"+slideNumber;\n slide.className = "slide";\n if (slideNumber > 1) {\n slideHolder.setAttribute('currentslide',0);\n slide.style.display='none';\n } else {\n slide.style.display='block';\n }\n slideHolder.appendChild(slide); \n viewer.removeChild(viewer.firstChild);\n } else {\n if(viewer.firstChild.nodeName=="SPAN" && viewer.firstChild.className=="" && viewer.firstChild.hasChildNodes()) {\n var anchor=viewer.firstChild.nextSibling;\n for (var ii=0;ii<viewer.firstChild.childNodes.length;ii++) {\n var clone=viewer.firstChild.childNodes[ii].cloneNode(true);\n viewer.insertBefore(clone,anchor);\n }\n viewer.removeChild(viewer.firstChild);\n } else {\n slide.appendChild(viewer.firstChild);\n }\n }\n }\n \n //Stick the slides back into the viewer\n viewer.appendChild(slideHolder);\n slideHolder.setAttribute('numberSlides',slideNumber);\n \n //Create the navigation bar\n var pagefooter = createTiddlyElement(viewer,"DIV","pageFooter","pageFooterOff");\n var navigator = createTiddlyElement(pagefooter,"SPAN","navigator");\n\n //Make it so that when the footer is hovered over the class will change to make it visible\n pagefooter.onmouseover = function () {pagefooter.className = "pageFooterOn"};\n pagefooter.onmouseout = function () {pagefooter.className = "pageFooterOff"};\n\n //Create the control button for the navigation \n var onClickQuit = function(){endSlideShow();};\n createTiddlyButton(navigator,lingo.quit.text,lingo.quit.tooltip,onClickQuit);\n createTiddlyButton(navigator,lingo.firstSlide.text,lingo.firstSlide.tooltip,first_slide);\n createTiddlyButton(navigator,lingo.previousSlide.text,lingo.previousSlide.tooltip,previous_slide);\n createTiddlyButton(navigator,lingo.nextSlide.text,lingo.nextSlide.tooltip,next_slide);\n createTiddlyButton(navigator,lingo.lastSlide.text,lingo.lastSlide.tooltip,last_slide); \n createTiddlyButton(navigator,lingo.resetClock.text,lingo.resetClock.tooltip,resetClock,"button","slideClock"); \n\n var indexNumbers = createTiddlyElement(pagefooter,"SPAN","indexNumbers","indexNumbers","1/"+slideNumber)\n indexNumbers.onclick = showHideTOC;\n var toc = createTiddlyElement(pagefooter,"UL","toc");\n var ovl=1;\n for (var i=0;i<slideHolder.childNodes.length;i++) {\n if(!noOverlays) {\n var ovl=1;\n while(1){\n var className="Overlay"+ovl;\n var overlays=getElementsByClass(className,slideHolder.childNodes[i]);\n if(overlays.length>0){\n for(var j=0; j<overlays.length; j++) {overlays[j].className+=' nextOverlay';}\n ovl++;\n } else {break;}\n }\n }\n slideHolder.childNodes[i].setAttribute("numberOverlays",ovl-1);\n slideHolder.setAttribute("currentOverlay",0);\n\n //Loop through each slide and check the header's content\n var tocLabel = null; \n for (var j=0;j<slideHolder.childNodes[i].childNodes.length;j++) {\n var node = slideHolder.childNodes[i].childNodes[j];\n if(node.nodeName=="H1" || node.nodeName=="H2" || node.nodeName=="H3" || node.nodeName=="H4") {\n var htstring = node.innerHTML;\n var stripped = htstring.replace(/(<([^>]+)>)/ig,"");\n tocLabel = abbreviateLabel(stripped);\n var tocLevel="tocLevel"+node.nodeName.charAt(1);\n var tocItem = createTiddlyElement(toc,"LI",null,tocLevel);\n var tocLink = createTiddlyElement(tocItem,"A",null,"tocItem",tocLabel);\n tocLink.setAttribute("slideNumber",i);\n tocLink.onclick=tocShowSlide;\n }\n }\n }\n \n\n //Input box to jump to s specific slide\n var tocItem = createTiddlyElement(toc,"LI",null,"tocJumpItem",config.macros.slideShow.messages.gotoLabel);\n var tocJumpInput = createTiddlyElement(tocItem,"INPUT","jumpInput");\n tocJumpInput.type="text";\n tocJumpInput.onkeyup=jumpInputToSlide;\n}\n\nvar next_slide= function(e){GoToSlide(1);}\nvar first_slide= function(e){GoToSlide("f");}\nvar previous_slide= function(e){GoToSlide(-1);}\nvar last_slide= function(e){GoToSlide("l");}\n\nfunction toggleSlideStyles(){\n var contentWrapper = document.getElementById('contentWrapper');\n if (contentWrapper.className == "slideShowMode"){\n contentWrapper.className = "";\n window.applyPageTemplate();\n if(slideShowStyleSheet) changeStyleSheet();\n } else{\n contentWrapper.className = "slideShowMode";\n window.applyPageTemplate("SlideShowPageTemplate");\n if(slideShowStyleSheet) changeStyleSheet(slideShowStyleSheet);\n }\n}\n\nsetStylesheet("/***\sn!Slide Mode Styles\sn***/\sn/*{{{*/\sn#contentWrapper.slideShowMode #slideContainer{\sn display: block;\sn}\sn\sn#contentWrapper.slideShowMode .Comment{\sn display: none;\sn}\sn\sn#contentWrapper.slideShowMode .nextOverlay{\sn visibility: hidden;\sn}\sn\sn#contentWrapper.slideShowMode .currentOverlay{\sn visibility: visible;\sn}\sn\sn#contentWrapper.slideShowMode .previousOverlay{\sn visibility: visible;\sn}\sn\sn#jump{\sn text-align: right;\sn}\sn\sn.pageFooterOff #navigator{\sn visibility: hidden;\sn}\sn\sn.pageFooterOn #navigator{\sn visibility: visible;\sn}\sn\sn#contentWrapper.slideShowMode #slideClock{\sn cursor: pointer; margin: 0 5px 0 5px; border: 1px solid #db4\sn}\sn\sn#contentWrapper.slideShowMode,\sn #contentWrapper.slideShowMode #displayArea{\sn width: 100%;\sn font-size: 1.5em;\sn margin: 0 !important;\sn padding: 0;\sn}\sn\sn#slideContainer{\sn display: none;\sn}\sn\sn.indexNumbers{\sn cursor: pointer;\sn}\sn\sn#navigator{\sn visibility: hidden;\sn bottom: 0;\sn}\sn\sn#toc{\sn display: none;\sn position: absolute;\sn font-size: .75em;\sn bottom: 2em;\sn right: 0;\sn background: #fff;\sn border: 1px solid #000;\sn text-align: left;\sn}\sn\snul#toc, #toc li{\sn margin: 0;\sn padding: 0;\sn list-style: none;\sn line-height: 1em;\sn}\sn\sn.tocJumpItem{\sn margin-right: 2em;\sn}\sn\sn.tocJumpItem input{\snmargin-right: 1em;\sn border: 0;\sn}\sn\sn#toc a,\sn#toc a.button{\sn display: block;\sn padding: .1em;\sn}\sn\sn#toc .tocLevel1{\snfont-size: .8em;\sn}\sn\sn#toc .tocLevel2{\sn margin-left: 1em;\sn font-size: .75em;\sn}\sn\sn#toc .tocLevel3{\sn margin-left: 2em;\snfont-size: .75em;\sn}\sn\sn#toc .tocLevel4{\sn margin-left: 3em;\snfont-size: .65em;\sn}\sn\sn#toc a{\sn cursor: pointer;\sn}\sn\snh1{\sn min-height: 1em;\sn}\sn\sn.slide h1{\sn min-height: 0;\sn}\sn\sn/* The '&gt;' selector is ignored by IE6 and earlier so the proper rules are given */\sn#pageFooter{\sn position: fixed;\sn bottom: 2px;\sn right: 2px;\sn width: 100%;\sn text-align: right;\sn}\sn\sn/* This is a hack to trick IE6 and earlier to put the navbar on the bottom of the page */\sn* html #pageFooter {\sn position: absolute;\sn width: 100%;\sn text-align: right;\sn right: auto; bottom: auto;\sn left: expression( ( -20 - pageFooter.offsetWidth + ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth ) + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );\sn top: expression( ( -10 - pageFooter.offsetHeight + ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );\sn}\sn\sn\sn\sn/*}}}*/","slideShowStyles");\n//}}}
/* Centering for tables. Then align table with {{tablecenter{ ...}}} */\n\n.tablecenter { text-align: center; }\n.tablecenter table { margin-left: auto; margin-right: auto; text-align:left; } \n\n/* SlideSheet Specific Styles */\n\nbody { background: #ffffff; color: #000; font: 14px Arial, sans-serif; }\nh1, h2, h3, h4, h5, h6 {\n font-size: 1.2em; margin-top: 0em; margin-bottom: 0.5em;\n background: #eeeeee;-moz-border-radius: 0.5em; padding:0.2em;}\n\n.tiddler { background: #ffffff; padding: 0.5em 2em 1em 2em; margin-bottom: 1em; border: none;}\n.viewer .button { background: #eeeeee; color: #000; font-size: 0.75em; border: none; -moz-border-radius: 0.5em; }\n.viewer .button:hover { background: #eeeeee; color: #fffaae; }\n.title { text-align: left; font-size: 0em; background: #eeeeee; -moz-border-radius: 0.5em; padding: 0.2em;}\n\n#jsMath_button { display: none;}\n/*.pageFooterOff #navigator{ visibility: visible; }*/\n/* remove clock slideClock{ display: none;}*/
<!--{{{-->\n<div class='title' macro='view title'></div>\n<div class='viewer' macro='view text wikified'></div>\n<!--}}}-->
Software systems used in the course will be available on computing clusters located in Engineering College Computing Laboratories. In addition, every effort will be made to facilitate student owned desktop and laptop computers. Software used for the course will include:\n#Matlab Student Edition (Avialable for Windows, Intel based Macintosh, and Linux platforms).\n**Matlab\n**Simulink\n**Maple Symbolic Math Toolbox\n#COMSOL\n#Microsoft Excel or similar spreadsheet software.\n#Firefox 2.0 or Internet Explorer 7.0 Browser
! Recommended Software for CBE 20258\n\n# Core Tools\n** <<tiddler matlab>>\n** Microsoft Excel\n** Mozilla Foundation Firefox\n# Other Software you may find useful\n** TiddlyWiki\n** \n# Data Sources and Tools\n** Matlab XML Parser Home โ€“ www.geodise.org/...\n** XML file reading in Matlab using a Java validating XML Parser www.cs.adelaide.edu.au/~hengel/Vision/DataRepository/readImageSetData.m โ€“ www.cs.adelaide.edu.au/...\n** The ThermoML IUPAC Standard ThermoML โ€“ trc.nist.gov/...\n# Useful Matlab Tools\n** plot2svg.m Save Matlab 2D and 3D graphics in svg (scaled vector graphics) format. The svg format is supported directly in recent releases of the Firefox and Internet Explorer browsers. (Safari too?), or through a plugin distributed at no cost by Adobe.
<<slideShow style:"SlideShowStyleSheet">>\n-s-\n!Applications\nWhatever your interests or choice of career, you frequently encounter the task of solving an equation for an unknown variable. Sometimes the task has a clean mathematical formulation, such as \n* Use the Redlich-Kwong equation of state to determine the density of a gas for given process conditions\n* Solve for the interest rate needed to provide a specified income for a given bond\n-s-\nOther times the 'equation' corresponds to a physical or experimental situation\n* How far do I press the accelerator pedal to maintain a speed of 60 mph in my car?\n* What dose of a statin drug should be prescribed to maintain a blood cholesterol level of 150mg/liter?\n-s-\n!Problem Statement\nGiven:\n* a function $f(x)$\n* an initial estimate $x_0$\nFind a value $\sbar{x}$ that satisfies $$f(\sbar{x}) = 0$$\n-s-\n!Potential Pitfalls\nThere are many issues to understand as you tackle a given problem:\n# $f(x)$ is a rule for measuring an outcome corresponding to a choice of $x$. How is $f(x)$ specified?\n** Closed form mathematical equation\n** Numerical calculation\n** Experimental outcome\n# Is there a unique value for $f(x)$?\n#Is there measurement error?\n-s-\n!Additional Questions\n# Is there any value at all for which $f(\sbar{x}) = 0$? (Existence)\n# Is there more than one solution to $f(\sbar{x}) = 0$? (Uniqueness)\n# Do we have a reasonable starting guess?\n# How expensive is it to obtain values $f(x)$?\n# Can we also obtain values for $\sfrac{df}{dx}$?\n-s-\n!Four Techniques\nWe are going to examine four straightforward techniques for equation solving for which every engineer should have a sound working knowledge:\n* Bisection Search\n* Regula-Falsi\n* Secant Method\n* Newton-Raphson\n-s-\n!Bisection Search (the guessing game)\n!Regula-Falsi (False Root)\n!Secant Method (interpolation)\n!Newton-Raphson (help from Isaac)\n\n-s-\n!Summary\n|!Technique|!Update|!Termination Criteria|\n|Bisection|||\n|Regula-Falsi|||\n|Secant|||\n|Newton-Raphson|||\n\n\n\n\n\n
Student evaluations will be based on the quality of work submitted during the course of the semester.\n{{tablecenter{\n|Class participation|Bonus|\n|Successful completion of problem sets|10%|\n|First Mid-term examination|20%|\n|Second Mid-term examination|20%|\n|Semester Project|20%|\n|Final examination|30%|\n}}}\nI will reduce the weight of your lowest exam grade by 50% to provide some limited insurance against anomolous results.\n
\n/***\nPlace your custom CSS here\n***/\n/*{{{*/\n\n\n.viewer {\n line-height: 120%;\n font-family: sans-serif;\n font-size: 10pt;\n}\n\n/* Vertical Alignment for tables cells */\n.viewer td { vertical-align: top; }\n\n[[SideBarWG]]\n\n/***\n!Top Menu Styles\n***/\n/*{{{*/\n#topMenu br {display:none; }\n#topMenu { background: #000 ; color:#fff;padding: 1em 1em;}\n/*}}}*/\n\n/***\n!General\n***/\n/*{{{*/\nbody {\n background: #444;\n margin: 0 auto;\n}\n\n #contentWrapper{\n background: #fff;\n border: 0;\n margin: 0 1em;\n\n padding:0;\n}\n/*}}}*/\n\n/***\n!Header rules\n***/\n/*{{{*/\n.titleLine{\n margin: 38px 3em 0em 0em;\nmargin-left:1.7em;\nmargin-bottom: 28px;\n padding: 0;\n text-align: left;\n color: #fff;\n}\n\n.siteTitle {\n font-size: 2em;\n font-weight: bold;\n}\n\n.siteSubtitle {\n font-size: 1.1em;\n display: block;\n margin: .5em auto 1em;\n}\n\n.gradient {margin: 0 auto; border-bottom:1px solid #000;}\n\n.header {\n background: #fff; \n margin: 0 0em;\n padding:0 12px;\n}\n/*}}}*/\n\n\n/***\n!Display Area\n***/\n/*{{{*/\n#bodywrapper {margin:0 12px; padding:0;background:#fff; height:1%}\n\n#displayArea{\n margin: 0em 16em 0em 14em;\n text-align: left;\n}\n\n.tiddler {\n padding: 1em 1em 0em 0em;\n}\n\nh1,h2,h3,h4,h5 { color: #000; background: transparent; padding-bottom:2px; border-bottom: 1px dotted #666; }\n.title {color:black; font-size:1.8em; border-bottom:1px solid #333; padding-bottom:0.3px;}\n.subtitle { font-size:90%; color:#ccc; padding-left:0.25em; margin-top:0.1em; }\n\n.shadow .title {\n color: #aaa;\n}\n\n.tagClear{\n clear: none; \n}\n\n* html .viewer pre {\n margin-left: 0em;\n}\n\n* html .editor textarea, * html .editor input {\n width: 98%;\n}\n\n.tiddler {margin-bottom:1em; padding-bottom:0em;}\n\n\n.toolbar .button {color:#bbb; border:none;}\n.toolbar .button:hover, .toolbar .highlight, .toolbar .marked, .toolbar a.button:active {background:transparent; color:#111; border:none; text-decoration:underline;}\n\n#sidebar .highlight, #sidebar .marked {background:transparent;}\n\n.tagging, .tagged {\n border: 1px solid #eee;\n background-color: #F7F7F7;\n}\n\n.selected .tagging, .selected .tagged {\n background-color: #eee;\n border: 1px solid #bbb;\n}\n\n .tagging .listTitle, .tagged .listTitle {\n color: #bbb;\n}\n\n.selected .tagging .listTitle, .selected .tagged .listTitle {\n color: #222; \n}\n\n\n.tagging .button:hover, .tagged .button:hover {\n border: none; background:transparent; text-decoration:underline; color:#000;\n}\n\n.tagging .button, .tagged .button {\n color:#aaa;\n}\n\n.selected .tagging .button, .selected .tagged .button {\n color:#000;\n}\n\n.viewer blockquote {\n border-left: 3px solid #000;\n}\n\n.viewer pre, .viewer code {\n border: 1px dashed #ccc;\n background: #eee;}\n\n.viewer hr {\n border: 0;\n border-top: solid 1px #333;\n margin: 0 8em;\n color: #333;\n}\n\n.highlight, .marked {background:transparent; color:#111; border:none; text-decoration:underline;}\n\n.viewer .highlight, .viewer .marked {text-decoration:none;}\n\n#sidebarTabs .highlight, #sidebarTabs .marked {color:#000; text-decoration:none;}\n\n.tabSelected {\n color: #000;\n background: #fff;\n border-top: solid 1px #ccc;\n border-left: solid 1px #ccc;\n border-right: solid 1px #ccc;\n border-bottom: none;\n}\n\n.viewer .tabSelected:hover{color:#000;}\n\n.viewer .tabSelected {font-weight:bold;}\n\n.tabUnselected {\n color: #999;\n background: #eee;\n border-top: solid 1px #ccc;\n border-left: solid 1px #ccc;\n border-right: solid 1px #ccc;\n border-bottom: solid 1px #ccc;\n padding-bottom:1px;\n}\n\n.tabContents {\n background: #fff;\n color: #000;\n}\n/*}}}*/\n/***\n!!!Tables\n***/\n/*{{{*/\n.viewer table {\n border: 1px solid #000;\n}\n\n.viewer th, thead td {\n background: #000;\n border: 1px solid #000;\n color: #fff;\n}\n\n.viewer td, .viewer tr {\n border: 1px solid #111; padding:4px;\n}\n/*}}}*/\n\n\n/***\n!!!Editor area\n***/\n/*{{{*/\n.editor input, .editor textarea {\n border: 1px solid #ccc;\n}\n\n.editor {padding-top:0.3em;}\n\n.editor textarea:focus, .editor input:focus {\n border: 1px solid #333;\n}\n/*}}}*/\n\n/***\n!Sidebar\n***/\n/*{{{*/\n#sidebar{\nposition:relative;\nfloat:right;\nmargin-bottom:1em;\ndisplay:inline;\nwidth: 16em;\n}\n\n#sidebarOptions .sliderPanel {\n background: #eee; border:1px solid #ccc;\n}\n\n/*}}}*/\n\n/***\n!Body Footer rules\n***/\n/*{{{*/\n#contentFooter {\n text-align: center;\n clear: both;\n color:#fff;\n background: #000;\n padding: 1em 2em;\nfont-weight:bold;\n}\n\n/*}}}*/\n/***\n!Link Styles\n***/\n/*{{{*/\na{\n color: #000;\n}\n\na:hover{\n color: #ED700B;\n background:#fff;\n}\n\n\n.button {\n color: #000;\n border: 1px solid #fff;\n}\n\n.button:hover {\n color: #fff;\n background: #ED700B;\n border-color: #000;\n}\n\n.button:active {\n color: #fff;\n background: #ED700B;\n border: 1px solid #000;\n}\n\n.tiddlyLink {border-bottom: 1px dotted #000;}\n.tiddlyLink:hover {border-bottom: 1px dotted #ED700B;} \n\n.titleLine a {border-bottom: 1px dotted #FF9900;}\n\n.titleLine a:hover {border-bottom: 1px dotted #fff;}\n\n.siteTitle a, .siteSubtitle a{\n color: #fff;\n}\n\n.viewer .button {border: 1px solid #ED700B; font-weight:bold;}\n.viewer .button:hover, .viewer .marked, .viewer .highlight{background:#ED700B; color:#fff; font-weight:bold; border: 1px solid #000;}\n\n#topMenu .button, #topMenu .tiddlyLink {\n margin-left:0.5em; margin-right:0.5em;\n padding-left:3px; padding-right:3px;\n color:white; font-weight:bold;\n}\n#topMenu .button:hover, #topMenu .tiddlyLink:hover { background:#000; color:#FF8814}\n\n#topMenu a{border:none;}\n/*}}}*/\n\n/***\n!Message Area /%=================================================%/\n***/\n/*{{{*/\n#messageArea {\n border: 4px dotted #ff8614;\n background: #000;\n color: #fff;\n font-size:90%;\n}\n\n#messageArea .button {\n padding: 0.2em;\n color: #000;\n background: #fff;\n text-decoration:none;\n font-weight:bold;\n border:1px solid #000; \n}\n\n#messageArea a {color:#fff;}\n\n#messageArea a:hover {color:#ff8614; background:transparent;}\n\n#messageArea .button:hover {background: #FF8614; color:#fff; border:1px solid #fff; }\n\n/*}}}*/\n\n/***\n!Popup /%=================================================%/\n***/\n/*{{{*/\n.popup {\n background: #ff8814;\n border: 1px solid #333;\n}\n\n.popup hr {\n color: #333;\n background: #333;\n border-bottom: 1px;\n}\n\n.popup li.disabled {\n color: #333;\n}\n\n.popup li a, .popup li a:visited {\n color: #eee;\n border: none;\n}\n\n.popup li a:hover {\n background: #ff8614;\n color: #fff;\n border: none;\n text-decoration:underline;\n}\n\n.searchBar {float:right; font-size:1em;}\n.searchBar .button {display:block; border:none; color:#ccc; }\n.searchBar .button:hover{border:none; color:#eee;}\n\n.searchBar input{\n border: 1px inset #000; background:#EFDFD1; width:10em; margin:0;\n}\n\n.searchBar input:focus {\n border: 1px inset #000; background:#fff;\n}\n\n*html .titleLine {margin-right:1.3em;}\n\n*html .searchBar .button {margin-left:1.7em;}\n\n .HideSideBarButton {float:right;} \n/*}}}*/\n\n.blog h2, .blog h3, .blog h4{\n margin:0;\n padding:0;\nborder-bottom:none;\n}\n.blog {margin-left:1.5em;} \n\n\n.blog .excerpt {\n margin:0;\nmargin-top:0.3em;\n padding: 0;\n margin-left:1em;\n padding-left:1em;\n font-size:90%;\n border-left:1px solid #ddd;\n}\n\n#tiddlerWhatsNew h1, #tiddlerWhatsNew h2 {border-bottom:none;}\ndiv[tags~="RecentUpdates"], div[tags~="lewcidExtension"] {margin-bottom: 2em;}\n\n#hoverMenu .button, #hoverMenu .tiddlyLink {border:none; font-weight:bold; background:#f37211; color:#fff; padding:0 5px; float:right; margin-bottom:4px;}\n#hoverMenu .button:hover, #hoverMenu .tiddlyLink:hover {font-weight:bold; border:none; color:#f37211; background:#000; padding:0 5px; float:right; margin-bottom:4px;}\n\n#topMenu .fontResizer {float:right;}\n\n#topMenu .fontResizer .button{border:1px solid #000;}\n#topMenu .fontResizer .button:hover {border:1px solid #f37211; color:#fff;}\n#sidebarTabs .txtMainTab .tiddlyLinkExisting {\n font-weight: normal;\n font-style: normal;\n}\n\n#sidebarTabs .txtMoreTab .tiddlyLinkExisting {\n font-weight: bold;\n font-style: normal;\n}\n\n\n\n\n\n#displayArea {margin-right:1em;}\n\n.headerShadow {\n position: relative;\n padding: 2.5em 0em 1em 1em;\n left: -1px;\n top: -1px;\n}\n\n.headerForeground {\n position: absolute;\n padding: 2.5em 0em 1em 1em;\n left: 0px;\n top: 0px;\n}\n\n.siteTitle {\n font-size: 2.5em;\n}\n\n.siteSubtitle {\n font-size: 1.2em;\n}\n\n#mainMenu {float:left; position:relative;}\n\n\n.viewer .button {border: 1px solid #ED700B; font-weight:bold;}\n.viewer .button:hover, .viewer .marked, .viewer .highlight{background:#ED700B; color:#fff; font-weight:bold; border: 1px solid #ED700B;}\n[[StyleSheetCommon]]\n#contentFooter .tiddlyLink {\n color:#fff;\n}\n/*}}}*/\n\n
\n/* Centering for tables. Then align table with {{tablecenter{ ...}}} */\n.tablecenter { text-align: center; }\n.tablecenter table { margin-left: auto; margin-right: auto; text-align:left; } \n\n/* The remainder comes from Presentation Plugin */\n\n.centre {text-align:center; margin:0;}\n.centre img {margin:0 auto;}\n\n.title, h1 {font-size: 1.6em; font-weight:bold; background:transparent; margin-top:0;margin-bottom:0; color:#000;}\n\nh2 {font-size: 1.45em; font-weight:bold; background:transparent; margin-top:0;margin-bottom:0; color:#000;}\n\n#mainMenu {width:14em;}\n#displayArea {margin-left:18em;}\n\n.left {float:left; margin-right:1em;}\n.bold {font-weight:bold;}\n\n.topbutton button, .topbutton{float:right;}\n\n.note{\n position:relative; /*this is the key*/\n z-index:24; background:#ccc;\n color:#000;\n text-decoration:none}\n\n.note:hover, .noteover{z-index:25; background-color:#FFB865;cursor:help;}\n\n.note span{display: none;}\n\n.note:hover span, .noteover span{ /*the span will display just on :hover state*/\n display:block;\n position:absolute;\n top:2em; left:2em; width:15em;\n border:1px solid #000;\n background-color:#FFB35A; color:#000;\n padding:0.5em;}\n\n.info{\n position:relative; /*this is the key*/\n z-index:24; background:#ccc;\n color:#000;\n text-decoration:none}\n\n.info:hover, .infoover{z-index:25; background-color:#FFB865;cursor:help;}\n\n.info span{display: none}\n\n.info:hover span, .infoover span{ /*the span will display just on :hover state*/\n display:block;\n position:absolute;\n top:2em; left:2em; width:15em;\n border:1px solid #000;\n background-color:#FFB35A; color:#000;\n padding:0.5em;}\n\n.bold {font-weight: bold !important;}
!Syllabus\n\n<<tiddler About>>\n\n!!Course Information\n<<tiddler [[Course Information]]>>\n\n<<tiddler [[Office Hours & Teaching Assistants]]>>\n\n!!Learning Goals\n<<tiddler [[Learning Goals]]>>\n<<tiddler [[Learning Activities]]>>\n<<tiddler [[Student Evaluations]]>>\n\n!!Textbook & Software\n\n<<tiddler [[Textbook]]>>\n<<tiddler [[Software]]>>\n\n!!Course Topics\n<<tiddler [[Course Topics]]>>
<<tiddler finlayson>>
Tiddler.prototype.getSubtitle = function()\n{\n return(this.title);\n}
config.macros.top={};\nconfig.macros.top.handler=function(place,macroName)\n{\n createTiddlyButton(place,"^","jump to top",this.onclick);\n}\nconfig.macros.top.onclick=function()\n{\n window.scrollTo(0,0);\n};
\n! Vapor-Liquid Equilibrium\n<<slideShow style:"SlideShowStyleSheet">>\nThe handling of mixed phase vapor-liquid systems is a hallmark of chemical engineering. When chemical equilibrium is established between vapor and liquid phases, the principles of mass and energy balances, coupled with thermodynamic relationships, can be used to predict the prerformance of a wide variety of industrial operations. Today we will look at few prototypical situations.\n\n-s-\n\n! Flash Unit Operation\nImagine a complex liquid mixture of volatile components that's held under pressure. When the pressure is released, a vapor phase may form. Evaporation will generally cool the liquid phase, and heat may flow into the system from the outside.\n\n-s-\n\n! Two special cases:\n* Adiabatic Flash: No additional heat is added from outside. Generally this results in cooling due the vaporization taking place.\n* Isothermal Flash: Enough heat is added to exactly make up for the heat of vaporization and hold a constant temperature.\nThe isothermal case requires no energy balance.\n\n-s-\n\n! Initial State\nTemperature $T_{in}$, Pressure $P_{in}$\n* Molar flowrate $F$\n* Molar composition $z_1, z_2, \sldots, z_n$\n\n-s-\n\n! Final State\nTemperature $T_{out}$, Pressure $P_{out}$\n* Vapor Phase \n** Molar flowrate $V$\n** Molar Comosition $y_1, y_2, \sldots, y_n$\n* Liquid Phase\n** Molar flowrate $L$\n** Molar composition $x_1, x_2, \sldots, x_n$\n\n-s-\n\n! Isothermal Flash\nWhat defines the isothermal flash is\n$$T_{in} = T_{out}$$\nWhat makes this a process\n$$P_{in} \sneq P_{out}$$\n\n-s-\n\n! Counting Unknowns\n$2n + 2$ Unknowns\n* 2 Molar flowrates: $L$, $V$\n* $n$ liquid phase mole fractions $x_i$\n* $n$ vapor phase mole fractions $y_i$\nSo where do we find $2n + 2$ equations?\n\n-s-\n\n! Overall Mass Balance\n$$F = V + L$$\n\n-s-\n\n! Individual Component Mass Balances\n$$\sbegin{eqnarray}\nFz_1 & = & Lx_1 + Vy_1 \s\s\nFz_2 & = & Lx_2 + Vy_2 \s\s\nFz_3 & = & Lx_3 + Vy_3 \s\s\n & & \svdots \s\s\nFz_n & = & Lx_n + Vy_n\n\send{eqnarray}$$\n\n-s-\n\n! Another look\n$$Fz_i = Lx_i + Vy_i \sqquad i = 1, \sldots, n$$\nAdding these up we get\n$$\ssum_{i=1}^nFz_i = \ssum_{i=1}^nLx_i + \ssum_{i=1}^n Vy_i $$\nor\n$$F\ssum_{i=1}^nz_i = \ssum_{i=1}^nx_i + V\ssum_{i=1}^n y_i $$\nwhich is just the overall mass balance!\n$$F = V + L$$\n\n-s-\n\n! Counting Equations\n$n + 2$ Equations\n$$\sbegin{eqnarray}\nFz_i & = & Lx_i + Vy_i \sqquad i = 1, \sldots, n \s\s\n1 & = & \ssum_{i=1}^n x_i \s\s\n1 & = & \ssum_{i=1}^n y_i\n\send{eqnarray}$$\n\n-s-\n\n! Vapor-Liquid Equilbrium\nK-values\n$$y_i = K_i x_i \sqquad i = 1, \sldots, n$$\nwhere do the $K_i$ come from?\n* Ideal Gases -- from the individual vapor pressures\n$$ K_i = \sfrac{P_i}{P}$$\n* Non-ideal Gases -- from fugacity and activity coefficients\n\n-s-\n\n! Summing Up\n$2n + 2$ Equations\n$$\sbegin{eqnarray}\nFz_i & = & Lx_i + Vy_i \sqquad i = 1, \sldots, n \s\s\n 1 & = & \ssum_{i=1}^n x_i \s\s\n 1 & = & \ssum_{i=1}^n y_i \s\s\ny_i & = & K_i x_i\n\send{eqnarray}$$\n\n-s-\n\n! Eliminating the $y_i$'s\n$n + 2$ Equations\n$$\sbegin{eqnarray}\nFz_i & = & Lx_i + VK_ix_i \sqquad i = 1, \sldots, n \s\s\n 1 & = & \ssum_{i=1}^n x_i \s\s\n 1 & = & \ssum_{i=1}^n K_ix_i\n\send{eqnarray}$$\n\n-s-\n\n! Rachford-Rice Equation\nWith just a bit more manipulation, we reduce to one equation in one unknown. The vapor fraction $\sphi = \sfrac{V}{F}$ must satisfy\n$$\ssum_{i=1}^n \sfrac{(K_i - 1)z_i}{1 + (K_i - 1)\sphi} = 0$$\n\n-s-\n\n! Example (Finlayson, Table 3.1)\nWe are given a stream with the following composition and K-values:\n{{tablecenter{\n|! Component|! K(k)|! z(k)|\n| Propane | 6.800 | 0.1000 |\n| n-Butane | 2.200 | 0.3000 |\n| n-Pentane | 0.800 | 0.4000 |\n| n-Octane | 0.082 | 0.2000 |\n}}}\n\n-s-\n\n! Matlab solution\nThe basic problem data is managed with Matlab vectors:\n{{{\nspecies = {'Propane','n-Butane','n-Pentane','n-Octane'};\nK = [6.8 2.2 0.8 0.082];\nz = [0.1 0.3 0.4 0.2];\n}}}\n\n-s-\n\nThe Rachford-Rice equation $$\ssum_{i=1}^n \sfrac{(K_i - 1)z_i}{1 + (K_i - 1)\sphi} = 0$$\n is easily represented using vector operations\n{{{\nf = @(v)sum(((K-1).*z)./(1 + (K-1)*v));\n}}}\n\n-s-\n\nAll that remains is to solve the Rachford-Rice equation for the vapor fraction, then compute the remaining quantitites of interest.\n{{{\nV = fzero(f,0.5);\nL = 1 - V;\nx = z./(L + V*K);\ny = K.*x;\n}}}\n\n-s-\n\n! Solution \n* Vapor Phase fraction: 0.4433\n* Liquid Phase fraction: 0.5567\n{{tablecenter{\n|! Component|! K(k)|! z(k)|! x(k)|! y(k) |\n| Propane | 6.800 | 0.1000 | 0.0280 | 0.1904 |\n| n-Butane | 2.200 | 0.3000 | 0.1958 | 0.4308 |\n| n-Pentane | 0.800 | 0.4000 | 0.4389 | 0.3511 |\n| n-Octane | 0.082 | 0.2000 | 0.3373 | 0.0277 |\n}}}\n\n
<!--{{{-->\n<div class='viewer' macro='view text wikified'></div>\n<div class='viewer topbutton' macro='top'></div>\n<br><br>\n<div class='viewer' macro='navigation tiddlers:{{store.getTiddlerText("PresentationIndex").readBracketedList()}}}'></div>\n<div class='tagClear'></div>\n<!--}}}-->
!Working with Slugs\n\nDespite the general adoption of metric units for engineering applications, there are still many times when an engineer encounters problems requiring the use of English units. It's helpful to have at least some familiarity with English units.\n\nThe ''Slug'' is the natural unit for measuring mass in English units. This is demonstrated by Newton's second law:\n$$Force = Mass \stimes Acceleration$$\nIf Force is measured in $lb_f$ ('pounds-force'), and Acceleration in $ft/sec^2$, then Mass has natural units of $\sfrac{lb_f-sec^2}{ft}$. Consider, for example, a typical ND undergraduate who, when on scale, exerts a downward force of $150 lb_f$ due to the acceleration of gravity. The student's mass is then\n$$Mass = \sfrac{Force}{Acceleration} = \sfrac{150 lb_f}{32.16 \sfrac{ft}{sec^2}} = 4.66 \sfrac{lb_f-sec^2}{ft}$$\nWe say the student has a mass of 4.66 slugs which exerts a force of 150 $lb_f$ on the scale due to the acceleration of gravity.\n\nIn everyday language, of course, it is customary to refer to someone's mass in units of 'pound-mass' ($lb_m$'). Numerically, there are 32.16 $lb_m$ in a slug. Slugs are a useful way to express mass when doing various engineering calculations in English units. Slugs/volume is then a useful way to express density.\n\nMetric systems is the careful distinction between mass and force by use of units such as kilograms and Newtons. You can maintain this same distinction in English units by using slugs for mass, and $lb_f$ for force.
Beers, Kenneth J. ''Numerical Methods for Chemical Engineering: Applications in MATLAB''. Cambridge University Press, 2006.
Bourg, David M. "Excel Scientific and Engineering Cookbook'', O'Reilly, 2006
Ceron, Rodrigo. //The GNU Linear Programming Kit, Part 1: Introduction to linear optimization//. Available on-line at [[http://www-128.ibm.com/developerworks/linux/library/l-glpk1/]], 2006.
Chapra, Steven C., and Raymond Canele. ''Numerical Methods for Engineers: With Software and Programming Applications'' (4the Edition). ~McGraw-Hill, 2001.
Leighton, David T. //Notes for Chemical Engineering 258, Computer Methods in Chemical Engineering//. The course web sites include syllabus, scanned lecture notes, exercises, and other resources for a prior version of CBE 20258.\n** [[Spring 2001|http://www.nd.edu/~dtl/cheg258/cheg258.html]] Lecture notes for 2001 notes are also available as single files [ [[pdf|http://www.nd.edu/~dtl/cheg258/notes/cheg258_notes.pdf]], [[Powerpoint|http://www.nd.edu/~dtl/cheg258/notes/cheg258_notes.ppt]] ].\n** [[Spring 2000|http://www.nd.edu/~dtl/cheg258/cheg258-2000/cheg258.html]]\n** [[Spring 1999|http://www.nd.edu/~dtl/cheg258/cheg258-2000/cheg258-1999/cheg258.html]]\n** [[Spring 1998|http://www.nd.edu/~dtl/cheg258/cheg258-2000/cheg258-1999/cheg258-1998/cheg258.html]]\n** [[Spring 1997|http://www.nd.edu/~dtl/cheg258/cheg258-2000/cheg258-1999/cheg258-1998/cheg258-1997/cheg258.html]]\n** [[Spring 1996|http://www.nd.edu/~dtl/cheg258/cheg258-2000/cheg258-1999/cheg258-1998/cheg258-1997/cheg258-1996/cheg258.html]]
Constantinides, Alkis, and Novid Mostoufi. ''Numerical Methods for Chemical Engineers with MATLAB Applications''. Upper Saddle River, NJ: Prentice-Hall, 1999.
<<br>>CBE 20258
Write a matlab function to compute $log(n!)$ for any value of n, and then graphically compare this to Stirling's formula:\n$$log(n!) \sapprox n log(n) - n$$\nand to the more exact asymptotic relationship:\n$$log(n!) \sapprox (n + 0.5) log(n) - n + 0.5 log(2\spi)$$\nUse $x$ for Stirling's formula, $o$ for the more exact formula, and be sure to label all of the axes.\n\nUse a solid line for Stirling's formula, a dashed line for the more exact formula, and 'o' for the actual values. Be sure to label all of the axes and to provide a legend showing what is what on your plot. As always, turn in the program and the output (graphical or otherwise). Commands which may be useful include plot, title, xlabel, ylabel, legend - to get more information on any of these, just type "help" and the name of the command.\n\n
This homework exercise is designed to improve your familiarity with Matlab matrix manipulation functions, and to see just how they work.\n#Construct the matrix $A$ given by $$A = \sleft[\sbegin{matrix} 1 & 2 & 3 & 4 \s\s 3 & 4 & 5 & 6 \s\s 5 & 6 & 7 & 8 \send{matrix}\sright]$$ and the matrix $B$ given by $$B= \sleft[\sbegin{matrix} 1 & 2 \s\s 2 & 3 \s\s 3 & 4 \s\s 4 & 5 \send{matrix}\sright]$$\n\n#Using Matlab, determine $A^T$ and compute $C = A \stimes B$\n#Show that $C^T = B^T\stimes A^T$\n#What happens if you try the operation $B \stimes A$?\n#Write a Matlab function that uses loops to multiply two matrices. Use it to calculate $C$ and compare the result to that produced by the simple Matlab matrix multiplication command.\n\n
In this exercise we examine the combination of algorithm error and machine round off error. A rather bizzare formula for calculating the derivative of a function is given by \s[\sfrac{df}{dx} = \sfrac{-3f(x) + 4f(x+h) - f(x+2h)}{2h}\s] (Actually, this is very useful as an approximation to a derivative at $x$ when the function cannot be evaluated for arguments less than $x$)\n\nIn this exercise I want you to\n#Using pencil and paper, derive the algorithm error and round off error for this formula. Determine the optimum value of $h$ as a function of the machine precision, and an estimate of the resulting minimum error for arbitrary functions $f(x)$. (Hint: it will be similar to a center-difference formula result)\n#Determine the error this formula makes in calculating the derivative of $f(x)=exp(x)$ over the range $[-0.01:.01]$ (averaging over alot of points smooths out the round off error!), and graphically compare the results both to the forward difference formula in today's example and to the estimate derived in part (a). Mark the predicted optimum value of $h$ and minimum error on the graph with 'o'. Note that the range of the plot will be different from the example, due to the different optimum value of $h$. Don't forget to label all the curves and points on your graph!\n\n
An elementary school class with 100 students has been promised a field trip to the zoo if 95% of the students remember to turn in their homework the week before. If the probability of each student ''not'' to turn in their homework is 5%, what is the likelihood that the class will go on the field trip?\n\nSolve this exercise by writing your own analog to the example program {{{prob.m}}}. Try to come up with an alternative algorithm to avoid overflow and underflow errors.\n\n//Hint: Develop an algorithm which solves for the log of the probability rather than for the probability directly. You might also look into using the more accurate analog to Stirling's formula examined in exercise 1 for really large factorials rather than taking lots of logs.//\n\nRemember that for the class to go on the trip either exactly 0, 1, 2, 3, 4, or 5 students would have to forget their homework.\n\n
An important design variable in designing an extraction system is determining the number of contactors (equilibrium stages). You are asked to design a system which can extract 99.9% of a toxic organic solute from a waste stream, reducing its concentration to the point where it can be discharged into an ordinary waste treatment facility. You are to use hexane as the stripper phase due to its high volatility: residual hexane dissolved in the water stream can be easily stripped out after the toxic organic is removed by an air stripper (not part of the exercise). So:\n\nIf the water flow rate is 10 gal/min, the stripper phase (hexane) flow rate is 1 gal/min, and the solute partition coefficient (Henry's Law coefficient) is 100:1 on a molar basis, what is the required number of contactors? What is the minimum solvent flow rate for which the extraction can be performed for an infinite number of stages? You will find today's example helpful in solving this exercise!\n\n
An engineer has a table of data on the viscosity of aqueous solutions of glycerin. Unfortunately, there are rather few entries and the engineer needs the viscosity at points intermediate to those in the table. Because of the rapid change in viscosity with composition, it is desirable to do a high order interpolation. The engineer has turned to you for help due to your expertise in numerical methods. To solve the exercise, write a matlab function that does the following:\n# Takes in the desired concentration as a variable.\n# Determines the three closest concentrations on either side of the selected concentration in the viscosity table. This is easy to do - find the closest one by using the {{{min(abs())}}} command in an intelligent manner, and pick the two closest points on either side.\n# Sets up and solves a set of linear equations for determining the parabola passing through the three points.\n# Uses this parabola to estimate the viscosity at the desired concentration.\n\nDemonstrate this function for the glycerin concentrations of 30wt%, 50wt%, and 95wt%.\n\nNOTE: Because of the power law nature of the dependence of the viscosity ($\smu$) on concentration ($C$), it is useful to fit the viscosity to a logarithmic relationship, e.g., \s[\slog(\smu) = a + b C + c C^2\s] where $a$, $b$, and $c$ are constants to be determined locally by your program. The concentration/viscosity values to be used are given below. These viscosities are from the CRC, 54th ed. and are relative to the viscosity of water at 20 deg C. The viscosity of pure water at that temp is 0.01002 poise, where poise is the cgs measure of viscosity. So:\n{{tablecenter{\n|!wt% glycerine |! $\smu$/$\smu_{water}$ |\n|~|~|\n| .0 | 1.0 |\n| .05 | 1.125 |\n| .10 | 1.288 |\n| .20 | 1.734 |\n| .32 | 2.632 |\n| .40 | 3.646 |\n| .44 | 4.434 |\n| .48 | 5.402 |\n| .52 | 6.653 |\n| .56 | 8.332 |\n| .60 | 10.66 |\n| .64 | 13.63 |\n| .68 | 18.42 |\n| .72 | 27.57 |\n| .80 | 59.78 |\n| .84 | 84.17 |\n| .88 | 147.2 |\n| .92 | 383.7 |\n| .96 | 778.9 |\n| 1.00 | 1759.6 |\n}}}\nTry reading this information in as an array rather than defining the array in the function itself. That way you can add more data points without modifying the function.\n\n
This exercise illustrates the use of $PLU$ decomposition to solve systems of linear equations. Generate a 7x7 Hilbert matrix using the approach in the class demonstration. Factor the matrix into $P$, $L$, and $U$ using the Matlab command 'lu'. For information on how to do this, type 'help lu' at the command prompt. Write a script which uses the factorization to solve the exercise $A x = b$ where $A$ is the hilbert matrix, and $b$ is the vector \s[b=\sleft[\smatrix{ \n 7.00000000000000 \s\s\n 5.28214285714286 \s\s\n 4.34206349206349 \s\s\n 3.71309523809524 \s\s\n 3.25382395382395 \s\s\n 2.90061327561328 \s\s\n 2.61919746919747}\sright]\s]\nYou should do this by solving the consecutive exercises:\n# $P z = b$ where $P$ is the permutation matrix,\n# $L y = z$ where $L$ is the lower triangular matrix, and\n# $U x = y$ where $U$ is the upper triangular matrix.\nYou may -not- use the \s\s command to solve these exercises. Instead, write a simple forward substitution routine to get $y$, and a back substitution routine to get $x$. Getting $z$ is really easy, as $P \stimes P$ is the identity matrix for all permutation matrices.\n\nShow that your result is the same as you would obtain from the command x = A \s\s b.\n\n
In this exercise we examine the norms of vectors and matrices. \n# First, let's look at norms of vectors. Write a matlab function which calculates the manhattan norm, the euclidean norm and the infinity norm of a vector. I ''do not'' want you to use the 'norm' command here. Apply this function to the vector $$x = \sleft[\smatrix{1\s\s2\s\s3\s\s4}\sright]$$ and compare the output to the output of the relevant 'norm' command.\n# Now consider the matrix $A$ given by $$A = \sleft[\smatrix{1&2&3\s\s4&5&6\s\s7&8&10}\sright]$$ I want you to write a script which calculates the ratio $\s|Ax\s| / \s|x\s|$as a function of the direction of $x$. Note that this direction is specified by the two angles in spherical coordinates. Plot this ratio as a function of these angles (use a 3-D plot here, such as 'mesh') and determine both the minimum and the maximum. Show that these match the values expected from the norms of the columns of A and inv(A), and calculate the condition number. Compare this condition number to those determined by the matlab functions cond(A) and condest(A). Why do the values differ? (Hint: typing in 'help cond' and 'help condest' will give you some ideas.)\n\n
In this exercise we are trying to study the muzzle velocity and air resistance of a cannonball. We use a combination of a still camera and a stroboscopic light with 1/500 sec between pulses. On the picture we get a series of images of the cannonball taken exactly 1/500 sec apart. We know that the position of the cannonball will be quadratic in time (at least for short times) since it slows down due to air resistance. Note that the effect of air resistance at high velocities is far greater than that of gravity! The equation describing the motion is thus:\n$$b = U (t - t_0) - 0.5 a (t-t_0)^2$$\nwhere we have as the three parameters the initial velocity $U$, the acceleration (actually the deceleration) $a$, and the initial time to leave the muzzle $t_0$. We lack information on the precise time it exits because of our measurement approach.\n\nFor homework, I want you to do two things. First, rewrite the above equation so that it is linear in the modelling parameters (e.g., pick some new ones it is linear in). Second, use the normal equations to solve for $U$, $t_0$, and $a$ from the following data:\n{{tablecenter{\n|! $t$ [sec]|! $b$ [m]|\n| 0.0020 | 0.9449 |\n| 0.0040 | 1.9823 |\n| 0.0060 | 2.7881 |\n| 0.0080 | 3.7089 |\n| 0.0100 | 4.4820 |\n| 0.0120 | 5.2732 |\n| 0.0140 | 5.9525 |\n| 0.0160 | 6.6565 |\n| 0.0180 | 7.4292 |\n| 0.0200 | 7.9978 |\n}}}\nPlot up this data and your fitted curve.\n\n
This exercise illustrates the uses of $QR$ factorization to do linear regression problems. Much research has been done in France on the fast neutron breeder reactor which uses the Uranium - Plutonium fuel cycle to generate more fuel than it consumes. One idiosyncracy of this process is that it requires fast neutrons - neutrons which have not been thermalized by interacting with light nuclei such as water. As a consequence, this reactor must be cooled by liquid sodium. In this exercise we use the following table of data to develop a correlation for the viscosity of sodium as a function of temperature.\n{{tablecenter{\n|! $T$ [deg C]|! $\smu$ [centipoise]|\n| 100 | .705 |\n| 200 | .450 |\n| 300 | .345 |\n| 400 | .284 |\n| 500 | .234 |\n| 600 | .210 |\n| 700 | .186 |\n| 800 | .165 |\n| 900 | .150 |\n}}}\nIt is usual to develop the correlation for the inverse of the viscosity rather than viscosity itself, thus: $$1/\smu = a + bT + cT^2$$\n# Write a script which calculates the coefficients in the correlation using the normal equations. Plot the data and the correlation to show how well the correlation does in describing the data.\n# Use the qr factorization command and the back substitution command you wrote for the previous assignment to get the coefficients as well. Show that the two answers are the same.\n\n
The internet is a tremendous source of useful information, particularly that of statistical nature. In this exercise you will use a simple web searching algorithm to find information on the average global temperature over the past several centuries.\n# Using a web search engine (there are many possibilities, but I usually use the google search engine at www.google.com) find the global temperature for at least the last century and plot the data up. Give me the URL, but ''not'' the data!\n# Fit the data for the period 1900 - present with a simple linear model using the normal equations. You will want to have saved the data in matrix form so that it can be read in as a matlab data file. If the pattern of the last century holds true, how much hotter is it expected to be in the year 2020 than it is today?\nHint: I recommend using the advanced search utility features, and use a fair number of keywords to limit the search. Also, you will probably want to paste the data into a text file which can then be edited into the appropriate matrix form. Note that matlab can read in a very large number of file types, including excel spreadsheets and tab or comma delimited files (alot more that the simple load command allows!). To learn more about i/o in matlab, type:\n{{tablecenter{\n{{{help iofun}}}\n}}}\n\n
The decay of radioactive isotopes is governed by the Poisson distribution. In this exercise we examine both the mean and the variance of this distribution. Suppose we have a sample of radioactive material. If we observe the material for some time $t$ we will get, on average, $r\stimes t$ decay events, where $r$ is the decay rate of the material. The probability of observing $k$ events during this period is $$p(k) = \sfrac{(r t)^k}{k!}\sexp(-r t)$$\n# Write a script to calculate the mean and the variance of this distribution for $r t = 5$ and $r t = 500$. (Hint: you may wish to calculate the $\slog$ of $p$ for larger values of $r t$ first.)\n# On two plots (one for each value of $r t$) graphically compare the poisson distribution to a gaussian distribution with the same mean and variance. You should find that the two collapse for the larger value of $r t$.\n# If $r = 30$ counts per minute (the true value), how long do we have to observe the decay to capture this value to within 10% accuracy at the 95% confidence level? (This sort of question is important in the biomedical sciences in which radioactive tracers are used to determine the way in which drugs are taken up and distributed throughout tissues. Radioactive tracers are often used in animal tests, for example)\n\n
In our work on suspensions of particles in fluids, many properties depend on the diameter of the particles (e.g., migration rate, wall effects, etc.). It thus becomes a tedious but necessary task to measure the diameter of these micron sized particles. The technique we use is video microscopy in which we couple a microscope objective to a video camera and take digital images of the particles. The particle images are then displayed on a screen and the size of the spheres are either determined through image processing algorithms, or directly with a cursor, depending on the image clarity. The information we want to get is the mean size of the particles, and also the population standard deviation (a measure of the width of the size distribution). In this exercise we will examine this process.\n# A student has measured the following particle diameters using a video microscope (measurements are in microns): $$\smatrix{51.1\s\s52.9\s\s54.2\s\s52.3\s\s46.7\s\s49.0\s\s54.3\s\s54.1\s\s49.1\s\s53.9}$$ Calculate the mean and an unbiased estimate of the population standard deviation.\n# Assuming only random scatter, provide a 95% confidence interval for the true population mean.\n# How many measurements are required to reduce the width of this confidence interval to less than $\spm 1\s%$ of the mean size?\n# If the calibration of the videomicroscope itself is only good to about $\spm 2\s%$, about how many particle measurements should the student make?\n\n
We wish to measure the dimensionless drag on a sphere settling through a viscous fluid at low Reynolds numbers. We have conducted an experiment with a particular sphere and have obtained the following results (with $1\ssigma$ error limits):\n$$\sbegin{eqnarray}\nU & = & 0.679 \smbox{cm/s} \spm 0.012 \smbox{cm/s} \s\s\n\smu & = & 1.22\smbox{p} \spm 0.03\smbox{p} \squad \smbox{(viscosity in poise)}\s\s\na & = & 0.051\smbox{cm} \spm 0.004\smbox{cm} \squad \smbox{(the sphere radius)} \s\s \n\srho_{sphere} & = & 2.40 \sfrac{\smbox{g}}{\smbox{cm}^3} \spm 0.05 \sfrac{\smbox{g}}{\smbox{cm}^3} \s\s\n\srho_{fluid} &= & 1.215 \sfrac{\smbox{g}}{\smbox{cm}^3} \spm 0.005 \sfrac{\smbox{g}}{\smbox{cm}^3} \s\s\ng & = & 980.0 \sfrac{\smbox{cm}^2}{\smbox{s}} \n\send{eqnarray}$$\n# Using this data, calculate the dimensionless drag defined by $$Drag = \sfrac{U }{(\srho_{sphere}-\srho_{fluid}) g a^2/\smu}$$ and determine the 95% confidence limits. Is this value within $2\ssigma$ of the theoretical value of 2/9 found for zero Reynolds number? \n# If you could improve only one of the above measurements to increase the accuracy of the final result, which one would it be? (e.g., which measurement has the largest contribution to the final error?)\nWhile the derivatives of the above expression can be taken analytically, it is actually alot simpler to write a function which takes in the measured values as a 5x1 array (or 6x1 including gravity), and then returns the dimensionless drag. You can then use a finite difference algorithm to calculate all the relevant derivatives numerically, and do the whole exercise in matrix form. Remember that if the measurements are all taken to be independent, then their matrix of covariance is purely diagonal.\n\n
The 1994 almanac lists the following as the production of nuts in the United States on a yearly basis for the three major nut crops:\n{{tablecenter{\n|! Year |! Pecans |! Almonds|! Walnuts|\n|~|! [1,000 tons] |! [1,000 tons] |! [1,000 tons] |\n| 1980 | 91.8 | 264.4 | 197 |\n| 1982 | 109.3 | 283.5 | 234 |\n| 1985 | 122.2 | 375.6 | 219 |\n| 1986 | 136.4 | 201.3 | 180 |\n| 1987 | 131.1 | 519 | 247 |\n| 1988 | 154.1 | 451.9 | 209 |\n| 1989 | 125.3 | 394.7 | 229 |\n| 1990 | 102.5 | 519.7 | 227 |\n| 1991 | 149.5 | 385.8 | 259 |\n| 1992 | 88.0 | 451.9 | 200 |\n}}}\n# For this set of data, calculate the mean annual production of each type of nut, together with its standard deviation.\n# Calculate the covariance between the three types of nuts (e.g., the three possible pairs).\n# Using the information obtained in part a and b rather than the original data set, calculate the mean and standard deviation of the fraction of nuts consisting of pecans, e.g., fraction = pecans/(pecans+walnuts+almonds).\n# Compare the answer in part c to that which would be calculated directly from the yearly data.\n\n
In this exercise you will examine the error in regression and in predictions based on regression. For the example of the falling lead weight described in class, predict the position ''and'' the velocity of the weight at $t=5$ seconds. Determine the error in each of these predictions.\n\n
In this exercise we examine the behavior of a dilute suspension of particles which is being sheared. As the suspension is sheared (the motion which is produced when a fluid is confined between two concentric cylinders and one of them is rotated) the particles will tumble over one another. This will lead to a random walk of the particles which can be characterized by a diffusion coefficient, much like a molecular diffusivity. We can measure this quantity - the shear-induced self-diffusivity - by examining the random walk of a single tracer particle in a suspension of otherwise identical particles. Because the random motion is due to the interaction of the tracer with other particles, the diffusivity will be identically zero if the concentration of the other particles is zero.\n\nA current area of research is the determination of the dependence of the self-diffusivity on concentration in the dilute limit. If the particles are perfect spheres, theory suggests that the leading order term in the diffusivity $D$ should go as $c^2$ where $c$ is the concentration. Other models suggest that if the spheres are not perfect, the diffusivity should be proportional to $c$ to leading order. Several years ago, Professor David Leighton and his research group measured the diffusivity in the dilute limit for a suspension of slightly prolate spheroids (sort of slightly stretched out spheres). The results were as follows:\n{{tablecenter{\n|! $c$ |! $D$ |! $\sepsilon$ |\n| 0.01 | 2.37e-4 | 2.2e-5 |\n| 0.025 | 5.63e-4 | 6.5e-5 |\n| 0.05 | 1.42e-3 | 1.6e-4 |\n| 0.075 | 2.27e-3 | 4.0e-4 |\n| 0.10 | 4.06e-3 | 7.6e-4 |\n| 0.15 | 9.96e-3 | 1.8e-3 |\n}}}\nThe errors $\sepsilon$ given above are the one standard deviation errors in the measured diffusivities calculated from the statistics governing the measurement process.\nUsing this data, fit a constitutive equation for the diffusivity of the form: $$D = c x_1 + c^2 x_2 + c^3 x_3$$ using weighted linear regression, and determine the error in each of the fitting coefficients. In particular, determine if the difference between the $O(c)$ coefficient $x_1$ and zero is statistically significant.\n\nFor graphics I would like you to plot up the data with errorbars (use the errorbar command), together with the fitted model (solid line) and 95% model confidence interval (dashed lines). Be sure to label everything using the legend command. Finally, the behavior is a bit clearer (graphically, anyway) if you plot up $D/c$ rather than the diffusivity itself.\n\nHint: You ''must'' use weighted linear regression for this exercise.\n\n
In this exercise we explore the use of the bootstrap technique to determine the error in a regression problem. Consider the attached set of measurements of the heat transfer coefficient for turbulent flow through a pipe (you may do this experiment in Junior lab next year). The dimensionless heat transfer coefficient is called the Nusselt number $Nu$, and it is expected to obey a power law relationship with the Reynolds number $Re$ (a dimensionless measure of the fluid velocity) and the Prandtl number $Pr$ (the dimensionless ratio of the rate of energy diffusion to fluid viscosity). Thus we expect: $$Nu = c Re^a Pr^b$$ where $a$, $b$, and $c$ are all constants.\n\nCalculate the constants and the matrix of covariance of the constants using the linear regression formulae described in class. Next, implement the bootstrap technique to estimate the matrix of covariance as well, and compare your results with that produced by the exact formulae. You may need to use a number of samples which is higher than the number of actual observations!\n\nThe data is as follows:\n{{{\n Re Pr Nu\n 2.0000e+04 8.1600e+00 1.4318e+02\n 2.0500e+04 8.3900e+00 1.6686e+02\n 2.1000e+04 8.5600e+00 1.5335e+02\n 2.1500e+04 7.1900e+00 1.5671e+02\n 2.2000e+04 8.0500e+00 1.5221e+02\n 2.2500e+04 7.6900e+00 1.5299e+02\n 2.3000e+04 7.0500e+00 1.6264e+02\n 2.3500e+04 7.4100e+00 1.7429e+02\n 2.4000e+04 7.2400e+00 1.5987e+02\n 2.4500e+04 7.0100e+00 1.5884e+02\n 2.5000e+04 8.3700e+00 1.6875e+02\n 2.5500e+04 7.1900e+00 1.7029e+02\n 2.6000e+04 7.9500e+00 1.8549e+02\n 2.6500e+04 8.3400e+00 1.8124e+02\n 2.7000e+04 7.2400e+00 1.6957e+02\n 2.7500e+04 7.4500e+00 1.8350e+02\n 2.8000e+04 8.2800e+00 1.7738e+02\n 2.8500e+04 8.5700e+00 2.0250e+02\n 2.9000e+04 8.9400e+00 1.9098e+02\n 2.9500e+04 7.8600e+00 1.8808e+02\n 3.0000e+04 7.2600e+00 2.0125e+02\n 3.0500e+04 7.2000e+00 1.9637e+02\n 3.1000e+04 7.5800e+00 2.0122e+02\n 3.1500e+04 7.0500e+00 1.9261e+02\n 3.2000e+04 8.6600e+00 2.0215e+02\n 3.2500e+04 8.8100e+00 2.1756e+02\n 3.3000e+04 7.0200e+00 2.1018e+02\n 3.3500e+04 8.1000e+00 2.2368e+02\n 3.4000e+04 7.2300e+00 2.0038e+02\n 3.4500e+04 8.2500e+00 2.1413e+02\n 3.5000e+04 8.0700e+00 2.2018e+02\n 3.5500e+04 8.9800e+00 2.3234e+02\n 3.6000e+04 8.6200e+00 2.4733e+02\n 3.6500e+04 7.9700e+00 2.3147e+02\n 3.7000e+04 7.6100e+00 2.3418e+02\n 3.7500e+04 7.6000e+00 2.3480e+02\n 3.8000e+04 8.3700e+00 2.5935e+02\n 3.8500e+04 8.9000e+00 2.4134e+02\n 3.9000e+04 7.5100e+00 2.2648e+02\n 3.9500e+04 7.7800e+00 2.4771e+02\n 4.0000e+04 7.7700e+00 2.4293e+02\n}}}\n\n
In this exercise you will examine the behavior of root solving algorithms for functions which have double roots. Such functions have solutions $\shat{x}$ which satisfy the condition $f(\shat{x})=f'(\shat{x})=0$, while $f"(\shat{x})$ is not zero.\n\nFor the first part, determine the rate of convergence of Newton's method for functions of this type. Do this analytically. (Hint: keep an extra term in the Taylor series, and expand $f'(x_i)$ about $\shat{x}$ as well)\n\nFor the second part, use the method of bisection, Newton's method, and the secant method to find the repeated root of $x(x-2)^2$ and $x(x-2)^3$. The latter has a triple root. Determine the rate of convergence $r$ and the constant $C$ for all three methods for both functions. Regression works well for this purpose. (Hint: you can't use bisection on the first function. Why?)\n\nYou may adapt the matlab example program.\n\n
Piping Networks (//the narrative for this problem comes from Professor David Leighton//).\n\nIn this exercise we explore what happens to the temperature of a shower when you flush a "W.C.," to use the polite British euphemism. At Princeton (unless they have updated the plumbing system since I was there, anyway) whenever the W.C. got flushed the temperature of the shower dramatically increased. The problem was so bad that it was considered polite to yell out "Flush!" before doing so, so that anyone in the shower could jump out before being boiled alive. Actually, what usually happened was that the flusher would forget, screams would ensue, and the flusher would yell out "Sorry" just a little too late for it to do any good. In this exercise we explore the design of such a system.\n\nWe have the piping network depicted below:\n\n{{{\n ******(6)\n **\n ****(2)****\n ** **\n(1)*******(3)*******(4)******(5)\n}}}\n\nIn this diagram, (1) is the source of water (far from the bathroom), the paths 1-2 and 1-3 are the resistances between the source and the bathroom, (2) is the cold water node in the bathroom, (3) is the hot water node in the bathroom, the paths 2-4 and 3-4 are the cold and hot water shower valve resistances, (4) is the mixer in the shower pipe (a node), (5) is the shower itself (or the person being boiled), (6) is the W.C., the path 2-6 is the W.C. valve, and the path 4-5 is the resistance due to the shower head (usually a low flow rate beast with high resistance).\n\nThere are three separate streams whose flow rate needs to be determined. They are $Q_t$ (the W.C. flow rate), $Q_h$ (the hot water shower rate), and $Q_c$ (the cold water shower rate. If the temperature of the hot water is $T_h$ and the cold is $T_c$, then the temperature of the shower is just: $$T_s = \sfrac{Q_hT_h + Q_cT_c}{Q_h + Q_c}$$ We can solve this exercise easily if we remember that the pressure head loss along any path connecting two nodes must be the same. Thus we get the three equations:\n\ndptot= dp12 + dp26\ndptot= dp13 + dp34 + dp45\ndptot= dp12 + dp24 + dp45\n\nThe pressure drops on each of the paths depend on the square of the flow rate along that path. Thus:\n\ndp12= sign(qt+qc) * r12 * (qt + qc)^2;\ndp13= sign(qh) * r13 * (qh)^2;\ndp24= sign(qc) * r24 * (qc)^2;\ndp26= sign(qt) * r26 * (qt)^2;\ndp34= sign(qh) * r34 * (qh)^2;\ndp45= sign(qh+qc) * r45 * (qh + qc)^2;\n\nOne would usually expect all of the flows to go from the left to the right. For some values of the resistances this will not be the case, and hot water from the shower will actually flow backwards through the cold water path 2-4 into the W.C. as well as boiling the person in the shower! To get this part right you have to look at the direction of the flow in determining the sign of the pressure drop. The above expressions take this into account. Note that if $Q_c$ is negative, the expression for the temp of the shower is incorrect, and the shower temp will just be $T_h$.\n\nWe now give a few numbers:\n\ndptot=50\n\nth=125\ntc=60\n\nr12=20;\nr13=20;\n\nr24=20;\nr34=5;\n\nr45=10;\n\nand, finally, the resistance for the W.C.:\n\nIf closed, r26 = infinity (say 10^10)\nIf open, r26 = 10\n\nThe units of the above are a bit arbitrary, but you can take the pressure to be in psig, the temps to be in degrees F, and the resistances to be in units of psig/(gal/min)^2.\n\nWrite a Newton's method routine to calculate the temperature of the shower when the W.C. valve is closed, and when it is open. Show that if the resistances from the source to the bathroom r12 and r13 are reduced the effect diminishes alot. This is why Princeton should replace its water pipes!\n\nTo make life alot easier, try taking the derivatives to make up the Jacobian via a finite difference scheme. Write a separate matlab function which returns as a vector the three equations whose roots you are trying to find as a function of the three element array of flow rates. Then compute the derivatives by changing the flow rates slightly and recomputing the function values. This is alot easier than writing out each of the 9 derivatives by hand! Using a center difference technique it is possible to compute the Jacobian in only a few lines of matlab code. \n\n
Often we have a sequence of reactions in which the intermediate is the desired product, and the end products are waste. We thus want to maximize the amount of the intermediate which is produced.\n\nConsider the sequential reversible reactions:\n$$ \smbox{A} + \smbox{B} \srightarrow \smbox{AB}$$\n$$\smbox{A} + \smbox{AB} \srightarrow \smbox{A}_2\smbox{B}$$\nThese two reactions have the equilibrium constants: $$\sfrac{\smbox{[AB]}}{\smbox{[A]}\smbox{[B]}} = K_1$$ and $$\sfrac{[\smbox{A}_2\smbox{B}]}{\smbox{[A]}\smbox{[B]}} = K_2$$\nFrom the stoichiometry of the problem we have the mass balances relating the unknown concentrations $\smbox{[A]}$, $\smbox{[B]}$, $\smbox{[AB]}$, and $[\smbox{A}_2\smbox{B}]$ to the initial concentrations of reactants $\smbox{[A]}_0$ and $\smbox{[B]}_0$ before the reaction takes place:\n$$\sbegin{eqnarray}\n\smbox{[A]}_0 & = & \smbox{[A]} + \smbox{[AB]} + 2 [\smbox{A}_2\smbox{B}] \s\s\n\smbox{[B]}_0 & = & \smbox{[B]} + \smbox{[AB]} + [\smbox{A}_2\smbox{B}]\n\send{eqnarray}$$\nGiven all this, solve the following two-part problem:\n# Assuming the values $\smbox{[B]}_0$ = 1 mol/liter, $K_1$ = 2 liter/mol, $K_2$ = 5 liter/mol, write a function which takes in the initial concentration of $\smbox{[A]}$ given by $\smbox{[A]}_0$ and returns the concentration of the intermediate product $\smbox{[AB]}$.\n# Write a successive parabolic interpolation optimization routine to determine the value of $\smbox{[A]}_0$ which maximizes $\smbox{[AB]}$. Plot up this function and mark the optimum conditions.\nHint: The first part is very simple: you write a function which takes in the four unknown concentrations and returns an array of four zeros when the equations are satisfied. You then put this either under your own root finder, or use a code such as fsolve. The second part is just a one-dimensional optimization problem using the results from the first part!\n\nNote: You will probably want to put in "fixes" so that concentrations are never negative, and that zero concentrations don't cause the program to bomb out!\n\n\n
In this exercise we solve a combined linear and non-linear least squares regression problem. We are trying to look at the growth of bacterial cells over time. There are two species present in our nutrient broth, each with different growth rates and initial concentrations, however we can't easily distinguish between them. Instead we measure the total concentration of cells as a function of time, and try to infer the growth rate of each of the two species. Thus:\n$$\smbox{Total} = A e^{k_at} + B e^{k_bt}$$\nWe have the observed data on total cell concentration given below. We wish to use least-squares regression to calculate the two growth rate constants. Note that you cannot linearize the above equation! Solve this problem by formulating it in the least squares sense (e.g., the sum of the square of the deviation between the model prediction for $A$, $B$, $k_a$, and $k_b$ and the observed data points). Since the problem is linear in the parameters $A$ and $B$, write a function which returns the optimum values of these parameters and the sum of squares for fixed $k_a$ and $k_b$. This will be a linear least squares problem. Then write an outer program which does the non-linear optimization for $k_a$ and $k_b$. This is much faster than solving the problem as a four parameter non-linear optimization problem. You may use the matlab routine fminsearch for the two-parameter non-linear optimization problem. Type help fminsearch to learn more about its use.\n\nIn addition to getting the best fit values of the parameters, determine the matrix of covariance. This is most easily done by 1) using the deviation between the data points and the fitted model to calculate the variance in the data measurements themselves, 2) determining the change in the best fit parameter values with changes in each of the data points (e.g., take the derivative $\snabla f$ where $f$ is the array of fitted parameter values and the gradient is with respect to each of the n data points. $\snabla f$ is thus a 4 x n matrix, which is computed numerically), and 3) use the dependence matrix and the data variance to calculate the matrix of covariance of the parameters. This will only work if the variance and / or the dependence is small (the penalty of ignoring higher order terms when calculating the variance).\n\nUsing all this, I want you to do the following:\n# Determine the best fit model parameters for the data: the two growth rates and the two initial concentrations.\n# Determine the matrix of covariance of the fitting parameters from the scatter in the data.\n# Calculate the 95% confidence interval for the two growth rates.\n# Plot up the data, the model, and the 95% confidence interval of the model prediction. This last bit is easy to do once you have the matrix of covariance of the fitting parameters - since the cell concentrations predicted by the model are just a function of the fitting parameters, the standard deviation of the model prediction at each time can be calculated via the standard error propagation formula. Although the model prediction is non-linear in the modelling parameters, it is simple to take the necessary gradient analytically. The gradient will thus be an nx4 array, where each row corresponds to evaluating the gradient at a different modelling time.\nA couple of useful tips:\n* Start close to the correct value for the growth rates. One of the growth constants will be negative (some of the cells are dying off).\n* When computing the dependence of the fitting parameters on the data, don't vary the data by too small amount, since the routine fminsearch has a preset target precision. If you make too small a change, then you can't compute the derivative you need! I found that a change in data scaled with the standard deviation of the data was effective in getting $\snabla f$.\n\nThe data is:\n{{tablecenter{\n|! t |! c |\n| 0 | 4.1077 |\n| 0.0500 | 3.8447 |\n| 0.1000 | 3.5597 |\n| 0.1500 | 3.2212 |\n| 0.2000 | 3.0120 |\n| 0.2500 | 2.8910 |\n| 0.3000 | 2.8429 |\n| 0.3500 | 2.3134 |\n| 0.4000 | 2.3515 |\n| 0.4500 | 2.5100 |\n| 0.5000 | 2.4260 |\n| 0.5500 | 2.3457 |\n| 0.6000 | 2.4561 |\n| 0.6500 | 2.3981 |\n| 0.7000 | 2.5175 |\n| 0.7500 | 2.8218 |\n| 0.8000 | 3.1638 |\n| 0.8500 | 3.3671 |\n| 0.9000 | 3.5864 |\n| 0.9500 | 4.1444 |\n| 1.0000 | 4.5336 |\n}}}\n\n
In this exercise we examine constrained optimization. Suppose you are saving money for a particular purpose, say college education for your children. You have been given a windfall (you won the \s$50,000 dollar prize in the lottery) and you want to invest it wisely. You have a choice of three investment vehicles. The first choice is a T-bill account which pays out at 7% and is very secure (e.g., it pays out at a fixed rate with no variability). The second is a stock market account that averages a yield of 10% but has a standard deviation of 10% as well (e.g., 69% of the time it will have a yield between 0% and 20%, and about 15% of the time it will actually lose money in a given year). The third is an aggressive growth fund investing in Asian stocks and securities which has an average annual yield of 15%, but a volatile standard deviation of 25%. You may assume that the covariance of the variability in the funds from year to year and between funds is zero (not a great approximation, but it makes things alot easier to calculate).\n\nFirst, write a code which simulates the performance of a particular investment strategy (the fraction which is put into each investment vehicle) over time. Since the performance is random, use the 'randn' command to simulate it, and plot up the account balance as a function of time for a dozen or so realizations. The performance is more easily seen if you use a semilog plot, and if you put all the realizations for a particular strategy on the same graph.\n\nOnce you have a feel for what is going on, you need to determine an optimum investment strategy. The idea is to maximize the expectation value of the return after a specified number of years, but also to keep the uncertainty of the return to acceptable levels. If you didn't worry about risk, then the optimum strategy would be to put everything in the Asian market fund - but you might go bankrupt!. One way of quantifying risk is to write a program which calculates both the expected return (easy) and an estimate of the return if "bad things" happen (hard). A possible way of quantifying this latter value is to determine a lower bound at the 97.5% confidence level: e.g., the value for which the actual return is greater 975 times out of 1000 realizations.\n\nUsing this, perform the following optimization exercises:\n\n# Determine an investment portfolio mix for your \s$50,000 initial investment which maximizes your expected yield, but which after 20 years (when your children are in college) you have at least a 97.5% chance that you will have the \s$150,000 you expect that college will cost. How much of your initial investment do you put into each of the three vehicles?\n# How does your answer change if you have \s$75,000 to invest and you require a 97.5% chance that you will have \s$100,000 in five years?\n\nFor each of the above exercises plot up around 10-20 realizations of your optimum strategy, and show the expected yield and the 97.5% floor.\n\nWhile it is theoretically possible to design an investment strategy by using a simulation code, a better way is to use error propagation equations to calculate the standard deviation of the expected return. Because the variability of the investments is large, however, it is necessary to work with the log of the returns rather than the returns themselves. The logs of these quantities are quite well behaved, and the standard error propagation equations apply.\n\nYou will also need to be careful in picking the correct range for an initial value of $P$ (assuming that you use penalty functions) when trying to optimize with respect to the imposed constraint. Also watch out for negative values of investment - you will need to restrict the values so that they are all positive, otherwise fminsearch may try to make some positive and others negative. Physically this corresponds to taking out a loan at one rate and investing it at another, but that is not what we are trying to do here!\n\n
In this exercise we examine the error of Gaussian quadrature for integration of the function $f(x)=e^x$ over the interval [-1,1]. You can actually do this exercise most easily with pencil, paper, and a calculator.\n# Derive the weights and nodes for a three point gaussian quadrature routine. You can simplify this to three equations in three unknowns by making use of sym- metry.\n# Apply this rule to the integral of $f(x) = e^x$ over [-1,1] and compare the result to the exact value.\n# Do the same for Simpson's rule (3 points only) and for the trapezoidal rule with two panels (again 3 points). Which has the smallest error?\n\n
In many industrial plants there are releases of controlled material into waste streams, which then must be processed at municipal treatment plants. In order to determine the compliance and/or cost of such releases (the city typically bills the plant for cleaning up the waste), it is important to determine the amount released, and to this end there are municipal monitoring facilities. At a particular plant, the monitoring station is supposed to measure the flow rate and concentration every hour (the plant has 24 hour continuous operations), which can be integrated to obtain the total release for each day. Unfortunately, the flow rate monitor jammed, and missed two consecutive readings in the morning, and one reading in the afternoon. The concentration detector continued to function, however, so there was no missing data on concentration.\n\nIn this exercise, suppose you work for the city and are deciding how much to bill the plant. To determine this, you need to have an accurate estimate of how much waste was released. I want you to develop an algorithm which accurately estimates the release for that day, and also provides estimates for the uncertainty (both algorithm and random error) in this value. Remember that you might have to defend your bill to the company! State all the approximations and assumptions that you are using, and also offer suggestions about what additional measurements you might want to make to further reduce your uncertainty. Note that there is no one right answer to this exercise - but some answers are better than others! Techniques you might want to use include regression, to get a feel for the randomness of the data, and interpolation.\n\nThe flow rate and concentration data for the day in question is given below:\n{{tablecenter{\n|! Hour |! Conc. |!Flow Rate |\n| 1 | 6.0674 | 4.2844 |\n| 2 | 5.9325 | 6.4692 |\n| 3 | 8.1253 | 8.0648 |\n| 4 | 7.8858 | 10.4524 |\n| 5 | 5.3535 | n/a |\n| 6 | 6.1909 | n/a |\n| 7 | 4.6892 | 8.5155 |\n| 8 | 2.3643 | 6.3340 |\n| 9 | 2.3273 | 4.4329 |\n| 10 | 2.5766 | 2.7618 |\n| 11 | 3.3133 | 2.5798 |\n| 12 | 5.7258 | 3.2963 |\n| 13 | 5.9117 | 4.5298 |\n| 14 | 9.7813 | 6.6405 |\n| 15 | 7.8636 | 8.2091 |\n| 16 | 7.7120 | n/a |\n| 17 | 7.5668 | 10.7833 |\n| 18 | 5.0593 | 10.1449 |\n| 19 | 3.4044 | 8.4611 |\n| 20 | 1.5696 | 6.5678 |\n| 21 | 2.2944 | 4.7942 |\n| 22 | 1.0657 | 2.5951 |\n| 23 | 4.2143 | 2.6029 |\n| 24 | 6.6236 | 2.5862 |\n}}}\n
A model of catalytic converter ignition consists of the zeroth order kinetic model: $$\sfrac{dT}{dt} = A\sexp^{-\sfrac{E}{kT}}$$ where $E$ is the activation energy, $k$ is Boltzman's constant, and $A$ is the preexponential rate constant divided by the heat capacity. Write an adaptive algorithm using a local quadrature module consisting of the ~G7-K15 quadrature rules to determine the time necessary to go from a manifold temperature of 600K to the reaction temperature of 900K. Use a tolerance of 1e-8. Confirm your result by comparing your algorithm to the matlab routine 'quad'.\n\nUse the constants: $$\sbegin{eqnarray}\n\sfrac{E}{k} &=& 9.1\stimes 10^3 \squad K\s\s\nA & = & 8.9\stimes 10^6 \squad K/s\n\send{eqnarray} $$ Hint: obtain the time by integrating the inverse of the reaction rate.\n\nYou will find the following weights and nodes for the\n~G7-K15 rules useful (based on the domain [-1,1]):\n{{{\nxs = [.949107912342758; ...\n .741531185599384; ...\n .405845151377397];\nxs = [-xs; 0; xs];\nwxs = [.129484966168870, ...\n .279705391489277, ...\n .381830050505119];\nwxs = [wxs, .417959183673469, wxs];\nys = [.991455371120813; ...\n .864864423359769; ...\n .586087235467691;...\n .207784955007898];\nys = [-ys;ys];\nwxks = [.063092092629979, ...\n .140653259715525, ...\n .190350578064785];\nwxks = [wxks,.209482141084728,wxks];\nwyks = [.022935322010529, ...\n .104790010322250, ...\n .169004726639267,...\n .204432940075298];\nwyks = [wyks,wyks];\n}}}\nHow to write the quadrature algorithm: As discussed in class, you need two parts - the local quadrature module and the control algorithm. \n\n# The local quadrature module takes in the name of the function to be integrated as a string variable argument, together with the local range of integration. It maps the quadrature weights and nodes to the local domain, and evaluates the named function at the nodes using the 'feval' command. It returns the value of the integral over the domain and an error estimate.\n# The control algorithm takes in the name of the function to be integrated as a string variable argument, together with the total range of integration and the tolerance. Using the 'nargin' function you can actually set the function up so that it will use some default tolerance if you don't specify one - a convenient feature. You need to keep track of the integral, error, and ranges of each sub- interval as arrays. If the total error (the sum of the error array) exceeds the tolerance, you simply find the index corresponding to the maximum error (the 'max' command is useful here!) and subdivide that interval. I find it simplest to put the left half in the original spot of the array and to append the right half to the end of the array. You then feed these two subintervals to the local quadrature module and add up the errors again!\n\nBe sure to keep your solution to this exercise (your adaptive quadrature algorithm) in your Matlab toolbox - it's alot better than the one that Matlab provides!\n\n
The moment of inertia of a solid object is defined as the integral of the density times the square of the distance from the axis of rotation over the volume of the object. Thus for an object spinning about the $z$-axis,$$I = \sint (x^2 + y^2) \srho dV$$ If you are unsure about this, just look it up in your physics text.\n\nWrite a program which computes the moment of inertia of the prolate spheroid formed by rotation of the ellipse $(z/a)^2 + (x/b)^2 = 1$ about the $z$ axis where $a$ = 2 cm and $b$ = 1 cm. You may assume the density to be that of glass, around 2.5 g/$\smbox{cm}^3$. Calculate the moment of inertia for the rotation of this spheroid about the $x$, $y$, and $z$ axes. Determine the integral to at least three significant digits. Why are the values not all the same?\n\n
In this exercise we use Monte Carlo integration to study the internal energy of a gas. Consider a box which is 10 Angstroms on a side (1e-9m). We place inside this box three molecules of methane. The internal energy of the molecules depends on their relative configuration. If they are closer together, they have a higher energy than if they are further apart. We may calculate the average internal energy of the molecules by integrating over configuration space, the space of all possible configurations. In this case, because we have three particles (and three directions) this is a nine-dimensional integral. It is thus very well suited to the Monte Carlo integration approach.\n\nWe shall take the molecules as points, and approximate the energy of interaction with the ~Lennard-Jones 6-12 potential. The potential energy between each pair of molecules a-b is thus $$U_{ab} = \sfrac{A}{r^{12}} - \sfrac{B}{r^{6}}$$ where $r$ is the distance between molecule $a$ and molecule $b$.\n\nThe quantites $A$ and $B$ are given by:\n$$\sbegin{eqnarray}\nA & = & 4 \sepsilon \ssigma^{12} \s\s\nB & = & 4 \sepsilon \ssigma^6\n\send{eqnarray}$$\nFor methane the quantities $\ssigma$ and $\sepsilon$ are given by:\n$$\sbegin{eqnarray}\n\sepsilon & = & 147.95 \smbox{[deg K] * k (k is Boltzman's constant)} \s\s\n\ssigma & = & 3.73 \smbox{Angstroms}\n\send{eqnarray}$$\nThe total internal energy of the configuration is the sum of the energy of each interaction (ab, ac, bc).\n\nThe probability of a particular configuration occuring is proportional to $exp(- \sbeta U)$ where $U$ is the total internal energy, and $\sbeta$ is $1/(kT)$ where $T$ is the absolute temperature.\n\nThe average internal energy is thus just the ratio $$U_{\smbox{ave}} = \sfrac{\sint U e^{-\sbeta U}}{ \sint e^{-\sbeta U}}$$ This is three times the average internal energy of each molecule. The integral is over all possible configurations of the three particles.\n\nSo now we come to the exercise. Calculate, using Monte Carlo integration, the average internal energy of each methane molecule at $T$ = 273K to an accuracy of 1%. This means you will need to compute both the average and the standard deviation of your result.\n\nThe easiest way to solve this is to write a program which calculates the internal energy and the error for a set number of points in the integration. Then using this information, you can determine how many points are required for the desired accuracy. I found that about 10^3 was a good number for the initial estimate, with the final number required being somewhat higher than this amount.\n\nAs a final note, remember the covariance between the numerator and the denominator in the ratio used in calculating the internal energy! This significantly reduces the error in the calculation!\n\n
In this exercise we integrate a second order differential equation as a system of first order equations.\n\nConsider the motion of a cannon ball which is fired straight up into the air. The initial velocity is given by $U_0$, the mass is $M$, and the radius is $R$. We want to calculate how high the cannon ball gets and how long it takes before it hits the ground again (e.g., how long do we have to get out of the way). The motion of the ball is governed by Newton's equations of motion, and in addition to the force of gravity we also have an air drag. This drag is given by:\n$$F = - \smbox{sign}(U)0.5\spi R^2U^2\srho_{\smbox{air}}$$\nIf the mass $M$ is 3000g, the initial velocity $U_0$ is $2\stimes 10^4 \smbox{cm/s}$, the density of air is 0.001 $\sfrac{\smbox{g}}{\smbox{cm}^3}$, and the radius is 10cm, calculate the maximum height and the time for the ball to hit the ground again.\n\nUse a high order algorithm (e.g., not Euler Method) to solve the exercise, and determine the maximum height and contact time accurately using an interpolation algorithm on the appropriate points. Add these values to a plot of the trajectory.\n\nHint: Just as in the example exercise, this is integration is most easily done if you define a function which takes in the height and velocity as an array, and then returns the derivatives as an array. You can then integrate both in vector form.\n\n
The transfer of fluids in pipelines is one of the most basic operations in the process industries. As you will learn in later course work, the pressure required to transfer fluid through a pipeline at a specified flowrate is a complex function of the pipe geometry, surface roughness of the pipe, the degree of turbulance in the flow, and the viscosity and density of the fluid.\n\nThe //Reynold's Number// is a dimensionless ratio of inertial to viscous forces acting on a flowing fluid. As the Reynold's number increases, fluid flow transitions from laminar to turbulent flow. For a circular pipe of radius $a$, the Reynold's number is given by $$\smbox{Re} = \sfrac{\srho v a}{\smu}$$ where$v$ is the mean fluid velocity in the pipe, $\srho$ is the fluid density, and $\smu$ is the viscosity.\n\nThe pressure drop for flow in a pipeline of length $L$ is given by $$\sDelta P = 2 f \sfrac{L}{2 a} \srho v^2$$ where $f$ is the dimensionless //Fanning friction factor//. The Fanning friction factor captures the impact of surface roughness, turbulence, and other factors on pressure drop. Obviously it is of key technological importance, so much reseach over many decades has been directed to developing accurate correlations for $f$.\n\nBased on a through review of experimental and theoretical literature, Professor Stuart Churchill of the University of Pennsylvania recently published the following expression for the Fanning Friction factor (Adv. Heat Trans., ''34'', pp. 255-357 (2001)):\n$$\sleft(\sfrac{2}{f}\sright)^{1/2} = 3.30 - \sfrac{554}{\smbox{Re}\sleft(\sfrac{f}{2}\sright)^{1/2}}\n+ \sleft(\sfrac{100}{\smbox{Re}\sleft(\sfrac{f}{2}\sright)^{1/2}}\sright)^2 + \sfrac{1}{0.436} \slog\sleft(\sfrac{\sfrac{\smbox{Re}}{2}\sleft(\sfrac{f}{2}\sright)^{1/2}}{1 + 0.151\sleft(\sfrac{e}{a}\sright)\smbox{Re}\sleft(\sfrac{f}{2}\sright)^{1/2}}\sright)$$\nwhere $e$ represents surface roughness. A small ratio $e/a$ (e.g., 0.001) corresponds to a very smooth pipe. A typical value of $e$ is 0.0015 cm for commercially drawn tubes. This expression is said to reproduce the best available experimental data to within 0.5%.\n\nComputing the pressure drop in a pipeline requires one to solve Churchill's expression for the Fanning friction factor $f$ which is the main task of this exercise:\n# Write a matlab function that takes two arguments, Reynold's number and surface roughness ratio $e/a$, and returns a value for the Fanning friction factor $f$. To facilitate plotting and 'vectorization', good matlab practice allows your function to accept a vector argument for the Reynold's number and return a corresponding vector with values for $f$. Your function should also provide a default value for $e/a$, if none is supplied.\n# Prepare a plot of the Fanning friction factor for Reynold's numbers ranging from 0 to 10,000, and for values of $e/a$ ranging from 0 to 0.05. What do you observe? How do you interpret this plot? How does your plot compare to plot in Perry's Handbook?\n# A typical city water supply provide residences at least 40 psig of water pressure. If you have a 100 feet of garden hose with a 1/2 inch internal diameter connected to the city water supply, what would be the flowrate through the hose? How much greater would the flowrate be through a 3/4 inch hose?\n# A small business has a requirement for at least 250 gal/hour of water located 150 feet from a city water 60 psig water main. What is the minimum size pipe necessary to meet the business requirement?\n(This problem prepared by J. Kantor, December 17, 2006).\n\n
Finlayson, Bruce A. ''Introduction to Chemical Engineering Computing''. New York: Wiley, 2006.\n<<<\nThis is a text developed for a popular elective [[course taught at the University of Washington|http://courses.washington.edu/checomp/]] by [[Prof. Bruce Finlayson|http://www.cheme.washington.edu/people/faculty/finlayson.htm]], one of the academic pioneers in the field. You can find this in the [[Hammes Bookstore|http://www.bkstr.com/CategoryDisplay/10001-10001-10900-1]] or on-line at\n*[[Amazon.com|http://www.amazon.com/Introduction-Chemical-Engineering-Computing-Finlayson/dp/0471740624]]\n*[[half.com|http://product.half.ebay.com/Introduction-to-Chemical-Engineering-Computing_W0QQtgZinfoQQprZ47779813]]\n<<<
Gilat, Amos. ''Matlab: An Introduction with Applications (2nd Edition)'', Prentice Hall, 2004.\n<<<\n[[Amazon.com: MATLAB: An Introduction with Applications 2nd Edition | http://www.amazon.com/...]]\n<<<
/***\nThis document uses the jsMath Plugin version 1.4 to format mathematics. Additional details follow:\n\n|Name|Plugin: jsMath|\n|Created by|BobMcElrath|\n|Email|my first name at my last name dot org|\n|Location|http://bob.mcelrath.org/tiddlyjsmath-2.0.3.html|\n|Version|1.4|\n|Requires|[[TiddlyWiki|http://www.tiddlywiki.com]] &ge; 2.0.3, [[jsMath|http://www.math.union.edu/~dpvc/jsMath/]] &ge; 3.0|\n***/\n//{{{\n// This is already loaded by ziddlywiki\nif(typeof(window["ajax"]) == 'undefined')\n {\n ajax = {\n x: function(){try{return new ActiveXObject('Msxml2.XMLHTTP')}catch(e){try{return new ActiveXObject('Microsoft.XMLHTTP')}catch(e){return new XMLHttpRequest()}}},\n gets: function(url){var x=ajax.x();x.open('GET',url,false);x.send(null);return x.responseText}\n }\n}\n\n// Load jsMath\njsMath = {\n Setup: {inited: 1}, // don't run jsMath.Setup.Body() yet\n Autoload: {root: new String(document.location).replace(/[^/]*$/,'jsMath/')} // URL to jsMath directory, change if necessary\n};\nvar jsMathstr;\ntry {\n jsMathstr = ajax.gets(jsMath.Autoload.root+"jsMath.js");\n} catch(e) {\n alert("jsMath was not found: you must place the 'jsMath' directory in the same place as this file. "\n +"The error was:\sn"+e.name+": "+e.message);\n throw(e); // abort eval\n}\ntry {\n window.eval(jsMathstr);\n} catch(e) {\n alert("jsMath failed to load. The error was:\sn"+e.name + ": " + e.message + " on line " + e.lineNumber);\n}\njsMath.Setup.inited=0; // allow jsMath.Setup.Body() to run again\n\n// Define wikifers for latex\nconfig.formatterHelpers.mathFormatHelper = function(w) {\n var e = document.createElement(this.element);\n e.className = this.className;\n var endRegExp = new RegExp(this.terminator, "mg");\n endRegExp.lastIndex = w.matchStart+w.matchLength;\n var matched = endRegExp.exec(w.source);\n if(matched) {\n var txt = w.source.substr(w.matchStart+w.matchLength, \n matched.index-w.matchStart-w.matchLength);\n if(this.keepdelim) {\n txt = w.source.substr(w.matchStart, matched.index+matched[0].length-w.matchStart);\n }\n e.appendChild(document.createTextNode(txt));\n w.output.appendChild(e);\n w.nextMatch = endRegExp.lastIndex;\n }\n}\n\nconfig.formatters.push({\n name: "displayMath1",\n match: "\s\s\s$\s\s\s$",\n terminator: "\s\s\s$\s\s\s$\s\sn?",\n element: "div",\n className: "math",\n handler: config.formatterHelpers.mathFormatHelper\n});\n\nconfig.formatters.push({\n name: "inlineMath1",\n match: "\s\s\s$", \n terminator: "\s\s\s$",\n element: "span",\n className: "math",\n handler: config.formatterHelpers.mathFormatHelper\n});\n\nvar backslashformatters = new Array(0);\n\nbackslashformatters.push({\n name: "inlineMath2",\n match: "\s\s\s\s\s\s\s(",\n terminator: "\s\s\s\s\s\s\s)",\n element: "span",\n className: "math",\n handler: config.formatterHelpers.mathFormatHelper\n});\n\nbackslashformatters.push({\n name: "displayMath2",\n match: "\s\s\s\s\s\s\s[",\n terminator: "\s\s\s\s\s\s\s]\s\sn?",\n element: "div",\n className: "math",\n handler: config.formatterHelpers.mathFormatHelper\n});\n\nbackslashformatters.push({\n name: "displayMath3",\n match: "\s\s\s\sbegin\s\s{equation\s\s}",\n terminator: "\s\s\s\send\s\s{equation\s\s}\s\sn?",\n element: "div",\n className: "math",\n handler: config.formatterHelpers.mathFormatHelper\n});\n\n// These can be nested. e.g. \sbegin{equation} \sbegin{array}{ccc} \sbegin{array}{ccc} ...\nbackslashformatters.push({\n name: "displayMath4",\n match: "\s\s\s\sbegin\s\s{eqnarray\s\s}",\n terminator: "\s\s\s\send\s\s{eqnarray\s\s}\s\sn?",\n element: "div",\n className: "math",\n keepdelim: true,\n handler: config.formatterHelpers.mathFormatHelper\n});\n\n// The escape must come between backslash formatters and regular ones.\n// So any latex-like \scommands must be added to the beginning of\n// backslashformatters here.\nbackslashformatters.push({\n name: "escape",\n match: "\s\s\s\s.",\n handler: function(w) {\n w.output.appendChild(document.createTextNode(w.source.substr(w.matchStart+1,1)));\n w.nextMatch = w.matchStart+2;\n }\n});\n\nconfig.formatters=backslashformatters.concat(config.formatters);\n\nwindow.wikify = function(source,output,highlightRegExp,tiddler)\n{\n if(source && source != "") {\n var wikifier = new\n Wikifier(source,formatter,highlightRegExp,tiddler);\n wikifier.subWikify(output,null);\n jsMath.ProcessBeforeShowing();\n }\n}\n//}}}
Mathworks, Inc. ''MATLAB & Simulink Student Version Release 14 with Service Pack 3''. 2006\n<<<\nMatlab & Simulink Student Version 14 is available from the Hammes Bookstore for about \s$100. This latest student version is a significant enhancement over earlier versions, and you will certainly find many uses for it outside of this course. Alternatively, you can order on-line from the Mathworks (http://www.mathworks.com), or, for example, from http://www.academicsuperstore.com/market/marketdisp.html?PartNo=762764&qk_srch=matlab. On-line purchase requires that you verify your student status in some manner.\n \nMatlab is also available on the cluster machines in the Engineering college, and there are several very capable free software packages -- Octave and Scilab. If you can afford the $99, having your own version of Matlab on your laptop will provide you with significant flexibility. But if you're fairly adept with scientific software and/or linux, then Octave or Scilab are reasonable alternatives for the course. They are similar to Matlab with somewhat different syntax and capabilities.\n<<<
Moler, Cleve. ''Numerical Computing with Matlab'', SIAM, 2004.\n<<<\nThis book and extensive Matlab files are available from the Mathworks web site. [[The MathWorks - Numerical Computing with MATLAB by Cleve Moler |http://www.mathworks.com/...]]\n<<<
Recktenwald, Gerald. ''Numerical Methods with Matlab: Implementation and Applications'', Prentice Hall, 2000.\n<<<\nThis was used as the required textbook for CheG 258 for Spring, 2000. This web site includes study guides, lecture slides, and partial problem solutions. [[Numerical Methods with MATLAB|http://web.cecs.pdx.edu/...]]\n<<<
Riggs, James B. ''An Introduction to Numerical Methods for Chemical Engineers (Second Edition)'', Texas Tech University Press, 1998.\n<<<\n[[Texas Tech University Press -- An Introduction to Numerical Methods for Chemical Engineers (Second Edition)| http://www.ttup.ttu.edu/...]]\n<<<
Winston, Wayne L. ''Operations Research Applications and Algorithms'' (3rd Edition). Wadsworth Publishing Company, 1997.