SYSTEMS OF EQUATIONS SOLUTION VIA NEWTON-RAPHSON ITERATION
Hi! As we know, the Newton-Raphson technique is used to solve for the value of x where f(x) = 0. So how do we apply the method if there are two or more equations?
Say we have the reaction occurring in a CSTR having a space-time of 5 with initial concentrations of A and B at 1.25M and 3.35M, respectively::
Applying the CSTR design equations, we proceed as:
Transposing (and simplifying) some terms, we get:
So basically we have to solve for CA and CB, and call it a day! 👀 How do we do this, though?
While many strategies are available, a standard way of solving a system of equations is via the Newton-Raphson approach:
So without going much into theory (they are always available elsewhere... or you can message me about it!), here is how we execute the method:
First, we express everything in terms of F(X):
Then, we calculate the derivative matrix
F'(X) in this manner:
This... thing is what we call the Jacobian matrix. It's a matrix containing the derivatives of F(X). Anyway, calculating the matrix proceeds as:
Our resulting method looks something like:
Let's execute the method in MS Excel. Assuming that xi and yi are initially CA0 and CB0 respectively;
The Excel commands to use are MMULT() and MINVERSE(), which is written in this manner:
Make sure you highlight cells B4 and B5 before typing. Then after entering the formulae, hit CTRL + SHIFT + ENTER. This is important as it allows MS Excel to evaluate your formulas in array form! The resulting formula is this:
These are the values of x and y for the next iteration. So we simply highlight cells C2:E3 and drag-fill them down to reevaluate F(X) and F'(X):
Then, we drag the entire first iteration down until the number of iterations desired has been calculated. I find it nice to assign the value of i at the first column, then I merge the cells depending on the number of variables and iteration number so that when I drag the cells down, it would copy the correct formulas. Assuming I do ten iterations:
The value of CA and CB are then 0.2906 and 1.9109, respectively.
Of course, you can extend this to any number of variables desired, like 5 nonlinear equations with 5 unknowns. However this would involve the calculation of 25 derivatives for the Jacobian matrix, and I leave you with that 😅
Comments
Post a Comment