Re: Checking the Results of NDSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg37268] Re: Checking the Results of NDSolve
- From: Tom Burton <tburton at brahea.com>
- Date: Mon, 21 Oct 2002 02:29:36 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
On 10/18/02 2:26 AM, in article aook3e$pij$1 at smc.vnet.net, "Thomas Steger"
<steger at uni-greifswald.de> wrote:
> I use NDSolve to approximate a 6-dimensional and highly non-linear
> dynamic system numerically.
>
> QUESTION: What are usual (and simple) techniques to check the
> reliability of the resulting numerical solution?
I would check the the boundary conditions and then plot the residual error
from the differential equation. Here is an example with all output deleted.
possibilities = NDSolve[{y[x]^4 + y'[x]^3 == 0, y[0] - 1 == 0},
y[x], {x, 0, 1}]
yy[x_] = y[x] /. possibilities
SHOW RESULTS
Needs["Graphics`Colors`"];
SetOptions[Plot,
PlotStyle -> ({Thickness[0.01], #1} & ) /@ {Red,Green,Blue}
];
Plot[Evaluate[Re[yy[x]]], {x, 0, 1}]
Plot[Evaluate[Im[yy[x]]], {x, 0, 1}]
CHECK INITIAL CONDITIONS
yy[0] - 1
PREPARE AND SHOW RESIDUAL
res[x_] = yy[x]^4 + yy'[x]^3
Plot[Evaluate[Re[res[x]]], {x, 0, 1}]
Plot[Evaluate[Im[res[x]]], {x, 0, 1}]
Plot[Evaluate[Re[res[x]]], {x, 0, 0.001}, PlotRange -> All]
Plot[Evaluate[Im[res[x]]], {x, 0, 0.001}, PlotRange -> All]