# Question:How to "stack" the procedures generated by dsolve ?

## Question:How to "stack" the procedures generated by dsolve ?

Maple 2015

Hi,

I solve numerically an ode for different values of its parameters ( dsolve(..., numeric, parameters=[...] ) and I would like to "stack" the different solutions in a container (the container (list, vector, table) is of no matter).

Here is a notional example where I try to construct a sequence where the first element should be the solution when the parameter is equal to 1 and second one when the parameter is equal to 2.
It happens that some "premature evaluation" seems to occur which makes the two elements identical.

Please do not pay attention to the obvious simplicity of the problem: the true one is more complicated but can be illustrated by the on below.

 > restart:
 > f := dsolve({diff(x(t),t)=A*t, x(0)=0}, numeric, parameters=[A]);
 (1)
 > k := 1: for a in [1, 2] do   f(parameters=[a]):   printf(" f(1) = %a\n", f(1)):   g||k := unapply(f(t), t):   for kk from 1 to k do     printf("g%d(1) = %a\n", kk, g||kk(1)):   end do:   k := k+1:   print(): end do:
 f(1) = [t = 1., x(t) = .500000000000001] g1(1) = [t = 1., x(t) = .500000000000001]
 f(1) = [t = 1., x(t) = .999999999999999] g1(1) = [t = 1., x(t) = .999999999999999] g2(1) = [t = 1., x(t) = .999999999999999]
 (2)
 > # how must I correct this in order to prevent the # "over writting" of g1 when g2 is instanciated # and get # #  f(1) = [t = 1., x(t) = .999999999999999] # g1(1) = [t = 1., x(t) = 0.5] # g1(2) = [t = 1., x(t) = .999999999999999] #
 >