Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #10971
| From | Murray Eisenberg <murray@math.umass.edu> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Differential Equation: Not getting result |
| Date | 2012-07-18 05:37 +0000 |
| Message-ID | <ju5i3j$3qn$1@smc.vnet.net> (permalink) |
| References | <20120717053145.BA8F96877@smc.vnet.net> |
| Organization | Time-Warner Telecom |
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@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
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: Differential Equation: Not getting result Murray Eisenberg <murray@math.umass.edu> - 2012-07-18 05:37 +0000
csiph-web