1
$\begingroup$

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).

$\endgroup$
  • $\begingroup$ Try ParametricNDSolve instead, with y[0] set equal to the parameter. $\endgroup$ – bbgodfrey Jan 21 '15 at 12:22
  • $\begingroup$ 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. $\endgroup$ – user1335014 Jan 21 '15 at 12:51
  • $\begingroup$ Please be more specific in what you are seeking. What do you plan to do with the solution? $\endgroup$ – bbgodfrey Jan 21 '15 at 13:00
  • $\begingroup$ 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). $\endgroup$ – user1335014 Jan 21 '15 at 13:51
2
$\begingroup$

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

y[0] = .264

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"}]

all initial  conditions

|improve this answer|||||
$\endgroup$
  • $\begingroup$ 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 $\endgroup$ – user484 Jan 21 '15 at 18:58
  • $\begingroup$ 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. $\endgroup$ – bbgodfrey Jan 21 '15 at 19:07
  • $\begingroup$ 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. $\endgroup$ – user1335014 Jan 22 '15 at 11:40
  • $\begingroup$ 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. $\endgroup$ – bbgodfrey Jan 22 '15 at 13:07
  • $\begingroup$ 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. $\endgroup$ – user1335014 Jan 23 '15 at 11:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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