MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

NDSolve and Piecewise flakiness for l'Hopital

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105715] NDSolve and Piecewise flakiness for l'Hopital
  • From: Frank Iannarilli <frankeye at cox.net>
  • Date: Wed, 16 Dec 2009 06:19:33 -0500 (EST)

Hi,

This post might indicate a bug, or at least heighten one's wariness
when using NDSolve and Piecewise together.

In post: "Specifiying finiteness condition using NDSolve"

http://groups.google.com/group/comp.soft-sys.math.mathematica/browse_thread/thread/d3634c8557a960a9/a040e052807f7084?lnk=gst&q=indeterminate+ndsolve#a040e052807f7084

   Brian Higgins provides a means of harnessing l'Hopital's rule for
NDSolve cases where one's equation goes Indeterminate due to a zero-
value denominator.  This involves using "helper" functions to tell
NDSolve about the limit behavior.

I used this trick, following Brian, but note the following findings:

1.  Instead of using multiple definitions of a helper function with
conditions (/;), I found I instead needed (in Mathematica 7) to employ
Piecewise equivalents, e.g.,

Piecewise[{{0, x<= 0},{1/x,x>0}]
  rather than:
g2[x_ /; x > 0] := 1/x
g2[x_ /; x == 0] := 0


2.  More troubling, with one variable's initial condition set to zero
and appearing in a denominator, but using the l'Hopital trick, NDSolve
would "unpredictably" choke with an "Indeterminate" protest on some,
yet not other variations of my 1st-order ODE/initial-value system.

The workaround for the failure cases was simply to omit the l'Hopital
trick and to set that initial condition to a small non-zero value.

I verified that the derivatives of the system evaluated to numeric
values at the initial condition. Why would NDSolve get confused
sometimes?

If someone cared to see the details, I could provide a notebook (and
would first try to reduce my examples to simpler form).

Frank







  • Prev by Date: Re: Need to speed up a matrix calculation
  • Next by Date: Re: Toolbar
  • Previous by thread: Help needed using NDSolve and NIntegrate
  • Next by thread: Trick to create vector metafile in Mathematica 7.0 for copy & paste