# Introduction to Computations in Chemical Engineering

This chapter is from the book

## 4.2 Solution Algorithms

The theoretical basis and approach to developing the solutions of various types of computational problems is briefly described in this section. This discussion is not meant to be exhaustive or comprehensive, but rather introductory, in nature. Several alternative techniques are available for solving the various types of problems; the following discussion is in most cases confined to presenting an outline of one of the techniques.

### 4.2.1 Linear Algebraic Equations

It should be clear that systems of linear algebraic equations can range in size from very small (fewer than five equations) to very large (several hundreds), depending on the number of components and complexity of operations. For example, a system consisting of four components being separated in a distillation column containing five stages yields a system of 20 material balance equations. Typically, the system of equations is rearranged into the following matrix form:

In this equation, [X] is the column matrix of n variables; [A], the n × n matrix of coefficients; and [B], a column matrix of n function values.

The Gauss elimination technique for solving this system of equations involves progressive elimination of variables from the equations such that at the end only a single linear equation is obtained in one variable. The value of that variable is then obtained and back-substituted progressively into the equations in reverse order of elimination to obtain the values of the rest of the variables that satisfy equation 4.15. For example, if the system consists of n equations in variables x1, x2,…, xn, then the first step is elimination of variable x1 from equations 2 to n using equation 1 to express x1 in terms of the rest of variables. The result is a system of n − 1 equations in n − 1 variables x2, x3,…, xn. Repeating this procedure then allows us to eliminate variables x2, x3, and so on, until only an equation in xn is left. The value of xn is calculated, and reversing the calculations, values of xn1, xn2,…, x1 are obtained [4].

Iterative procedures offer an alternative to elimination techniques. The Gauss-Seidel method involves assuming an initial solution by guessing the values for the variables. It is often convenient to assume that all the variables are 0. Based on this initial guess, the values of the variables are recalculated using the system of equations: x1 is calculated from the first equation, and its value is updated in the solution matrix; x2 is calculated from the second equation; and so on. The steps are repeated until the values converge for each variable [8]. The Gauss-Seidel method is likely to be more efficient than the elimination method for systems containing a very large number of equations or systems of equations with a sparse coefficient matrix, that is, where the majority of coefficients are zero [9].

Many sophisticated variations of the elimination and iteration techniques are available for the solution. One other solution technique involves matrix inversion and multiplication. The effectiveness of these and solution techniques is dependent on the nature of the system of equations. Certain techniques may work better in some situations, whereas it might be appropriate to use alternative techniques in other instances.

### 4.2.2 Polynomial and Transcendental Equations

The complexity of solutions for polynomial and transcendental equations increases with increasing nonlinearity. Quadratic equations can be readily solved using the quadratic formula, provided such equations can be readily rearranged in the appropriate form. Formulas exist for obtaining roots of a cubic equation, but these are rarely used. No such easy formulas are available for solution of higher-order polynomials and transcendental equations.

These equations are typically solved by guessing a solution (root) and refining the value of the root on the basis of the behavior of the function. The principle of the Newton-Raphson technique, one of the most common techniques used for determining the roots of an equation, is represented by equation 4.16 [4]:

Here, xn and xn+1 are the old and new values of the root; f(xn) and f’(xn) are values of the function and its derivative, respectively, evaluated at the old root.

The calculations are repeated iteratively; that is, so long as the values of the roots do not converge, the new root is reset as the old root and a newer value of the root evaluated. It is obvious the new root will equal the old root when the function value is zero. In practice, the two values do not coincide exactly, but a tolerance value is defined for convergence. For example, the calculations may be stopped when the two values differ by less than 0.1% (or some other acceptable criteria).

The computations for this technique depend on not only the function value but also its behavior (derivative) at the root value. The initial guess is extremely important, as the search for the root proceeds on the basis of the function and derivative values at this point. Proper choice of the root will yield a quick solution, whereas an improper choice of the initial guess may lead to the failure of the technique.

The iterative successive substitution method can also be used to solve such equations [9]. The method involves rearranging the equation f(x) = 0 in the form x = g(x). The iterative solution algorithm can then be represented by the following equation:

Here, xi+1 is the new value of the root, which is calculated from the old value of the root xi. Each successive value of x would be close to the actual solution of the equation. The key to the success of the method is in the proper rearrangement of the equations, as it is possible for the values to diverge away from the solution rather than toward a solution.

