Message Boards Message Boards

0
|
2981 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

NDSolve Example doesn't work

I needed to solve following differential equation:

{y''[x] == -Sin[y[x]], y[0] == 1, y'[0] == 0}. <br/>

However calling

NDSolve[{y''[x] == -Sin[y[x]], y[0] == 1, y'[0] == 0}, y, {x, 0, 30}] 

produced an error

NDSolve::deqn: Equation or list of equations expected instead of True in the first argument {(y^\[Prime]\[Prime])[x]==-Sin[y[x]],y[0]==1,True}.

After creating a new Notebook and trying example from the documentation of NDSolve (Namely this one:

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

I get as an output still:

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

I tried ClearAll[y, x] but it didn't seem to work..
My Mathematica Version is 12.1, installed on Windows Pro 64-bit, Version 2004, OS build 19041.572

Thanks a lot for your feedback!

POSTED BY: Pavel Filippov
Posted 3 years ago

Hi Pavel,

Unable to reproduce

sol = NDSolve[{y''[x] == -Sin[y[x]], y[0] == 1, y'[0] == 0}, y, {x, 0, 30}]
Plot[y[x] /. First@sol, {x, 0, 30}]

enter image description here

I am running "12.1.1 for Mac OS X x86 (64-bit) (June 19, 2020)", but I doubt the problem has to do with version or platform.Try restarting the kernel.

POSTED BY: Rohit Namjoshi
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