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 currently have a list of ~150 autonomous DAE's (differential-algebraic equations) that I need to be able to work with using NDSolve. Fortunately I already have them formatted in plaintext, which leaves how to best manipulate them within Mathematica as the remaining task.

Each equations is of the form

a'(t) = f(t) , b'(t,a) = f(t,a), c'(t,a,b) = f(t,a,b), or

(Edit: for example)

z'_6 = kf*(z_1 + mu*z_5) - 2*z_6 + mu*kd^2*z_7 - kd^2*z_6 with z'_7 = kf*(z_1 + mu*z_6) - 2*z_7 + kd^2*z_8 + kd^2*z_7 and z'_8 = kf*(z_1 + (mu*z_7 - 2*z_8) + kd^2*z_9 + kd^2*z_8, etc.

where the z'_n (or prime) denotes derivative with respect to time of that equation (labelled z) up until z_150. Each subsequent equation involves the previous functions whose derivatives are given.

My best idea as to how to organize this would be to make a VERY long z = {eqn1RHS,eqn2RHS,...,eqniRHS} and either list the entirety of each equation within this list, then indexing it by Part or z[[77]] if, say, equation 77 is needed.

My question is simple. Within the context of NDSolve and numerical integration, does this seem to the learned of you to be the best way to efficiently import large systems of equations for future manipulation, accessible individually if the need be?

Thank you. (L/RHS = Left/Right Hand Side)

Edit:

See the comments. As suggested, this method is appropriate if (as suggested in the answer) the appropriate syntax is given for which parameters are implicit functions of time.

share|improve this question
    
@Ghensic, I think you need to be a bit more specific; show (simplified) the code. –  user21 May 19 '13 at 13:32
    
@Ghensic, can you explain why using your proposed method might not be suitable? It seems to be a perfectly reasonable way of indexing the equations and then calling them as necessary. –  Jonathan Shock May 20 '13 at 23:34
    
Certainly, one moment and I'll update the question more accordingly. Thanks, sorry for the delay. –  Ghersic May 21 '13 at 2:21
    
@ruebenko @Jonathan I've attached example equations of the type I'm working with (in fairly large number, ~150). Thank you, I'm glad to hear the indexing idea is feasible. I've ran into minor hiccups in working within NDSolve with nicknamed equations = {functions} for the list of functions and their initial conditions, but haven't had time to troubleshoot the errors properly, so hearing you say it's feasible is good. The purpose of this question was to make sure that indexing like this, ie. using`z[[n]]` with NDSolve and obtain equation-specific quantities of interest? –  Ghersic May 21 '13 at 2:33

1 Answer 1

up vote 1 down vote accepted

Because the equations are autonomous, which is the only potential complication in using NDSolve, each is an implicit (rather than explicit) function of (t) (see my attached link in line 1), and so in NDSolve each zn' and zn must be appended with a [t] on the end at appropriate points within NDSolve.

Barring simplification of the indexed list of equations (which was posted as a question here) one can then, I think, use the shorthand of eqnswithin NDSolve accordingly.

share|improve this answer

Your Answer

 
discard

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

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