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


Groups > comp.soft-sys.math.mathematica > #7068

Re: NDSolve[]

From "Nasser M. Abbasi" <nma@12000.org>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: NDSolve[]
Date 2011-12-10 12:28 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jbvj8r$iqd$1@smc.vnet.net> (permalink)
References <jbsq3f$3ul$1@smc.vnet.net>

Show all headers | View raw


> 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

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

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

csiph-web