11.07.2015 Views

Modeling Tools for Environmental Engineers and Scientists

Modeling Tools for Environmental Engineers and Scientists

Modeling Tools for Environmental Engineers and Scientists

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Another method, known as the Newton-Raphson method, requires onlyone guess to start the iterative process. It is based on Taylor’s expansion ofthe <strong>for</strong>m:f (x n h) f (x n1 ) f (x n ) hf(x n ) h f(x n ) + . . . (3.8)22If h 2 <strong>and</strong> higher terms are ignored, it can be seen that the step from x n to x n+1moves the function value closer to a root so that f (x n h) = 0. Then,x n1 x n – f ( xn) (3.9)f(x )Here, the computational process starts with a guess value <strong>for</strong> x n . Then, usingf (x n ) <strong>and</strong> f(x n ), a value <strong>for</strong> x n1 is calculated. If f (x n1 ) is sufficiently small,the root is taken as x n1 ; or, a new value <strong>for</strong> x n1 is calculated using the currentvalue of x n1 <strong>for</strong> x n in Equation (3.7), <strong>and</strong> the process is repeated. Amodification to this method is the Secant method, which is preferable whenit is difficult to get the derivative f(x n ) to be used in Equation (3.7). In suchcases, the Secant method uses the following approximation <strong>for</strong> f(x n ):nf (x n ) ≈ slope at x n f(x n)–f(xn–1) (3.10)x – xEven though these methods can be implemented in a spreadsheet with relativeease, most equation solver-based software packages feature built-infunctions that can return the solutions to such equations more efficiently <strong>and</strong>accurately, without requiring any programming. Spreadsheet packages suchas Excel ® also include some built-in functions that are preprogrammed to per<strong>for</strong>miterative calculations <strong>for</strong> solving simple equations.The use of the built-in Goal Seek feature of Excel ® in solving the problemin Worked Example 3.2 is illustrated in Figure 3.7. In this worksheet, theright-h<strong>and</strong> side of the equation to be solved is entered in cell C4. Then, theGoal Seek option is selected from the <strong>Tools</strong> menu. To start the Goal Seekprocess, cell C4 is specified to be 10 by changing the value of cell C6. Theprocess is instantly executed, <strong>and</strong> the result is returned as 9.21014.Alternatively, in equation solver-based software packages, such equationscan be solved readily by calling appropriate built-in routines. For example,Figure 3.8 shows how the above problem can be solved in Mathematica ® . Thevariables in the equation are defined first. The built-in routine Solve is calledwhere the first argument contains the equation to be solved. The secondargument is the variable <strong>for</strong> which the equation is to be solved. When executed,the solution is returned in line Out[2] as 9.21034. Note that theMathematica ® sheet is set up so that one can change the values of the variables<strong>and</strong> readily solve the equation <strong>for</strong> t. In addition, the same setup can beused to solve <strong>for</strong> any one of the four variables in the equation, provided thenn–1© 2002 by CRC Press LLC

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!