Message Boards Message Boards

How can I keep a list structure in NDSolve

Posted 10 months ago

I have a complicated function of many variables, and I would like to pass those variables to it, and write the code for it using these list structures (scalars, 1D and 2D arrays), and then use it in a system of ODEs where I take not just derivatives of the variables with respect to time "t" (my independent variable), but on the right hand side of each equation, I take derivatives with respect to these variables of this function. However, I am running into problems because NDSolve has to tack "[t]" onto everything. Previously, I flattened these lists into one master list, passed it to my function, and coded based on this master list, but now it's getting too unwieldy. I am including a very simplified example of what I need, in 3 steps: 1st just the kind of equations I need, second with auxiliary functions (there is already a problem, which can be triviallly solved by allowing the cc variables in c to have a "[t]" tacked on (I don't show this), and third using one function to take derivatives of (they will have to be numerical derivatives in the real thing), for which the hack in 2 does not work.

I am also including part of the real file (test3), which has the function defined all the way at the bottom (includes other difeqs within it, but don't worry about those). The main thing is I need to keep the list structures of all the lists. Surely there is a way of manipulating heads and tails of expressions to make this work?

POSTED BY: Iuval Clejan

Is eco2 as in

solz = eco2[LRC, CL, CR, AlphaL, AlphaR, 10., 10., 10., 10., tf];

defined anywhere

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract