1
$\begingroup$

I have:

f[x_, y_] = 1 - y;
g[x_, y_] = x^2 - y^2;
sol[{x0_, y_ 0}] := 
 NDSolveValue[{x'[t] == f[x[t], y[t]], y'[t] == g[x[t], y[t]], 
   x[0] == x0, y[0] == y0}, {x[t], y[t]}, {t, 0, 15}]

Then:

sol[{2, 1}]

Which returns:

{InterpolatingFunction[{{0., 15.}}, <>][t], 
 InterpolatingFunction[{{0., 15.}}, <>][t]}

But when I try:

toplot = Map[sol, {{2, 1}}]

It returns:

enter image description here

Notice that there is no comma this time between the first and second interpolating function. Why not?

$\endgroup$
2
  • 1
    $\begingroup$ There is a comma if I do as you input. However, it seems that you asked for MatrixForm, and the matrix form of a list does not have comma in between elements. $\endgroup$
    – Yi Wang
    Commented Apr 16, 2015 at 0:59
  • $\begingroup$ That is correct. Thanks. $\endgroup$
    – David
    Commented Apr 16, 2015 at 3:25

1 Answer 1

3
$\begingroup$

After correcting the typo in the argument to sol ({x0_, y_ 0} to {x0_, y0_}), I cannot reproduce your problem:

$Version

"10.1.0 for Mac OS X x86 (64-bit) (March 24, 2015)"

f[x_, y_] = 1 - y;
g[x_, y_] = x^2 - y^2;
sol[{x0_, y0_}] := 
 NDSolveValue[{x'[t] == f[x[t], y[t]], y'[t] == g[x[t], y[t]], x[0] == x0, 
   y[0] == y0}, {x[t], y[t]}, {t, 0, 15}]

toplot = Map[sol, {{2, 1}}]

enter image description here

 Plot[toplot, {t, 0, 15}, PlotRange -> All]

enter image description here

$\endgroup$
1
  • $\begingroup$ Thanks for the notice. I've discovered it myself this morning. $\endgroup$
    – David
    Commented Apr 16, 2015 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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