I am trying to make a function based on two initial conditions of a set of differential equations:
sol[a, b] :=
NDSolve[{x1'[t] == ..., y1'[t] == ..., z1'[t] == ...,
x2'[t] == ..., y2'[t] == ..., z2'[t] == ...,
p1'[t] == ..., p2'[t] == ..., p3'[t] == ...,
e1'[t] == ..., e2'[t] == ..., e3'[t] == ...
x2[0] == a, y2[0] == b (*insert other initial conditions here*)},
{x2[t], y2[t], z2[t], x1[t], y1[t], z1[t], p1[t], p2[t], p3[t],
e1[t], e2[t], e3[t]}, {t, 0, T}];
However, this gives the error "NDSolve::ndinnt: Initial condition a is not a number or a rectangular array of numbers."
I also want to use this function as a replacement rule in order to plot a contour graph giving the value of e1[c] (for a certain fixed c) based on variables a and b:
(*c is some constant*)
g = e1[c] /. sol2[a, b];
ContourPlot[g, {a, -1, 1}, {b, -1, 1}]
But, this results in another error "ReplaceAll::reps: NDSolve[...] is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing."
Any way to explain (and hopefully fix) these two errors?
ParametricNDSolve
. $\endgroup$