# ParametricNDSolve doesn't correctly parse black-box function involving both independent variable and parameter

Consider this toy example:

f[t_?NumericQ, a_?NumericQ] := t + a

tst = ParametricNDSolveValue[{x'[t] == f[t, a], x[0] == 0}, x, {t, 0, 1}, {a}]


ParametricNDSolveValue::pdvar: Dependent variables {x, f[t, a]} cannot depend on parameters {a}.

As we can see, f is just a black-box function involving both independent variable t and parameter a, but ParametricNDSolveValue/ParametricNDSolveValue has mistakenly parsed it as dependent variable, spit out pdvar warning and failed.

I'm not sure if this should be considered a bug or design mistake. To make this post a question, let me ask: how can I circumvent the issue?

I manage to find two work-arounds.

One is to set the DependentVariables option:

f[t_?NumericQ, a_?NumericQ] := t + a

tstfix = ParametricNDSolveValue[{x'[t] == f[t, a], x[0] == 0}, x, {t, 0, 1}, {a},
DependentVariables -> x]


The other is to define the black-box function via SubValues and set the independent variable t as the first argument of the function:

f2[t_?NumericQ][a_?NumericQ] := t + a

tstfix2 = ParametricNDSolveValue[{x'[t] == f2[t][a], x[0] == 0}, x, {t, 0, 1}, {a}]