Message Boards Message Boards

0
|
2304 Views
|
2 Replies
|
3 Total Likes
View groups...
Share
Share this post:

NDSolve syntax problem

Posted 10 years ago

Hi, At first I am new here and new to Mathematica so sorry for any incomprehensions. I want to solve numerically the system of two ordinary differential equations

y'[t] == -0.25 y[t] + (x[t])^2
x'[t] = -0.25 x[t] + y[t] - x[t] y[t]

When I try that following the NDSolve manual it returns me an error message. I tried to findout something but didn´t succeed. Thanks for any help.

My code is attached.

Attachments:
POSTED BY: Tomas Nettl
2 Replies
Posted 10 years ago

Thank you for the quick help Marco and a little encouragement. It works!

POSTED BY: Tomas Nettl

Hi Tomas,

it appears that you have typed a single equal sign for the equation of the x component. This here works:

NDSolve[{y'[t] == -0.25 y[t] + (x[t])^2, x'[t] == -0.25 x[t] + y[t] - x[t] y[t], x[0] == 1, y[0] == 1}, {x, y}, {t, 0, 10}]

If you plot this you get

sols =NDSolve[{y'[t] == -0.25 y[t] + (x[t])^2, x'[t] == -0.25 x[t] + y[t] - x[t] y[t], x[0] == 1, y[0] == 1}, {x, y}, {t, 0, 10}]

and

Plot[{x[t], y[t]} /. sols, {t, 0, 10}]

solution of ODEs

I hope this helps.

Cheers, M.

POSTED BY: Marco Thiel
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