Group Abstract Group Abstract

Message Boards Message Boards

NDSolve error: Encountered non-numerical value

Posted 2 months ago
POSTED BY: Yumin Tian
8 Replies

A fifth or sixth workaround (Version 14.1 and higher):

SetAttributes[y, NonThreadable];
NDSolve[{y'[t] == -{1, 0} y[t], y[0] == {1, 2}}, y, {t, 0, 1}]
(*  {{y -> InterpolatingFunction[{{0., 1.}}, "<>"]}}  *)
POSTED BY: Michael Rogers

This feels somewhat embarrassing to me:

In[7]:= Assuming[{y \[Element] Vectors[2]}, {1, 0}*y]

Out[7]= {y, 0}

or this

In[11]:= Assuming[{y \[Element] Vectors[2]}, 0*y]

Out[11]= 0
POSTED BY: Gianluca Gorni

One more workaround:

y = ArraySymbol["y", {2}];
NDSolve[{y'[t] == -{1, 0} y[t],
  y[0] == {1, 2}},
 y, {t, 0, 1}]
POSTED BY: Gianluca Gorni
Posted 2 months ago

Then how can you explain David's point?

POSTED BY: Yumin Tian

Setting the 0 term to a very small nonzero number appears to work:

POSTED BY: David Trimas
POSTED BY: Michael Rogers
Posted 2 months ago

No, y'[t] == {-y[t], 0} is a well-defined equation, because 0 can have any dimension. The point here is, the first equation by its form is a vector differential equation, so it should work in the same way as the second equation does, but the second works while the first doesn't. Also, as david noticed, it isn't a consistent behavior. So I think I should file a bug report, but how (if possible) to do that?

POSTED BY: Yumin Tian
POSTED BY: Michael Rogers
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard