0

i have this scrit in mathematics 12 and it return this error: "NDSolve::deqn: Equation or list of equations expected instead of 3 in the first argument {(x^[Prime])[t]==x[t] (2-x[t]-2 y[t]),(y^[Prime])[t]==(2-2 x[t]-y[t]) y[t],3,3}."

Clear [x, y, t]
f[x_, y_] := x *(2 - x - 2*y);
 g[x_, y_] := y*(2 - 2*x - y);

Sol4 = NDSolve [{x'[t] == f[x[t], y[t]], y'[t] == g[x[t], y[t]], x[0] = 3, y[0] = 3}, {x[t], y[t]}, {t, 0, 7}];

Can you help mE?, what's wrong on my script?

Thansk a lot!

  • 4
    You need == while setting the initial conditions. You might find this post helpful too. – Derek H Jul 29 '21 at 17:48
  • 2
    As Derke said, you needed == and not = (we all made such mistakes at some time). But I think It is better to write the odes, ics, each on its own line, then combine them. This makes it easier to debug and see things. something like ClearAll[x, y, t] f[x_, y_, t_] := x[t]*(2 - x[t] - 2*y[t]); g[x_, y_, t_] := y[t]*(2 - 2*x[t] - y[t]); odes = {x'[t] == f[x, y, t], y'[t] == g[x, y, t]}; ic = {x[0] == 3, y[0] == 3}; sys = Flatten[{odes, ic}]; NDSolve[sys, {x[t], y[t]}, {t, 0, 7}] – Nasser Jul 29 '21 at 17:51
  • Hi Derek and Nasser, It's alive!! it's work!!! – Ivan Rojas Jul 29 '21 at 19:36

0 Answers0