I have a large model with many variables (about a hundred) and many differential equations (non-linear). What is the best way to handle a system this size in Mathematica?

Note that I am not asking about performance (100 variables is not that much). My concern is with handling the code in a manageable way. Each variable and each equation has a meaning and some particular structure.

If I were doing this in another language, I would create structs or types to hold different groups of properties together. But in Mathematica I have no idea how to handle the complexity.

Is there a recommended way to handle large systems of ODEs in Mathematica in an structured fashion?

  • $\begingroup$ "with many variables" sounds like a job for indexed variables. $\endgroup$ – J. M. is away Oct 31 '17 at 8:38
  • $\begingroup$ @J.M. Can you expand? $\endgroup$ – becko Oct 31 '17 at 9:47
  • 3
    $\begingroup$ I'm afraid currently the question is a bit too broad. It's hard to give useful advice without a specific example. Anyway, are you looking for OOP? $\endgroup$ – xzczd Oct 31 '17 at 10:17
  • $\begingroup$ @xzczd I understand the question is somewhat broad. I am not really sure what I am looking for. OOP could be an option, but it doesn't have to be so sophisticated (inheritance is definitely overkill here). I am just looking for a simple way to structure the code of a large system of ODEs. $\endgroup$ – becko Oct 31 '17 at 10:22
  • 1
    $\begingroup$ "I need to refer to each of them individually by name." - so, you have 100 named variables already? $\endgroup$ – J. M. is away Oct 31 '17 at 10:42

Your Answer


Browse other questions tagged or ask your own question.