3
$\begingroup$

I currently have a list of ~150 autonomous ODE's 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)

c'_6 = kf*(c_1 + mu*c_5) - 2*c_6 + mu*kd^2*c_7 - kd^2*c_6 with c'_7 = kf*(c_1 + mu*c_6) - 2*c_7 + kd^2*c_8 + kd^2*c_7 and c'_8 = kf*(c_1 + (mu*c_7 - 2*c_8) + kd^2*c_9 + kd^2*c_8, etc.

where the c'_n (or prime) denotes derivative with respect to time of that equation (labelled c) up until c_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 c = {eqn1RHS,eqn2RHS,...,eqniRHS} and either list the entirety of each equation within this list, then indexing it by Part or c[[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.

$\endgroup$
4
  • $\begingroup$ @Ghensic, I think you need to be a bit more specific; show (simplified) the code. $\endgroup$
    – user21
    Commented May 19, 2013 at 13:32
  • $\begingroup$ @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. $\endgroup$ Commented May 20, 2013 at 23:34
  • $\begingroup$ Certainly, one moment and I'll update the question more accordingly. Thanks, sorry for the delay. $\endgroup$
    – Ghersic
    Commented May 21, 2013 at 2:21
  • $\begingroup$ @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. usingz[[n]] with NDSolve and obtain equation-specific quantities of interest? $\endgroup$
    – Ghersic
    Commented May 21, 2013 at 2:33

1 Answer 1

1
$\begingroup$

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 cn' and cn 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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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