Software for Solving System of 8 Simultaneous Equations

djbayko

Member
SoSH Member
Jul 18, 2005
8,844
Waltham, MA
Does anyone know of any free software that is powerful enough to solve a system of 8 equations and 8 unknowns? Alternatively, does anyone have any paid software that can do it for me? This is a one-time need. All of the installable / online solvers that I've used in the past can only handle up to 6 equations.

Equations:
p=R_1*M_1-R_1
p=R_2*M_2-R_2
p=R_3*M_3-R_3
p=R_4*M_4-R_4
p=R_5*M_5-R_5
p=R_6*M_6-R_6
p=R_7*M_7-R_7
p=R_8*M_8-R_8
R_1+R_2+R_3+R_4+R_5+R_6+R_7+R_8=S

Looking to Solve For:
p
R_1
R_2
R_3
R_4
R_5
R_6
R_7
R_8
 

swiftaw

Member
SoSH Member
Jan 31, 2009
1,948
Although, looking this, it should be easily solvable by hand (if I’m reading it right).

You have that R_i = p/(M_i-1) for i=1,...,8

Let C_i =1/(M_i - 1)

So you have C_1*p + C_2*p + ... + C_8*p = S

So p = S/(C_1 + ... + C_8)

Which you can then plug into the first equation to find the R’s
 

Mr. Wednesday

Well-Known Member
Lifetime Member
SoSH Member
Jul 27, 2007
1,039
Eastern MA
If you don't mind writing out the matrices, Excel has matrix multiply and matrix inverse functions, so you could use that too.
 

djbayko

Member
SoSH Member
Jul 18, 2005
8,844
Waltham, MA
Although, looking this, it should be easily solvable by hand (if I’m reading it right).

You have that R_i = p/(M_i-1) for i=1,...,8

Let C_i =1/(M_i - 1)

So you have C_1*p + C_2*p + ... + C_8*p = S

So p = S/(C_1 + ... + C_8)

Which you can then plug into the first equation to find the R’s
Brilliant!

Thank you so much. Now I can stop watching these math software tutorials :)

Problem solved </thread>
 

Capnswill

Member
SoSH Member
Dec 1, 2003
162
Thanks. I already found Octave, but I was having trouble translating my equations into the matrix format required by the program. I guess the software I've used in the past allowed you to paste in the equations as-is, and it would interpret them for you.

This ought to work in octave, obviously don't set M_1 .. M_8 as rand though

M_1 = rand(1);
M_2 = rand(1);
M_3 = rand(1);
M_4 = rand(1);
M_5 = rand(1);
M_6 = rand(1);
M_7 = rand(1);
M_8 = rand(1);
S = rand(1);

A = [[diag([M_1-1,M_2-1,M_3-1,M_4-1,M_5-1,M_6-1,M_7-1,M_8-1]),-ones(8,1)];[ones(1,8),0]];
b = [zeros(8,1); S];

soln = A \ b;
R_1 = soln(1)
R_2 = soln(2)
R_3 = soln(3)
R_4 = soln(4)
R_5 = soln(5)
R_6 = soln(6)
R_7 = soln(7)
R_8 = soln(8)
p = soln(9)

Though solving by hand also works.
 

jhp64

Member
SoSH Member
Jul 17, 2007
176
Seattle
For the record, SageMath is free software that will solve this sort of thing. It has a cloud-based interface called CoCalc, so you don't actually have to install anything.