Finding the roots of polynomial equations presents a particular challenge. An nth-order polynomial will have n roots, which may or may not be distinct and may be real or complex. The solution technique described previously may be able to find only a single root, irrespective of the initial guess. The polynomial needs to be deflated—its order reduced by factoring out the root discovered—progressively to find all the n roots. It should be noted that in engineering applications, only one root may be of interest, the others needed only for mathematically complete solution. For example, the cubic equation of state may have only one real positive root for volume, and that is the only root of interest to the engineer. A complex or negative root, while mathematically correct as an answer, is not needed by the engineer.

### 4.2.3 Derivatives and Differential Equations

Some computational problems may involve calculating or obtaining derivatives of functions. Depending on the complexity of the function, it may not be possible to obtain an explicit analytical expression for the derivative. Similarly, some of the problems may involve obtaining the derivative from observed data. For example, an experiment conducted for determination of the kinetics of a reaction will yield concentration-time data. An alternative method of determining the rate constant for the reaction involves regressing the rate of the reaction as a function of concentration. The rate of the reaction is defined as ; thus, the problem involves estimating the derivative from the concentration-time data. One of the numerical techniques for obtaining the derivative is represented by equation 4.17.

The subscripts refer to the time period. Thus, CAi is the concentration at time ti, and so on. The derivative is approximated by the ratio of differences in the quantities. This formula is termed the forward difference formula, as the derivative at ti is calculated using values at ti and ti+1. Similarly, there are backward and central difference formulas that are also applied for the calculation of the derivative [4, 10]. The comparative advantages and disadvantages of the different formulas are beyond the scope of this book and are not discussed further.

Similarly, the numerical techniques for integration of ordinary and partial differential equations are beyond the scope of this book. Interested readers may find a convenient starting point in reference [4] for further knowledge of such techniques.

### 4.2.4 Regression Analysis

The common basis for linear as well as multiple regression is the minimization of the sum of squared errors (SSE) between the experimentally observed values and the values predicted by the model, as shown in equation 4.19:

In this equation, yi is the observed value, and f(xi) is the predicted value based on the presumed function f. The function can be linear in a single variable (generally, what is implied by the term linear regression), linear in multiple variables (multiple regression), or polynomial (polynomial regression). Minimization of SSE yields values of model parameters (slope and intercept for a linear function, for example) in terms of the observed data points (xi, yi). The least squares regression formulas are built into many software programs.

### 4.2.5 Integration

As mentioned previously, numerical computation of an integral is needed when it is not possible to integrate the expression analytically. In other cases, discrete values of the function may be available at various points. Numerical integration of such functions involves summing up the weighted values of the function evaluated or observed at specified points. The fundamental approach is to construct a trapezoid between any two points, with the two parallel sides being the function values and the interval between the independent variable values constituting the height [4, 10]. If the function is evaluated at two points, a and b, then the following applies:

Decreasing the interval increases the accuracy of the estimate. Several other refinements are also possible but are not discussed here.

Section 4.3 describes various software programs that are available for the computations and solutions of the different types of problems just discussed. These software programs feature built-in tools developed on the basis of these algorithms, obviating any need for an engineer to write a detailed program customized for the problem at hand. The engineer has to know merely how to give the command in the language that is understood by the program. The previous discussion should, however, provide the theoretical basis for the solution as well as illustrate the limitations of the solution technique and possible causes of failure. A course in numerical techniques is often a required core course in graduate chemical engineering programs and sometimes an advanced undergraduate elective course.

### InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

## Overview

Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

## Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

### Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

### Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

### Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

### Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

### Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

### Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

## Other Collection and Use of Information

### Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

### Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

### Do Not Track

This site currently does not respond to Do Not Track signals.

## Security

Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

## Children

This site is not directed to children under the age of 13.

## Marketing

Pearson may send or direct marketing communications to users, provided that

• Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
• Such marketing is consistent with applicable law and Pearson's legal obligations.
• Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
• Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

## Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

## Choice/Opt-out

Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

## Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

## Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

## Sharing and Disclosure

Pearson may disclose personal information, as follows:

• As required by law.
• With the consent of the individual (or their parent, if the individual is a minor)
• In response to a subpoena, court order or legal process, to the extent permitted or required by law
• To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
• In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
• To investigate or address actual or suspected fraud or other illegal activities
• To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
• To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
• To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.