Re: Differential Equation: Not getting result

*To*: mathgroup at smc.vnet.net*Subject*: [mg127335] Re: Differential Equation: Not getting result*From*: Murray Eisenberg <murray at math.umass.edu>*Date*: Wed, 18 Jul 2012 01:37:11 -0400 (EDT)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*Delivered-to*: mathgroup-newout@smc.vnet.net*Delivered-to*: mathgroup-newsend@smc.vnet.net*References*: <20120717053145.BA8F96877@smc.vnet.net>*Reply-to*: murray at math.umass.edu

First, it's hard to help you when you _still_ have not learned basic Mathematica syntax. Did you, for example, look at examples for DSolve or NDSolve to see how you denote the derivative? It should be x'[t] and NOT (x^')[t]. Next, there is no need for NDSolve here, as the differential equation can be solved exactly (symbolically): r = 1; K = 1; eqn = x'[t] - r x[t] (1 - x[t]/K) == 0 DSolve[eqn, x[t], t] The result, in InputForm, is: {{x[t] -> E^t/(E^t + E^C[1])}} (Did you try that? If not, why not??) (Of course that is a "generic" solution, depending on ONE parameter C[1], that does not include the trivial solution identically zero.) Next, look at the first initial condition you want, x[0] == 1/2. DSolve[{eqn, x[0] == 1/2}, x[t], t] The result, again in InputForm, is: {{x[t] -> E^t/(1 + E^t)}} (You'll see a DSolve warning there about inverse functions.) So you cannot possibly expect to satisfy your additional condition x'[0]==0 as well. In fact, if you try it... DSolve[{eqn, x[0] == 1/2, x'[0] == 0}, x[t], t] ... then you get an empty solution set! Going back to just one initial condition, for x[0]... sol = First @ DSolve[{eqn, x[0] == 1/2}, x[t], t] ... you'll get a plot from: ParametricPlot[Evaluate[{x[t] /. sol, D[x[t] /. sol, t]}], {t, 0, 50}] Finally, suppose you really did want, for reasons unknown, to use NDSolve instead of solve. Still, you cannot use both initial conditions, just the first. On 7/17/12 1:31 AM, Rahul Chakraborty wrote: > Dear all, > > For the following code i'm not getting result. kindly tell me where i'm making mistake. > > Clear[x]; > r=1; > K=1; > eqn= (x^')[t]-r x[t] (1-x[t]/K)==0//Simplify; > sol=NDSolve[{eqn,x[0]==1/2,x'[0]==0},x[t],{t,0,50}][[1]] > ParametricPlot[Evaluate[{x[t]/.sol,D[x[t]/.sol,t]}],{t,0,50},Frame->True,AxesLabel->{"x",Overscript[x,"."]},AspectRatio->1] > ParametricPlot[Evaluate[{t,x[t]/.sol}],{t,0,50},Frame->True,AxesLabel->{"t","x"},AspectRatio->1] > > > Regards, > rc > -- Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305

**References**:**Differential Equation: Not getting result***From:*Rahul Chakraborty <rahul.6sept@gmail.com>