Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

This is a followup of my former question from here. Consider the code

pfun = ParametricNDSolveValue[{x'[t] == a*x[t], x[0] == 1}, {x}, {t,0, 10}, {a}];
part[l_List, n_Integer] := Part[l, n];
qfun = ParametricNDSolveValue[{y'[s] == a^2*y[s], y[0] == part[pfun[a], 1][2]}, {y}, {s, 0, 10}, {a}];

The goal is to calculate the sensitivity of the parameter $a$, $\partial_a y(t;a)$. However,


gives ParametricFunction[<>][2] instead of an InterpolatingFunction -object. It seems that this is a general issue for functions of the parameter $a$, which only allow numeric arguments:

f[a_] := a^2;
rfun = ParametricNDSolveValue[{y'[s] == a^2*y[s], y[0] == f[a]}, {y}, {s, 0, 10}, {a}];

gives {InterpolatingFunction[{{0.,10.}},<>]}, while

g[a_?NumericQ] := a^2;
sfun = ParametricNDSolveValue[{y'[s] == a^2*y[s], y[0] == g[a]}, {y}, {s, 0, 10}, {a}];

also not works and results in ParametricFunction[<>][2].

How can this issue be resolved?

share|improve this question
I've no idea how to solve this and think it is a bug. You should have in mind that this functionality is new in version 9 and my guess is that nesting ParametricFunction hasn't been on the focus and probably never has been tested. I could imagine that that case simply can't be handled by the underlying routines and the correct behavior would be a warning about that. Of course that is all just speculating and I could be completely off... –  Albert Retey Oct 12 '13 at 10:28
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.