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


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

Re: NDSolve[]

Started byDrMajorBob <btreat1@austin.rr.com>
First post2011-12-10 12:38 +0000
Last post2011-12-10 12:38 +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: NDSolve[] DrMajorBob <btreat1@austin.rr.com> - 2011-12-10 12:38 +0000

#7091 — Re: NDSolve[]

FromDrMajorBob <btreat1@austin.rr.com>
Date2011-12-10 12:38 +0000
SubjectRe: NDSolve[]
Message-ID<jbvjsv$j3e$1@smc.vnet.net>
The first method has invalid syntax for Derivative. Here are three correct  
solutions:

{x1, y1} = {x, y} /.
    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}];
{x2, y2} = {x, y} /.
    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}];
{x3, y3} = {x, y} /.
    First@NDSolve[{D[x[t], t] == -y[t] - x[t]^2,
       D[y[t], t] == 2*x[t] - y[t], x[0] == y[0] == 1}, {x, y}, {t,
       10}];
Row@{Plot[{x1@t, y1@t}, {t, 0, 10}, ImageSize -> 250],
   Plot[{x2@t, y2@t}, {t, 0, 10}, ImageSize -> 250],
   Plot[{x3@t, y3@t}, {t, 0, 10}, ImageSize -> 250]}

Bobby


> Z
> Subject: NDSolve[]
> To: mathgroup@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}]
>


-- 
DrMajorBob@yahoo.com

[toc] | [standalone]


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


csiph-web