# Thread: Solving Systems of Nonlinear Multivariate Equations

1. ## Solving Systems of Nonlinear Multivariate Equations

Background: I am working on a project involving blending metallurgical coals, and developing a blending model involves repeatedly solving systems of nonlinear multivariate equations.

What I Need: I need a means (either an excel or other program) that will enable me to repeatedly (and efficiently) solve systems of equations like the following:

(1) (19.4/0.62) = (1.5/a) + (44.1/b) + (27.6/c) + (1.5/d)
(2) (18.0/0.57) = (1.5/a) + (38.1/b) + (29.7/c) + (6.9/d)
(3) (15.7/0.48) = (1.5/a) + (38.0/b) + (38.0/c) + (0.8/d)
(4) (16.8/0.61) = (0/a) + (3.1/b) + (42.9/c) + (32.0/d)

Solving for the values of a, b, c & d (which are constants)

Note: The numbers in the equations have been rounded to one or two decimal places. I am not sure if this will be an issue when trying to solve for the four constants.

2. Here's what I would do: your equations are actually linear in the variables 1/a, 1/b, 1/c, and 1/d. So define new variables equal to those reciprocals. Then use standard methods to solve for the reciprocal variables. Finally, flip them over again to get your a, b, c, and d.

Question: are the coefficients of the matrix going to stay the same? Or do all the coefficients change for your repeat problems?

3. Thank you Adrian! I just tested your suggestion, and it works perfectly. Here's what I did - I set up the matrix calculations using the MMULT and MINVERSE commands in excel, solved for the reciprocal variables, and then flipped them over to get the a,b,c & d values.

To answer your question: At least some (and usually all) of the coefficients (which are % vitrinoid types from the petrographic analysis of a coal sample) will change for repeat problems.

Below are my excel calculations to test your suggestion:

a b c d
2.0 5.0 7.0 2.0 3.32
35.0 7.0 4.0 3.0 13.38
45.0 8.0 36.0 4.0 22.61
4.0 7.0 23.0 11.0 8.65

Inverse Values Recipricals of Values
(0.04) 0.02 0.01 (0.00) a = 0.3 a = 3.3
0.27 0.02 (0.03) (0.05) b = 0.2 b = 4.4
0.01 (0.04) 0.03 (0.00) c = 0.2 c = 5.5
(0.18) 0.06 (0.05) 0.13 d = 0.2 d = 6.6

Test
a = b = c = d =
3.3 4.4 5.5 6.6

2 5 7 2 3.3
35 7 4 3 13.4
45 8 36 4 22.6
4 7 23 11 8.7

As for the four equations in my initial post, I think value of 0 [as in (0/a)] in the 4th equation prevented me from successfully solving for the correct value of a (in theory, it should be between 2 and 3). What I plan to do replace it with another equation that doesn't have 0 as a coefficient. Below are the calculations related to the equations in my initial post:

a b c d
1.5 44.1 27.6 1.5 31.29
1.5 38.1 29.7 6.9 31.58
1.5 35.7 38.0 0.8 32.71
- 3.1 42.9 32.0 27.54

Inverse Values Recipricals of Values
(3.73) 4.06 0.34 (0.71) a = 3.0 a = 0.3
0.14 (0.10) (0.04) 0.02 b = 0.3 b = 3.0
0.02 (0.07) 0.06 0.01 c = 0.4 c = 2.4
(0.03) 0.11 (0.07) 0.01 d = 0.3 d = 3.8

Thanks again!

4. Great! Glad things worked out for you. A couple of comments:

1. The presence of a single zero coefficient in one equation should not, theoretically, prevent you from solving for that variable. It just means you can't use that equation for the pivot in that column. (I'm using the word "pivot" in its numerical analysis sense, not its Excel sense).

2. Your method, while it will work for small to medium-sized systems of equations, is not the most scalable method. I don't know how large a system you're planning on solving, but computing inverses is not as efficient as the ol' Gaussian elimination with back substitution (which is the most efficient known exact algorithm, but suffers from round-off error degradation of the number of significant figures in the final answer). On a computer, however, when you get especially large, sparse matrices, say on the order of 500,000 x 500,000 entries (as is quite common in finite element methods for solving pde's), you're going to use an inexact iterative technique in order to control the round-off error. Indeed, in your problem, I would watch the rounding-off. You may find that you end up with zero significant figures in your final answer! Not cool. At least start with as many sig figs as you can.

Cheers.