I have the system equations as

x'[t] == x[t]*(1 - x[t]^2 - y^2) - y*(1.1 - y/(x[t]^2 + y^2)^(1/2))

I am trying to solve and plot the equation by using

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


Plot[Evaluate[{x'[t] /. sol1}], {t, 0, 100}]

but I keep getting errors. And I do not understand why. This is what I should be plotting enter image description here

  • 3
    $\begingroup$ What is y? Your initial condition should be something like x[0] == 0, not x[t] == 0. $\endgroup$ – Carl Woll Oct 31 '17 at 22:49
  • $\begingroup$ I am assuming y is a variable that may or may not vary with t. The plot I included is a plot of x(t) vs t. $\endgroup$ – user53231 Oct 31 '17 at 22:51
  • 2
    $\begingroup$ y needs to be defined in some way, or you'll get the non-numerical value error from NDSolve. Also, you're solving for x[t] up to t == 10, but trying to plot it up to t == 100. $\endgroup$ – aardvark2012 Oct 31 '17 at 23:00
  • 1
    $\begingroup$ If y is not a number, then you will need to use DSolve. NDSolve only works with numerical equations. $\endgroup$ – Carl Woll Oct 31 '17 at 23:00
  • $\begingroup$ The plot you provide has to correspond to a particular value of y. Moreover, from the plot x[0] is not 0, and should be given. $\endgroup$ – José Antonio Díaz Navas Oct 31 '17 at 23:02

Firstly, in numeric computations, where possible, avoid using numbers with limited precision like yours 1.1 - replace by exact 1/10. Secondly, as many folks suggested in comments, you should pass to numerical functions such as NDSolve (N - is for numeric) things that are defined. So your comment:

I am assuming y is a variable that may or may not vary with t.

will not make it tractable by NDSolve. If you do not believe me you can check with Boromir ;-) The only way I can possibly reconcile "may or may not vary with t" is if y is a "weak" function of t depending on a small parameter. If that parameter goes to zero then y becomes a constant. Then you might experiment with your setup a bit trying different y-behaviors. Define a general function:

eq[y_] := x'[t] == x[t] (1 - x[t]^2 - y^2) - y (11/10 - y/(x[t]^2 + y^2)^(1/2))

In simplest case


enter image description here

you have nice analytic solution

DSolve[{eq[0], x[0] == a}, x, t]

enter image description here

which BTW is not periodic - a thing to notice. So you can experiment with more general forms of y. Not all forms will be integrable. I do not know your form of y so I pick any - replace at your will.

            {eq[a+b Sin[2t]],x[0]==x0},

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.