I am solving a system of 15 simultaneous linear equations using Solve
. On running the code, I get a message saying "A very large output was generated" with options for viewing the ouput. I want to use the solution inside a larger program where the next step relies on the ouput of Solve
. I am stuck unless there is a reasonable way for me to capture the output from Solve
. Is there a way to do this?
2 Answers
Is something like this useful?
s1 = Solve[Table[RandomInteger[100, {15}]. Array[x, 15] == y@i, {i, 15}], Array[y, 15]];
y[1] /. s1[[1]]
Thanks for the suggestions. I first put the set of equations as a SparseArray
using CoefficientArrays
function. Then solved using LinearSolve
.
{b,m}=CoefficientArrays[Set of Equations, {Variable List}];
LinearSolve[m,-b]
See the tutorial "Solving Linear Systems" (I have version 8)
-
$\begingroup$ Ah, I missed "linear". That being the case you might also want to experiment with options Method->OneStepRowReduction or DivisionFreeRowReduction. $\endgroup$ Jan 10, 2013 at 23:01
sol = Solve[...];
you'll suppress the output (with;
) but everything will be assigned tosol
. $\endgroup$