speedup NDSolve for system of ODEs

*To*: mathgroup at smc.vnet.net*Subject*: [mg99727] speedup NDSolve for system of ODEs*From*: summer <summertan at hotmail.com>*Date*: Tue, 12 May 2009 03:10:06 -0400 (EDT)

I have a system of ODE's I have to integrate repeatedly for different initial conditions and I am trying to minimize the time of integration. What can I do to obtain the solution fastest??? Scenarios I tried so far (from fastest to slowest): 1. process equations with NDSolve only once and then reinitialize with different initial conditions - fastest 2. straight forward NDSolve, processes the equation for each new boundary condition - fast 3. combining all variables as components of a vector function, defining a Module[] that computes the derivatives of the components and integrate the vector function with NDSolve[{ vec'[t] == derivatives[vec[t]]], vec[0] == {..... etc. - slowest. Method 3 is faster when the Module[] for the derivatives is defined with delayed equality := instead of the instant equality =. I checked the function call speed for := and = definitions and they do NOT differ signficantly outside NDSolve but produce quite different integration times when used inside NDSolve. Can someone explain why is that? What surprised me is that the method 3 with the Module computing derivatives is not faster than the automatic equation processing of NDSolve in methods 1 and 2. I made everything possible to optimize the computation in the module, repeating expressions are computed only once etc. It will really help me if someone can explain in human language how come NDSolve is so efficient when I allow it to process the equations. Any special tricks to further increase the integration speed are welcomed.