Message Boards Message Boards

GROUPS:

Faster alternatives to Solve

Posted 3 months ago
643 Views
|
4 Replies
|
3 Total Likes
|

I have about order of 1000 equations and variables to solve for. Something like:

Length@eqns4 = 1549 ; 
Length@orderVars4 = 1329 ; 
sols = Solve[eqns4, orderVars4]

Is there a way to make this evaluation faster by using some trick(s)?

4 Replies

Solve is primarily for linear and polynomial systems. You also have more equations than you have unknowns so this will not work. Are some equations redundant? If not, you can’t solve that. If you believe that the system is solvable (which it may not be), you need to use numerical approaches. I recommend structuring it as a constrained optimization (NMinimize and related functions). Those techniques are good at finding feasible solutions.

I hope this helps.

Regards

Neil

So, as I understand now, you have an overdetermined system of linear equations and thus you probably can't solve them exactly. So, I believe you should explicitly use functions which are designed to find approximate solutions for such systems, like LeastSquares (https://reference.wolfram.com/language/ref/LeastSquares.html).

This function requires explicit matrix of the system and vector of the right part. In order to construct them I suggest using CoefficientArrays function (https://reference.wolfram.com/language/ref/CoefficientArrays.html). Suppose you have a list of equations eqns and a list of variables vars; then calling CoefficientArrays[eqns, vars] will yield a list of two SparseArrays where the first one will correspond to the right part and the second - to the matrix of your linear system.

I am not sure if it will reduce the computational time, but as far as I understand, it is always better to give a computer all hints of what you are solving that you can give. Good luck!

What is the type of your system of equations?

Posted 3 months ago

They are complex and linear in the variables. Say six of those equations (out of 1549) are like: $a_{\{1,2\}}=a_{\{2,1\}}+i,a_{\{1,3\}}=a_{\{3,1\}},a_{\{1,4\}}=a_{\{4,1\}},a_{\{1,5\}}=a_{\{5,1\}},a_{\{1,6\}}=a_{\{6,1\}},a_{\{2,1\}}=a_{\{1,2\}}-i,a_{\{2,3\}}=a_{\{3,2\}}$ while solving for all $a_{\{\cdot,\cdot\}}$ totaling to about 1329.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract