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


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

Re: Defining a variable from an error message (NDSolve::ndsz)

Started byOliver Ruebenkoenig <ruebenko@wolfram.com>
First post2011-10-23 10:35 +0000
Last post2011-10-23 10:35 +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: Defining a variable from an error message (NDSolve::ndsz) Oliver Ruebenkoenig <ruebenko@wolfram.com> - 2011-10-23 10:35 +0000

#5824 — Re: Defining a variable from an error message (NDSolve::ndsz)

FromOliver Ruebenkoenig <ruebenko@wolfram.com>
Date2011-10-23 10:35 +0000
SubjectRe: Defining a variable from an error message (NDSolve::ndsz)
Message-ID<j80ql8$agf$1@smc.vnet.net>
On Sat, 22 Oct 2011, Jonathan Frazer wrote:

> Hi Everyone,
>
> Using the example from the NDSolve::ndsz section in the documentation centre, evaluating
>
> NDSolve[{(2 - f[x]) f'[x] == f[x], f[0] == 1}, f, {x, 0, 5}]
>
> gives the error message
>
> "NDSolve:ndsz : At x == 0.38629402687577696`, step size is effectively zero; singularity or stiff system suspected".
>
> What I would like to do is be able to automatically define a variable xdanger = 0.38629402687577696 so that I can use it in a subsequent part of the code.
>
> Does anyone have a suggestion for how I might do this?
>
> Many thanks,
>
> Jonny
>
>
> P.S. In similar problems I usually can make use of Check one way or another but in this case I want to be able to use the variable xdanger to make an inequality. For this reason, I don't think Check is applicable.
>

-- 

Jonny,

you could extract the value from the interpolating function, like so:

if = First@(f /.
     NDSolve[{(2 - f[x]) f'[x] == f[x], f[0] == 1}, f, {x, 0, 5}])

Last[if["Grid"]]

Hope this helps,
Oliver

[toc] | [standalone]


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


csiph-web