How to solve this DE?

I'm pasting a code of a DE.I'm getting error. Plz suggest correction.

Clear[x];
r=1;
eqn=x'[t]-1-r*x[t]-(x^2)[t];
sol=NDSolve[{eqn,x[0]==0},x,{t,0,100}][[1]];

tTicks=Range[-24,24 30,24];
tGrid=Range[-60,24 30,6];

ParametricPlot[Evaluate[{x[t],x'[t]}/.sol],{t,0,100},Frame->True,FrameTicks->{tTicks,Automatic},FrameTicksStyle->Directive[Red,Thick],GridLines->{tGrid,Automatic},GridLinesStyle->LightGray,FrameLabel->(Style[#,14,Bold]&/@{x,Overscript[x,"."]}),AspectRatio->1]

ParametricPlot[Evaluate[{t,x[t]/.sol}],{t,0,50},Frame->True,FrameTicks->{Range[0,50,12],Automatic},FrameTicksStyle->Directive[Red,Thick],GridLines->{tGrid,Automatic},GridLinesStyle->LightGray,FrameLabel->(Style[#,14,Bold]&/@{t,x}),AspectRatio->1]


I made the correction regarding the syntax error. But still no execution.

The following code,

Clear[x];
r=1;
eqn=x'[t]-1-r*x[t]-x[t]^2==0;sol=NDSolve[{eqn,x[0]==0},x,{t,0,100}][[1]];
tTicks=Range[-24,24 30,24];
tGrid=Range[-60,24 30,6];

ParametricPlot[Evaluate[{x[t],x'[t]}/.sol],{t,0,100},Frame->True,FrameTicks->{tTicks,Automatic},FrameTicksStyle->Directive[Red,Thick],GridLines->{tGrid,Automatic},GridLinesStyle->LightGray,FrameLabel->(Style[#,14,Bold]&/@{x,Overscript[x,"."]}),AspectRatio->1]

ParametricPlot[Evaluate[{t,x[t]/.sol}],{t,0,50},Frame->True,FrameTicks->{Range[0,50,12],Automatic},FrameTicksStyle->Directive[Red,Thick],GridLines->{tGrid,Automatic},GridLinesStyle->LightGray,FrameLabel->(Style[#,14,Bold]&/@{t,x}),AspectRatio->1]


Giving me the errors

NDSolve::dvnoarg: The function x appears with no arguments. >>

ReplaceAll::reps: {-x[t]^2+(x^2)[t]==0,x[0]==0} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. >>

ReplaceAll::reps: {-x[0.00204082]^2+(x^2)[0.00204082]==0,x[0]==0} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. >>

ReplaceAll::reps: {-1. x[0.00204082]^2+(x^2)[0.00204082]==0.,x[0.]==0.} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. >>

General::stop: Further output of ReplaceAll::reps will be suppressed during this calculation. >>

Regards

• What error are you getting? Is it in NDSolve? If it is, the rest of the info is extraneous. Is it in the ParametricPlot? Then perhaps remove all of the unnecessary formatting options which are most likely irrelevant. Also, please edit your post so that the code are in code blocks: clock the grey question mark on the far right of the toolbar when editing your post for help. Edit: the error that you get tells you exactly what the problem is. Replace eqn with eqn==0 inside NDSolve. Secondly, you have some syntax errors: (x^2)[t] should be x[t]^2. Oct 11 '15 at 6:24
• Welcome to Mathematica.SE! 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!
– user9660
Oct 11 '15 at 6:31
• – user9660
Oct 11 '15 at 6:32
• Strongly related: mathematica.stackexchange.com/q/91670/1871 Oct 11 '15 at 6:39
• You seem to have added a new problem to the question. Please do not do that. Instead ask a new question. If you click on the "edited..." link in the middle to the left of your name/gravatar, you can "roll back" to the previous question. Oct 11 '15 at 12:28

This is an initial attempt to improve your answer. First eliminate errors in the first three lines, and focus on a small t up to 1.2. Beyond that there is a singularity/stiff system. This is for the small t range!

     Clear[x];
r = 1;
sol = NDSolve[{Derivative[1][x][t] - 1 - r*x[t] - x[t]^2 == 0,
x[0] == 0}, x, {t, 0, 1.2}]
Plot[Evaluate[x[t] /. sol], {t, 0, 1.2}]
ParametricPlot[Evaluate[{x[t], Derivative[1][x][t]} /. sol], {t, 0, 1.2}]


First plot shown here.

Further to the singularity issue, one can explore the sensitivity of parameters for this specific differential equation using

Clear[x, r, s];
sol = ParametricNDSolve[{Derivative[1][x][t] - s - r*x[t] == x[t]^2,
x[0] == 0}, x, {t, 0, 5}, {r, s}]

Plot[Evaluate[Table[x[r, 0.02][t] /. sol, {r, 0.1, 0.6, 0.02}]], {t,
0, 5}, PlotRange -> All]

Plot[Evaluate[Table[x[0.2, s][t] /. sol, {s, 0.01, 0.06, 0.01}]], {t,
0, 5}, PlotRange -> All]


The plot (s fixed at 0.02) show how quickly the curve shoots up even for smaller r values