I have a large system of ODEs, and I find a large number of steady-state solutions. But many of them do not satisfy the condition that all the variables must have positive
or zero
values at the steady-state.
I like to:
- retrieve only the solutions that satisfy the condition above;
- sort the variables in a solution with respect to the variable (integer) subscript; and
- put all the retrieved and sorted solutions in a table column-wise (each column should have a solution)
I have already done what I request above by using a mixture of If
, AppendTo
and Table
commands but since the list is too long and it takes much time to achieve what I want, plus it looks ugly.
A minimal example of the desired output is:
TableForm[{{0.5, 2}, {1, 3}, {2, 1}},
TableHeadings -> {{"\!\(\*SubscriptBox[\(x\), \(1\)]\)",
"\!\(\*SubscriptBox[\(x\), \(2\)]\)",
"\!\(\*SubscriptBox[\(x\), \(3\)]\)"}, {"solution 1",
"solution 2"}}]
EDIT 1
Below is a subset of solutions that directly come out of the model.
{
{Subscript[x, 1][t] -> -331, Subscript[x, 3][t] -> -1.8,
Subscript[x, 4][t] -> -32, Subscript[x, 2][t] -> -1.37,
Subscript[x, 6][t] -> -49.2,
Subscript[x, 5][t] -> -98},
{Subscript[x, 3][t] -> -1.84,
Subscript[x, 2][t] -> 1.6, Subscript[x, 4][t] -> 141.9,
Subscript[x, 1][t] -> 334.1, Subscript[x, 5][t] -> 0,
Subscript[x, 6][t] -> 10},
{Subscript[x, 6][t] -> 0, Subscript[x, 1][t] -> 35.13,
Subscript[x, 2][t] -> 0, Subscript[x, 4][t] -> 0, Subscript[x,
3][t] -> 2.92, Subscript[x, 5][t] -> 10.41},
{Subscript[x, 1][t] -> 11.17,
Subscript[x, 3][t] -> 14.7, Subscript[x, 4][t] -> 2.3,
Subscript[x, 2][t] -> -6.6, Subscript[x, 5][t] -> 3.3,
Subscript[x, 6][t] -> -7.13},
{Subscript[x, 1][t] -> 1,
Subscript[x, 2][t] -> 4, Subscript[x, 6][t] -> 0,
Subscript[x, 3][t] -> 3, Subscript[x, 5][t] -> 6,
Subscript[x, 4][t] -> 0}
}
The above set has 5 solutions, shown with {...}
for each solution. As one may easily see, the variables in each solution are in somewhat mixed order with respect to variable subscripts. Here is a brief explanation for preparing the table.
- The solutions should be sorted with respect to the variable subscripts, such as x1, x2, x3, etc.
- Identify the solutions in which all variables have non-negative values, and place them in the early columns of the table according to the number of non-negative values of the variables. The more the non-negative values in a solution, the earlier the column position in the table.
- Priority with respect to the column position should be given to those non-zero solutions with the highest number of non-negative values.
- In case of multiple non-positive solutions, the ordering and column position of the solution set is not important.
EDIT 2
Here is the table of solutions I refer to in my comment.
The solution 2
should be in the first column of the table.