Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am trying to solve a system of several simultaneous equations that have been generated by a series of modules and functions, using this module:

SolvePhiEqs[number_] :=
Module[{eqs, simeqs, diffsimeqs, Xvalues},

eqs = GeneratePhiEqs[number];

Xvalues = XValues[Range[1, 2*number]];

k = 1;
r = 1;

simeqs = 
   Table[Eq[j] -> Phi[j] == Phi[j + 1] /. eqs /. x -> x[j] /. 
   Xvalues , {j, 2*number}];
diffsimeqs = 
   Table[Eq[j + 2*number] -> xDiffPhi[j] == xDiffPhi[j + 1] /. eqs /. 
   x -> x[j] /. Xvalues, {j, 2*number}];

EquatedEqs = Flatten@{simeqs, diffsimeqs};

Coefficients = 
   Flatten@{Table[R[j], {j, 0, number - 1}], Table[T[j], {j, number}],
   Table[A[j], {j, number}], Table[B[j], {j, number}]};

FinalCoefficient = 
   Solve[Simplify[Reduce[Array[Eq, 4*number] /. EquatedEqs]], 
   Coefficients]

]

However after having to solve more than 4 simultaneous equations (what is generated by using a 'number_' argument of 1), my computer starts churning away and does not come back with an answer for at least 10 mins (the longest I've tried so far). As this is supposed to be a general solution to a problem, I am looking at generating solutions up to at least 'number = 20' or so, so this is not particularly encouraging. However, I am fairly sure the code is functional, if not particularly efficient.

Whilst I appreciate that it is not easy to make a specific comment based on incomplete code, if anyone has any more general suggestions as to how to make simultaneous equation solving more efficient, they would be much appreciated!

share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.