Recently I've came across the command ParametricNDSolveValue
, which allows the user to solve DEs with one or more parameters. I've tried setting
Y := ParametricNDSolveValue[{y'[x] == 1, y[x0] == y0},
y, {x, -10, 10}, {x0, y0}]
and then plugging in $x_0=y_0=0$, and evaluating at $x=1$ using Y[0, 0][1]
. However, the result of the latter doesn't go through as expected at all. I'm getting an output of the form
ParametricFunction[ <> ][0, 0][1]
instead of the number $1$ (or some approximation of it).
I noticed that setting $x_0$ as an external parameter to ParametricNDSolveValue
, that is defining
Clear[Y]
Y[x0_] :=
ParametricNDSolveValue[{y'[x] == 1, y[x0] == y0}, y, {x, -10, 10},
y0]
and following up with Y[0][0][1]
does indeed give $1.0$ as expected.
My questions are: is there really no way to use ParametricNDSolveValue
with one of the parameters being the point at which the initial condition is given? If so, is my solution considered elegant? Is there a better way to go about this?
Thank you!