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


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

NDSolve solution does not fulfill boundary condition ??

Started byAlex <axel.kowald@gmail.com>
First post2011-08-29 07:48 +0000
Last post2011-08-30 00:01 +0000
Articles 3 — 3 participants

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


Contents

  NDSolve solution does not fulfill boundary condition ?? Alex <axel.kowald@gmail.com> - 2011-08-29 07:48 +0000
    Re: NDSolve solution does not fulfill boundary condition ?? Peter Pein <petsie@dordos.net> - 2011-08-29 11:44 +0000
    Re: NDSolve solution does not fulfill boundary condition ?? "Kevin J. McCann" <kjm@KevinMcCann.com> - 2011-08-30 00:01 +0000

#4642 — NDSolve solution does not fulfill boundary condition ??

FromAlex <axel.kowald@gmail.com>
Date2011-08-29 07:48 +0000
SubjectNDSolve solution does not fulfill boundary condition ??
Message-ID<j3fg96$fb4$1@smc.vnet.net>
Hello everybody,

I use Mathematica 7 and try to solve and plot a 2nd order ODE like this:

sol = NDSolve[{0 == 4800*O2''[x] + 1500*Exp[-(100*x)^2] - 2000*O2[x],
O2'[-0.5] == 0, O2'[0.5] == 0}, O2, {x, -1, 1}]
Plot[O2[x] /. sol, {x, -1, 1}, PlotRange -> All]

The solution looks ok, i.e. the slope of the solution is 0 at 0.5 and
-0.5, as required by the boundary conditions. But if I slightly change
the parameter values from 1500 to 1000 like this:

sol = NDSolve[{0 == 4800*O2''[x] + 1000*Exp[-(100*x)^2] - 2000*O2[x],
O2'[-0.5] == 0, O2'[0.5] == 0}, O2, {x, -1, 1}]

I get a solution with slope=0 at -0.5, but with a positive slope at
0.5 !!??

How can this be ?  What am I doing wrong ?

Many thanks,

axel

[toc] | [next] | [standalone]


#4649

FromPeter Pein <petsie@dordos.net>
Date2011-08-29 11:44 +0000
Message-ID<j3fu34$hee$1@smc.vnet.net>
In reply to#4642
Am 29.08.2011 09:48, schrieb Alex:
> Hello everybody,
> 
> I use Mathematica 7 and try to solve and plot a 2nd order ODE like this:
> 
> sol = NDSolve[{0 == 4800*O2''[x] + 1500*Exp[-(100*x)^2] - 2000*O2[x],
> O2'[-0.5] == 0, O2'[0.5] == 0}, O2, {x, -1, 1}]
> Plot[O2[x] /. sol, {x, -1, 1}, PlotRange -> All]
> 
> The solution looks ok, i.e. the slope of the solution is 0 at 0.5 and
> -0.5, as required by the boundary conditions. But if I slightly change
> the parameter values from 1500 to 1000 like this:
> 
> sol = NDSolve[{0 == 4800*O2''[x] + 1000*Exp[-(100*x)^2] - 2000*O2[x],
> O2'[-0.5] == 0, O2'[0.5] == 0}, O2, {x, -1, 1}]
> 
> I get a solution with slope=0 at -0.5, but with a positive slope at
> 0.5 !!??
> 
> How can this be ?  What am I doing wrong ?
> 
> Many thanks,
> 
> axel
> 

Hi Axel,

your solution is an even function. Try solving from 0 to 1 and define

o2[x_]=O2[Abs[x]] /. First[NDSolve[...,Method->"ImplicitRungeKutta"]]

and keep in mind you're using inexact numbers, or use DSolve[{...}, x]
in place of NDSolve[{...}, {x, -1, 1}].

O2'[{-1,1}/2] /. First[
  DSolve[{0 == 4800*O2''[x] + 1500*Exp[-(100*x)^2] - 2000*O2[x],
           O2'[-(1/2)] == 0, O2'[1/2] == 0}, O2, x]]

will give you exactly {0, 0}


Peter

[toc] | [prev] | [next] | [standalone]


#4652

From"Kevin J. McCann" <kjm@KevinMcCann.com>
Date2011-08-30 00:01 +0000
Message-ID<j3h98b$nhk$1@smc.vnet.net>
In reply to#4642
My guess is that this is due to the extreme nonlinearity of the DE. The 
exponential is essentially zero except for x = 0; so, you have something 
like a delta function at the origin. Plot the RHS, which should be zero, 
for the two cases, and you will see a problem at x = 0. I think the 
question is why it *does* work when the parameter is 1500. The whole 
thing falls apart even for a value of 1490.

Kevin

On 8/29/2011 3:48 AM, Alex wrote:
> Hello everybody,
>
> I use Mathematica 7 and try to solve and plot a 2nd order ODE like this:
>
> sol = NDSolve[{0 == 4800*O2''[x] + 1500*Exp[-(100*x)^2] - 2000*O2[x],
> O2'[-0.5] == 0, O2'[0.5] == 0}, O2, {x, -1, 1}]
> Plot[O2[x] /. sol, {x, -1, 1}, PlotRange ->  All]
>
> The solution looks ok, i.e. the slope of the solution is 0 at 0.5 and
> -0.5, as required by the boundary conditions. But if I slightly change
> the parameter values from 1500 to 1000 like this:
>
> sol = NDSolve[{0 == 4800*O2''[x] + 1000*Exp[-(100*x)^2] - 2000*O2[x],
> O2'[-0.5] == 0, O2'[0.5] == 0}, O2, {x, -1, 1}]
>
> I get a solution with slope=0 at -0.5, but with a positive slope at
> 0.5 !!??
>
> How can this be ?  What am I doing wrong ?
>
> Many thanks,
>
> axel
>

[toc] | [prev] | [standalone]


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


csiph-web