0
$\begingroup$

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?

$\endgroup$
3
  • 6
    $\begingroup$ You don't need to display the output; if you do sol = Solve[...]; you'll suppress the output (with ;) but everything will be assigned to sol. $\endgroup$ Jan 4, 2013 at 22:05
  • 2
    $\begingroup$ If you have not already done so, set Cubics->False and Quartics->False and see if that improves matters. $\endgroup$ Jan 4, 2013 at 22:05
  • 3
    $\begingroup$ Because these are linear equations, why aren't you using LinearSolve? $\endgroup$
    – whuber
    Jan 5, 2013 at 18:03

2 Answers 2

1
$\begingroup$

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]]
$\endgroup$
0
$\begingroup$

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)

$\endgroup$
1
  • $\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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.