Dear all,
I am trying to dynamically increase/decrease the number of ODEs during a run.

Thus, suppose I have ODEfun like below, then I am able to increase the number of ODEs and to increase the length of list l.
However, I can't find a way to increase the length vector y (as for example done below) because when 'ode' calls 'ODEfun' for the next step, then y has its original length again. Thus, the added element exists only as a local variable with the function. Is there any way to update y such that it is remembered for the next step?
Thanks,
antoine


ODEfun = function(t,y,params) {
  with(as.list(c(y,parms)), {
     ........
     dN[i] = k*N
     if(p>k) { #increase the number of ODEs with one
         i=i+1
         dN[i] = 0
     }
    ...........
    y=c(y,0)   #ALSO LENGTH INCREASE Y WITH ONE
     l=list(c(dN))
  })
}

out = ode(y = yini,
          times = times,
          func = ODEfunc,
          parms = parameters,
          verbose=TRUE,
          method = "lsoda")

| Prof dr Antoine H.C. van Kampen | (1) Bioinformatics Laboratory | Clinical Epidemiology, Biostatistics and Bioinformatics (KEBB) | Academic Medical Center (AMC) | Visiting address: Meibergdreef 9, J1B-208 (J-building, floor 1B) | Postal address: PO Box 22700, 1100 DE  Amsterdam, the Netherlands | www.bioinformaticslaboratory.nl<http://www.bioinformaticslaboratory.nl/> | (2) Biosystems Data Analysis | Swammerdam Institute for Life Sciences (SILS) | University of Amsterdam | Visiting address:  Science Park 904, C2-208 | 1098 XH Amsterdam, The Netherlands | www.bdagroup.nl<http://www.bdagroup.nl/> |phone:   ++31-20-5667096 (AMC) |Mobile:  06-41768067 | a.h.vankampen@amc.uva.nl<mailto:a.h.vankampen@amc.uva.nl> | Skype:antoine.van.kampen |


________________________________

AMC Disclaimer : http://www.amc.nl/disclaimer

________________________________

	[[alternative HTML version deleted]]

