# Initial Value Problem with initial conditions as closed region

Does Mathematica have functionality to solve an Initial Value Problem when the initial conditions consist of a closed region (rectangle) instead of a point?

That is, instead of initial conditions as a point:

NDSolve[{y'[t] == y[t], y[0] == 1}, {y[t]}, {t, 100}]


we have initial conditions as a closed region (BTW, this gives an error that equations are expected):

NDSolve[{y'[t] == y[t], y[0] >= 0, y[0] <= 1}, {y[t]}, {t, 100}].


The method should be numeric, since DSolve can't solve the equations I'm interested in.

In more detail:

Let say that I have an IVP $y'(t) = f(y)$ and $y(t_0) = D$, where $D$ is some closed region. I'm interested in finding a set that contains the solutions of the IVP for all the points in $D$.

More precisely, if $y(t_{end};t_0,y_0)$ denotes the solution of IVP where $y(t_0) = y_0$ (initial condition is a point). Then I want to find a description of the set $\lbrace y(t_{end};t_0,y_0) \ | \ y_0 \in D \rbrace$ (or a tight superset containing it).

• Try ParametricNDSolve instead, with y[0] set equal to the parameter. – bbgodfrey Jan 21 '15 at 12:22
• I'm not really sure, but isn't ParametricNDSolve a way to create a functional object which calls NDSolve once you set the parameters? Which would give samples of solutions (for some points in the initial regions), but there wouldn't be any enclosure of all of the initial region. – user1335014 Jan 21 '15 at 12:51
• Please be more specific in what you are seeking. What do you plan to do with the solution? – bbgodfrey Jan 21 '15 at 13:00
• I updated the question by elaborating more on what I'm seeking. I'm only interested in seeing the answer (this wouldn't be input to anything else). – user1335014 Jan 21 '15 at 13:51

In general, if you must use NDSolve rather than DSolve to solve your differential equation for a particular value of y[0], then you need to use NDSolve for every value of y[0] in your domain of interest. Hence, you need ParametricNDSolveValue. Here is a demonstration for a simple illustrative equation, the results of which allow an illustration of how you might display the data. (Your exponential equation is not as good in this regard.)

sol = ParametricNDSolveValue[{y''[t] + y[t] == 0, y[0] == p, y[10] == 0}, y, {t, 0, 10}, {p}]


To look at the solution for specific values of y[0], you might use 'Manipulate:

Manipulate[Plot[sol[p][t], {t, 0, 10}, AxesLabel -> {"t", "y"}], {p, 0, 1,
Appearance -> "Labeled"}]


The curve for y[0] = .264 is

Alternatively, to see all the solutions in the domain at once, use Plot3D.

Plot3D[sol[p][t], {p, 0, 1}, {t, 0, 10}, AxesLabel -> {"y[0]", "t", "y"}]


• Another way to see all the solutions at once: ParametricPlot[{t, sol[p][t]}, {p, 0, 1}, {t, 0, 10}, Mesh -> {9, 0}] i.stack.imgur.com/YQ8EF.png – user484 Jan 21 '15 at 18:58
• Thanks, @Rahul. Still another method to see many solutions at once is Plot[Evaluate@Table[sol[p][t], {p, 0, 1, .1}], {t, 0, 10}], which produces a figure similar to yours. – bbgodfrey Jan 21 '15 at 19:07
• Thanks for the answer, but wouldn't this still just be a way to get sample points. So, you could use these points in plotting (and get a pretty useful plot), but you still wouldn't have any guarantees on what happens between these points? More precisely, you would have some points from the set $\lbrace(t_{end};t_0,y_0)|y_0 \in D \rbrace$, but you wouldn't have that set nor superset of that set. – user1335014 Jan 22 '15 at 11:40
• The problem you describe is inevitable when the results are determined numerically. Note that Plot3D`, which produced the second figure, tries hard to find such irregularities and found none. I believe that what I provided is the best that can be done in general. – bbgodfrey Jan 22 '15 at 13:07
• I think this problem can be overcome with interval arithmetic. For example, if you want to represent $2/3$, then you could represent this as interval where lower bound is floating point number that is less than $2/3$ and upper bound is floating point number that is greater than $2/3$. Regarding integration, you could do all the operations that you need in integration also with interval arithmetic. There are tools that do just that VNODE, CAPD, Cosy Infinity, Flow* etc, but I don't know if Mathematica has some of the same functionality as they have. – user1335014 Jan 23 '15 at 11:15