Message Boards Message Boards

NDSolve documentation example doesn't work on 14.1

NDSolve does not work with 14.1. Using the examples available in the Help, like:

s = NDSolve[{y'[x] == y[x] Cos[x + y[x]], y[0] == 1}, y, {x, 0, 30}]

leads to an error message:

NDSolve::deqn: Equation or list of equations expected instead of False in the first argument {(y^\[Prime])[x]==Cos[x+y[x]] y[x],False}.

Any hint ?

POSTED BY: Pierre Dehez
3 Replies

Works fine with my V14.1
Maybe you have y pre-defined. Try on fresh kernel?

POSTED BY: Ahmed Elbanna

As Ahmed said, you seem to have defined y[0]. This is usually done by accident using a single = instead of a double == in an earlier code. You can restart the kernel or try y[0] =. or Clear[y].

It's trickier when one makes this mistake on the derivative equation. To clear y'[x], you use Clear[Derivative] or y'[x] =. (this does not seem necessary in the OP's case, though.)

POSTED BY: Michael Rogers

You are right! I did'nt realize that when opening a new Notebook, variables previously defined were still active. Thanks to both of you!

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

Group Abstract Group Abstract