Recently I have had a chance to use the parameter feature of the numeric dsolve. It's pretty nice, but appears to have some limitations - or maybe I just need a little help to further refine my use of this feature.

Here's an example to demonstrate what I'm encountering.

Let's start with a simple IVP with a parameter in the ODE and in the IC:

ode := diff(x(t),t)=x(t)*(A-x(t)):
ic := x(0)=x0:
sol := dsolve( {ode,ic}, x(t), numeric, parameters=[A,x0] ):

To specify values of the parameters, I do something like:

sol( parameters=[2,1] );
                              [A = 2., x0 = 1.]

Then, I can use the numeric solution as usual, e.g.:

sol( 2.5 );
                    [t = 2.5, x(t) = 1.98661478742782682]

plots:-odeplot( sol, [t,x(t)], t=0..10 );

Now, if I want to access the current parameter values I can use:

PARAM := sol( parameters );
                              [A = 2., x0 = 1.]

But, the A and x0 in this list of equations are not the (global) A and x0 in the worksheet:

eval( A, PARAM );
                                      A

I had hoped that this would return 2.0, not A.

Here's more what I would have hoped to see:

myPARAM := 
[A=2.,x0=1.];
                              [A = 2., x0 = 1.]
eval( A, myPARAM );
                                     2.

Here's a little more information about the objects involved:

lhs(PARAM[1]); whattype(%), addressof(%);
                                      A
                              symbol, 173725692

lhs(myPARAM[1]); whattype(%), addressof(%);
                                      A
                              symbol, 179194280

Is there a reason why the names returned by calls to the numeric solution are not the global names (from which they were defined)? Is this documented?

There are plenty of ways to get around this situation, but this approach has lots of benefits as well - if only it worked as I expect it to work.

I look forward to any insights about how to work with this - or additional voices asking for this to be improved in future releases.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

Please Wait...