# Update NumericalFunction in NDSolve [closed]

I have NDSolve StateData from an NDSolve ProcessEquations evaluation. I can NDSolve Iterate from t0 to t1, but then my boundary condition (an interpolation function) runs out of data.

This interpolation function gets updated externally. I just want to continue iterating (t1 to t2) with the updated interpolation function. However, calling myStateData@"NumericalFunction" shows that NDSolve holds onto the old interpolation function, even though this function is defined with a delayed set i.e. myInterpFunction[t_]:=something[t]

Is there any way to update the functions inside of the state data?

Here is a simplified version of what I'm doing:

myStateData = NDSolveProcessEquations[
{myPDE[x,t],
(*boundary conditions*)
T[xf, t] == myInterpolationFunction[t],
T[0, t] == 0,
(*Initial condition*)
T[x, t0] == initialCondition[x]};
T, t, {x, 0, xf}]


Then I need to solve so...

NDSolveIterate[myStateData,t1]


Then externally I update my boundary condition so that now it goes to t2 but when I evaluate

NDSolveIterate[myStateData,t2]


Mathematica returns an error saying that the interpolation function doesn't cover that range (t1 - t2) because it's holding onto the old interpolating function. In other words, looking at

myStateData@"NumericalFunction"


shows myInterpolationFunction has a domain of {t0,t1}

• Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. Commented Apr 12, 2015 at 19:42
• Please include your actual code, or a simplified version of it if practical, so that readers can understand what you are doing. Commented Apr 12, 2015 at 19:43
• I've added simplified code. My interpolation function is good from "t0" to "t1", once I update the function to go to "t2" I need NDSolve to continue Iterating/integrating to t2 Commented Apr 12, 2015 at 19:51
• Try myInterpolationFunction[t_?NumericQ] := something[t]. See also mathematica.stackexchange.com/questions/18393/… Commented Apr 12, 2015 at 21:12
• (If you did try it and it did not work, then I suggest it is because the problem is not sufficiently described in the question. There must be something in the missing details that causes an unanticipated problem.) Commented Apr 13, 2015 at 2:10