7
$\begingroup$

Bug introduced in 9.0 and persisting through 11.0.1 or later


Here is a toy example:

currentTimeStep = 0;
Dynamic[currentTimeStep]
pfun = ParametricNDSolveValue[
          {y'[t] == a y[t], y[0] == 1}, y, {t, 0, 10000}, {a},
          StepMonitor :> (currentTimeStep = t;), MaxSteps -> 100000
       ];
pfun[1]

As you can see from the value of currentTimeStep, the variable is most of the time left without a numerical value. Is there a way to look at the current status of computation when using ParameticNDSolveValue?

$\endgroup$
1
  • 3
    $\begingroup$ I filed this as a bug. Thanks. $\endgroup$
    – user21
    Commented May 8, 2013 at 8:08

1 Answer 1

3
$\begingroup$

@ruebenko confirmed that this is a bug.


Here's a workaround:

currentTimeStep = 0;

monitor[t_?NumericQ] := (currentTimeStep = t; 1)

pfun = ParametricNDSolveValue[{y'[t] == a monitor[t] y[t], y[0] == 1},
    y, {t, 0, 10000}, {a}, MaxSteps -> 100000];

Dynamic[currentTimeStep]

pfun[1]
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.