MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: problem with NDSolve::dvnoarg:

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116562] Re: problem with NDSolve::dvnoarg:
  • From: tarun dutta <tarunduttaz at gmail.com>
  • Date: Sun, 20 Feb 2011 05:24:09 -0500 (EST)
  • References: <ijo53p$lec$1@smc.vnet.net>

On Feb 19, 3:13 pm, Daniel Lichtblau <d... at wolfram.com> wrote:
> tarun dutta wrote:
> > n = 5;
> > p = 5/1000;
> > q = 1/10;
> > c[-1][t] = 0; d[-1][t] = 0;
> > c[n + 1][t] = 0; d[n + 1][t] = 0;
> > eqn1 = Table[
> >    c[i]'[t] == ((1/2)*i (i - 1) - q*i)*c[i][t] -
> >      p*(Sqrt[i]*
> >          c[i - 1][t]*(Sum[Sqrt[i]*d[i - 1][t]*d[i][t], {i, 0, n}]) +
> >         Sqrt[i + 1]*
> >          c[i + 1][
> >           t]*(Sum[Sqrt[i + 1]*d[i - 1][t]*d[i][t], {i, 0, n}])), {i,
> >     0, n}];
> > eqn2 = Table[
> >    d[i]'[t] == ((1/2)*i (i - 1) - q*i)*d[i][t] -
> >      p*(Sqrt[i]*
> >          d[i - 1][t]*(Sum[Sqrt[i]*c[i - 1][t]*c[i][t], {i, 0, n}]) +
> >         Sqrt[i + 1]*
> >          d[i + 1][
> >           t]*(Sum[Sqrt[i + 1]*c[i - 1][t]*c[i][t], {i, 0, n}])), {i,
> >     0, n}];
> > eqn3 = Table[Sum[(c[i]^2)[t], {i, 0, n}] == 1, {i, 1}];
> > eqn4 = Table[Sum[(d[i]^2)[t], {i, 0, n}] == 1, {i, 1}];
> > eqns = Flatten[Join[eqn1, eqn2, eqn3, eqn4]];
> > bcs = {{c[0][0] == d[0][0] == 0.004567},
> >    Table[c[i][0] == 0.0000000034, {i, 1, 5}],
> >    Table[d[i][0] == 0.0000000034, {i, 1, 5}]};
> > var = Join[Table[c[i], {i, 0, 5}], Table[d[i], {i, 0, n}]];
> > sol = NDSolve[{eqns, bcs}, var, {t, 1/10}]
>
> > NDSolve::dvnoarg:
>
> > I can not understand the meaning of this kind of error,,
> > can anyone explain and give some valuable insight.
> > regards,
> > tarun
>
> An addendum to my last two responses.
>
> Once you get a viable system you learn it is overdetermined. This is
> because the algebraic invariants are not needed to make it fully
> determined. Since you want them enforced so the solution does not
> "wander" due to numerical error, you can use the Projection method to
> enforce them. I show the code below. Please observe the usage
> (d[i][t]^2) rather than (d[i]^2)[t], as the latter is what persistently
> gives rise to an ill-formed system.
>
> n = 5;
> p = 5/1000;
> q = 1/10;
> c[-1][t] = 0; d[-1][t] = 0;
> c[n + 1][t] = 0; d[n + 1][t] = 0;
> eqn1 = Table[
>     c[i]'[t] == ((1/2)*i (i - 1) - q*i)*c[i][t] -
>       p*(Sqrt[i]*
>           c[i - 1][t]*(Sum[Sqrt[i]*d[i - 1][t]*d[i][t], {i, 0, n}]) +
>          Sqrt[i + 1]*
>           c[i + 1][
>            t]*(Sum[Sqrt[i + 1]*d[i - 1][t]*d[i][t], {i, 0, n} ])), {i,
>      0, n}];
> eqn2 = Table[
>     d[i]'[t] == ((1/2)*i (i - 1) - q*i)*d[i][t] -
>       p*(Sqrt[i]*
>           d[i - 1][t]*(Sum[Sqrt[i]*c[i - 1][t]*c[i][t], {i, 0, n}]) +
>          Sqrt[i + 1]*
>           d[i + 1][
>            t]*(Sum[Sqrt[i + 1]*c[i - 1][t]*c[i][t], {i, 0, n}])), {i,
>      0, n}];
> invariants = {Sum[(c[i][t]^2), {i, 0, n}] - 1,
>     Sum[(d[i][t]^2), {i, 0, n}] - 1};
> eqns = Flatten[Join[eqn1, eqn2]];
> bcs = {{c[0][0] == d[0][0] == 0.004567},
>     Table[c[i][0] == 0.0000000034, {i, 1, 5}],
>     Table[d[i][0] == 0.0000000034, {i, 1, 5}]};
> var = Join[Table[c[i], {i, 0, 5}], Table[d[i], {i, 0, n}]];
>
> sol = NDSolve[Flatten[{eqns, bcs}], var, {t, 1/10},
>    Method -> {Projection, "Invariants" -> invariants}]
>
> This will give a solution.
>
> It is, alas, almost certainly a bad solution. This is because the
> invariants are not satisfied for t==0, hence cannot be satisfied
> elsewhere. So that might indicate a problematic formulation.
>
> Daniel Lichtblau
> Wolfram Research

yes the initial condition does not satisfy constraint at t=0, so I will
have to look into that matter.
thanks again daniel.
with best regards,
tarun


  • Prev by Date: DeveloperContextFreeForm and local symbols in packages
  • Next by Date: Re: How to do quickest
  • Previous by thread: Re: problem with NDSolve::dvnoarg:
  • Next by thread: n-adic integers