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


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

NDSolve[]

Started bysteve@smc.vnet.net (Steven M. Christensen)
First post2011-12-09 11:06 +0000
Last post2011-12-10 12:28 +0000
Articles 2 — 2 participants

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


Contents

  NDSolve[] steve@smc.vnet.net (Steven M. Christensen) - 2011-12-09 11:06 +0000
    Re: NDSolve[] "Nasser M. Abbasi" <nma@12000.org> - 2011-12-10 12:28 +0000

#7061 — NDSolve[]

Fromsteve@smc.vnet.net (Steven M. Christensen)
Date2011-12-09 11:06 +0000
SubjectNDSolve[]
Message-ID<jbsq3f$3ul$1@smc.vnet.net>
For the same equations, why does the first method as following give
the error but the other one give the desired result?

NDSolve[{Derivative[x[t], t] == -y[t] - x[t]^2,
  Derivative[y[t], t] == 2*x[t] - y[t], x[0] == y[0] == 1}, {x,
  y}, {t, 10}]

NDSolve[{x'[t] == -y[t] - x[t]^2, y'[t] == 2*x[t] - y[t],
  x[0] == y[0] == 1}, {x, y}, {t, 10}]

[toc] | [next] | [standalone]


#7068

From"Nasser M. Abbasi" <nma@12000.org>
Date2011-12-10 12:28 +0000
Message-ID<jbvj8r$iqd$1@smc.vnet.net>
In reply to#7061
> For the same equations, why does the first method as following give
> the error but the other one give the desired result?
>
> NDSolve[{Derivative[x[t], t] == -y[t] - x[t]^2,
>    Derivative[y[t], t] == 2*x[t] - y[t], x[0] == y[0] == 1}, {x,
>    y}, {t, 10}]
>
> NDSolve[{x'[t] == -y[t] - x[t]^2, y'[t] == 2*x[t] - y[t],
>    x[0] == y[0] == 1}, {x, y}, {t, 10}]
>

Need to use Derivative[1][x][t] and not Derivative[x[t], t] :

--------------------------------------------
sol = First@
   NDSolve[{Derivative[1][x][t] == -y[t] - x[t]^2,
     Derivative[1][y][t] == 2*x[t] - y[t], x[0] == y[0] == 1}, {x,
     y}, {t, 10}]
Plot[x[t] /. sol, {t, 0, 10}]
----------------------------------------------

---------------------------------------
sol = First@
    NDSolve[{x'[t] == -y[t] - x[t]^2, y'[t] == 2*x[t] - y[t],
      x[0] == y[0] == 1}, {x, y}, {t, 10}];
Plot[x[t] /. sol, {t, 0, 10}]
---------------------------------------------

--Nasser

[toc] | [prev] | [standalone]


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


csiph-web