I'm working on some calculations on chemistry, but the final result on the process is being output as just 1 possible set of vars.
Basically, there are several chemical reactions happening, and each one adds 1 var and 1 equation to the system. This one is composed of 7 reactions so I started with:
syms n1 n2 n3 n4 n5 n6 n7
NxNO = NNO-n2+n4-(2*n7);
NxNO2 = NNO2-(2*n1)-n2-n4+n7;
NxN2O4 = NN2O4-n3;
NxO2 = NO2-n7;
NxHNO2 = n1+(2*n2)+n3-n4-n5;
NxHNO3 = n1+n3+n4-n6;
NxHp = n5+n6;
NxNO3n = n6;
NxNO2n = n5;
The Nx vars are the equivalent to the amount of each substance, as it is consumed or produced. also, the vars n1 to n7 need to be positive values.
The equations I need to solve are expressed as:
Eqn1 = K41 == (NxHNO2*NxHNO3)/((NxNO2*R*T2)^2);
Eqn2 = K42 == (NxHNO2^2)/((NxNO*R*T2)*(NxNO2*R*T2));
Eqn3 = K43 == (NxHNO2*NxHNO3)/(NxN2O4*R*T2);
Eqn4 = K44 == (NxHNO3*(NxNO*R*T2))/(NxHNO2*(NxNO2*R*T2));
Eqn5 = K45 == (NxHp*NxNO2n)/(NxHNO2);
Eqn6 = K46 == (NxHp*NxNO3n)/(NxHNO3);
Eqn7 = K47 == ((NxNO2*R*T2)^2)/(((NxNO*R*T2)^2)*NxO2);
Eqns = [Eqn1, Eqn2, Eqn3, Eqn4, Eqn5, Eqn6, Eqn7];
ns = [n1, n2, n3, n4, n5, n6, n7]
Sol1 = vpasolve(Eqns, ns);
Res = double([Sol1.n1, Sol1.n2, Sol1.n3, Sol1.n4, Sol1.n5, Sol1.n6, Sol1.n7]);
The K vars are constants I input on the code, same for R and T2.
As I try to solve them, the var Res is output as a 1x1 struct that contain the 7 syms for n1:n7, but the syms are composed of (1,1) results, which include negative values, implying this is the only set of vars as solution. I expect at least 7 possible sets, since in the same code I solved a 3 reactions system that input 3+ different sets, wich included a set containing only positive values.
If I try to specify using the command assume, it just returns as sets of (0,1) syms.