Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #10971 > unrolled thread

Re: Differential Equation: Not getting result

Started byMurray Eisenberg <murray@math.umass.edu>
First post2012-07-18 05:37 +0000
Last post2012-07-18 05:37 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Differential Equation: Not getting result Murray Eisenberg <murray@math.umass.edu> - 2012-07-18 05:37 +0000

#10971 — Re: Differential Equation: Not getting result

FromMurray Eisenberg <murray@math.umass.edu>
Date2012-07-18 05:37 +0000
SubjectRe: Differential Equation: Not getting result
Message-ID<ju5i3j$3qn$1@smc.vnet.net>
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

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web