0
|
10113 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
GROUPS:

# syntax problem in code

Posted 10 years ago
 Hi there.. i have a set of differential equations given by the following. But i am not able to solve them as it says the expression cannot begin with (x(t)*y(t))^2.. [{x'[t]== 0.5x[t]y[t][1+x[t]][2-x[t]], y'[t]==[x[t]^2][y[t]^2]-0.5[y[t]^2][x[t]+1][x[t]+2],x[0]==4,y[0]==10000},{x,y},{t,1000}] And it also says Expression cannot begin with "[x[t]y[t]]^2". syntax::tsntxi: "[x[t]y[t]]" is incomplete; more input is needed. Can you please help me in this regard?
2 Replies
Sort By:
Posted 10 years ago
 Hi,try this: NDSolve[{x'[t] == 0.5 x[t] y[t] (1 + x[t]) (2 - x[t]), y'[t] == x[t]^2 (y[t]^2) - 0.5 (y[t]^2) (x[t] + 1) (x[t] + 2), x[0] == 4, y[0] == 10000}, {x, y}, {t, 0, 1000}] You should use the [ ] only for functions. If you want to set normal parenthesis, use ( ).Plotting the result Plot[{x[t] /. sols, y[t] /. sols}, {t, 0, 10}] givesCheers, Marco.
Posted 10 years ago
 Thanks a lot Marco sir...