Message Boards Message Boards

2 Replies
4 Total Likes
View groups...
Share this post:

Why is '==' returning true, when used to define equations in NDSolve?

Posted 10 years ago
Thus far I have my function set up essentially like this:
s = NDSolve[{ y'[t] == k*y[ x ] + m*z[ x ]*a[ x ], a'[ x ] == -c*a[ x ] + b*z[ x ]*y[ x ], y[0] = .3, a[0] =.01},
{y,z,a}, {x,0,10}]

(also my variable names have subscripts)

When I hit shift+enter, I get an error message telling me that instead of equations, the program is just returning "True". 
What could I be doing wrong?

Thank you,
POSTED BY: Archos Argentum
2 Replies
Set (=) and Equal (==) are not interchangeable. After an assignment like y[0] = 1, the expression y[0] == 1 evaluates to True and that is no longer an equation, so NDSolve issues an appropriate message.
POSTED BY: Ilian Gachevski
There are several issues in your code: 

1. In NDSolve, all parameters must be specified. Say, k must be a known number here, like - 0.1. 
2. I do not see the definition of z or you need one more equation and initial condition for it.

Here is an example modified:
POSTED BY: Shenghui Yang
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract