Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: sfeam Newsgroups: comp.graphics.apps.gnuplot Subject: Re: trying to get a fit to work. Followup-To: comp.graphics.apps.gnuplot Date: Wed, 08 Jun 2011 21:48:19 -0700 Organization: gnuplot development team Lines: 50 Message-ID: References: <62b76acf-a50c-49f2-a02a-908398651e5b@q12g2000prb.googlegroups.com> Reply-To: sfeam@users.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit Injection-Date: Thu, 9 Jun 2011 04:48:04 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="WEZLCPHRH3QJlZRyUKB04A"; logging-data="16079"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/l6Ku4IOlWFI9z+B/CBq2q" User-Agent: KNode/4.4.9 Cancel-Lock: sha1:5hDD6CWAuCd/FV/rKMFi5+zfZSU= Xref: x330-a1.tempe.blueboxinc.net comp.graphics.apps.gnuplot:365 aviphysics wrote: > So I got this HPLC peak that I am trying to fit a exponentialized > Gaussian to. It fits decently in Mathematica but trying to fit it in > gnuplot yields "Undefined value during funtion evaluation" > > The equation is > modeltwo(x) = 1/(2*tau)*exp(sigma**2/(2*tau**2)-(x-em)/ > tau)*erfc(sigma/ > (sqrt(2)*tau)-(x-em)/(sqrt(2)*sigma)) > > Here is a plot using the starting constants > http://i283.photobucket.com/albums/kk302/keyserthomas/plot.jpg > > em=10 > sigma=2.3 > tau=4.98 > > Any ideas what the problem might be? I forwarded this to a colleague, who replied: %%%%%%%%%%%%%%%% I tried a few more experiments and found that: Windows Linux (or at least Porlock) --------- ------- erfc(x) fails for |x|>~20 works (goes from -2 to 0) erf(x) works works (both go from -1 to 1) exp(x) overflows overflows - both at exp(~700) = 1.2x10^307 Neither OS underflows with exp(-x) - both go to zero. I think this means there's something wrong with the way erfc works in windows, other than basic underflow handling. So an even simpler fix uses the definition of erfc: myerfc(x) = 1 - erf(x) - Frank %%%%%%%%%%%%%%%%%% So I looked at the code and found that if the configuration tool detects erfc() in the standard libraries, the program uses it. If not, there is an internal implementation. I am guessing that you are using a machine that has configured in the internal version, and there is an overflow bug in it somewhere. That should be fixable, but for now you use the workaround above.