Re: ODE solution transfer

*To*: mathgroup at smc.vnet.net*Subject*: [mg111511] Re: ODE solution transfer*From*: EF <he.frauendorfer at t-online.de>*Date*: Tue, 3 Aug 2010 06:43:01 -0400 (EDT)*References*: <i33cv8$87g$1@smc.vnet.net>

On 01.08.2010 10:58, Themis Matsoukas wrote: > When you executed > > fvars=vars/.NDSolve[deqns,vars,{t,start,end}][[1]] > {InterpolatingFunction[{{0.,10.}},<>][t],InterpolatingFunction[{{0.,10.}},<>][t]} > > you replaced the previous definition of favrs (which was fvars = {a[t_],b[t_]}) with the result of NDSolve. Your solutions now are in fvars[[1]] and fvars[[2] > > I am not sure what you are trying to accomplish by setting fvars = {a[t_],b[t_]}. This involves as much typing as > > fvars=vars/.NDSolve[deqns,vars,{t,start,end}][[1]] > {SolvedA[t_],SolvedB[t_]}=fvars > > By the way, I would recommend that you use a different variable for the solved form of a[t and b[t]. Otherwise, if you execute the notebook a second time, the solved values of a,b, will be used inside NDSolve and you will get unexpected results. > > Themis > Thanks for your answer, my problem is a bit more complicated. Handling about 1000 variables and the corresponding differential equations in an Simplex loop requires that the program in each cycle handles the variables the Replacements etc. In the meantime I found a solution myself. Declaring var as a list of {a,b} and not {a[t],b[t]} does the trick: Clear[a, b, sol, dgln] var = {a, b}; start = 0; end = 10; k = .08; dgln = {a'[t] == -k*a[t], a[0] == 2, b'[t] == k*a[t], b[0] == 0}; sol = NDSolve[dgln, var, {t, start, end}][[1]]; Set @@@ sol a[5] b[5] E.F.