IDL is not accurate enough!

This is a discussion on IDL is not accurate enough! within the Idl-pvwave forums in Programming Languages category; Hi, I've been having problems with IDL accuracy. I'm trying to perform calculations using the gamma function. The problem is that it grows VERY fast! Performing this calculation in double (namely gamma(x)/ gamma(y) with x and y big) yields the result: NaN... Would it be possible to use a program like 'Mathematica' (or any other) and to plug it in my ILD program? Some kind of CALL_EXTERNAL that is to say. If it is possible, how can I do it and what is the best program to use? Thanks, Noah...

Go Back   Application Development Forum > Programming Languages > Idl-pvwave

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-28-2008, 12:30 PM
noahh.schwartz@gmail.com
Guest
 
Default IDL is not accurate enough!

Hi,

I've been having problems with IDL accuracy. I'm trying to perform
calculations using the gamma function. The problem is that it grows
VERY fast! Performing this calculation in double (namely gamma(x)/
gamma(y) with x and y big) yields the result: NaN...
Would it be possible to use a program like 'Mathematica' (or any
other) and to plug it in my ILD program? Some kind of CALL_EXTERNAL
that is to say. If it is possible, how can I do it and what is the
best program to use?

Thanks,
Noah
Reply With Quote
  #2  
Old 08-28-2008, 12:35 PM
David Fanning
Guest
 
Default Re: IDL is not accurate enough!

noahh.schwartz@gmail.com writes:

> I've been having problems with IDL accuracy. I'm trying to perform
> calculations using the gamma function. The problem is that it grows
> VERY fast! Performing this calculation in double (namely gamma(x)/
> gamma(y) with x and y big) yields the result: NaN...
> Would it be possible to use a program like 'Mathematica' (or any
> other) and to plug it in my ILD program? Some kind of CALL_EXTERNAL
> that is to say. If it is possible, how can I do it and what is the
> best program to use?


It seems *highly* unlikely to me that IDL's implementation
of DOUBLE is any less accurate than any other program's
implementation. In fact, this probably has something to
do with the *computer* and not with the program. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Reply With Quote
  #3  
Old 08-28-2008, 12:42 PM
FÖLDY Lajos
Guest
 
Default Re: IDL is not accurate enough!


On Thu, 28 Aug 2008, noahh.schwartz@gmail.com wrote:

> Hi,
>
> I've been having problems with IDL accuracy. I'm trying to perform
> calculations using the gamma function. The problem is that it grows
> VERY fast! Performing this calculation in double (namely gamma(x)/
> gamma(y) with x and y big) yields the result: NaN...
> Would it be possible to use a program like 'Mathematica' (or any
> other) and to plug it in my ILD program? Some kind of CALL_EXTERNAL
> that is to say. If it is possible, how can I do it and what is the
> best program to use?
>
> Thanks,
> Noah
>


gamma(x)/gamma(y) => exp(lngamma(x)-lngamma(y))

regards,
lajos

Reply With Quote
  #4  
Old 08-28-2008, 04:50 PM
Kenneth P. Bowman
Guest
 
Default Re: IDL is not accurate enough!

In article <MPG.232081d2b8625528989730@news.giganews.com>,
David Fanning <news@dfanning.com> wrote:

> noahh.schwartz@gmail.com writes:
>
> > I've been having problems with IDL accuracy. I'm trying to perform
> > calculations using the gamma function. The problem is that it grows
> > VERY fast! Performing this calculation in double (namely gamma(x)/
> > gamma(y) with x and y big) yields the result: NaN...
> > Would it be possible to use a program like 'Mathematica' (or any
> > other) and to plug it in my ILD program? Some kind of CALL_EXTERNAL
> > that is to say. If it is possible, how can I do it and what is the
> > best program to use?

>
> It seems *highly* unlikely to me that IDL's implementation
> of DOUBLE is any less accurate than any other program's
> implementation. In fact, this probably has something to
> do with the *computer* and not with the program. :-)


Mathematica can do arbitrary-precision arithmetic ... with hundreds of digits,
if necessary. Don't expect it to be fast, though, as it is all done
in software, not with the hardware floating-point unit with which we
normally do single- and double-precision arithmetic.

Ken
Reply With Quote
  #5  
Old 09-02-2008, 08:20 AM
Haje Korth
Guest
 
Default Re: IDL is not accurate enough!

Noah,
other in this thread have laid out the issue, nothing to add here. If you
want to go brute force with extended precision, check out the cephes math
library at http://www.netlib.org/cephes/. There is an extended precision
version that has a gamma function. I have used that in the past for
calculating hypergeometric functions and it served my needs. I used
call_external, but you can certainly turn this into a dlm.

Cheers,
Haje

<noahh.schwartz@gmail.com> wrote in message
news:c7b7fc70-b4db-4c3d-8d2b-50f88dbd1d62@s50g2000hsb.googlegroups.com...
> Hi,
>
> I've been having problems with IDL accuracy. I'm trying to perform
> calculations using the gamma function. The problem is that it grows
> VERY fast! Performing this calculation in double (namely gamma(x)/
> gamma(y) with x and y big) yields the result: NaN...
> Would it be possible to use a program like 'Mathematica' (or any
> other) and to plug it in my ILD program? Some kind of CALL_EXTERNAL
> that is to say. If it is possible, how can I do it and what is the
> best program to use?
>
> Thanks,
> Noah



Reply With Quote
  #6  
Old 09-04-2008, 02:46 PM
rtk
Guest
 
Default Re: IDL is not accurate enough!

On Aug 28, 2:50 pm, "Kenneth P. Bowman" <k-bow...@null.edu> wrote:
> Mathematica can do arbitrary-precision arithmetic ... with hundreds of digits,
> if necessary. Don't expect it to be fast, though, as it is all done
> in software, not with the hardware floating-point unit with which we
> normally do single- and double-precision arithmetic.


Check on the IDL code contrib site sometime next week. I just
uploaded DLMs that add arbitrary precision floating point as well as
integer and rational types to IDL. These are wrappers on the MPFR and
GMP libraries, respectively. Caveat emptor, but I'll answer emails.
You will need to recompile if using something later than IDL 6.3.
Examples included.

Ron Kneusel
rkneusel@ittvis.com

Reply With Quote
  #7  
Old 09-04-2008, 04:33 PM
Kenneth P. Bowman
Guest
 
Default Re: IDL is not accurate enough!

In article
<e32f4688-b58e-4f27-b2f9-17faea24285a@i24g2000prf.googlegroups.com>,
rtk <oneelkruns@hotmail.com> wrote:

> On Aug 28, 2:50 pm, "Kenneth P. Bowman" <k-bow...@null.edu> wrote:
> > Mathematica can do arbitrary-precision arithmetic ... with hundreds of digits,
> > if necessary. Don't expect it to be fast, though, as it is all done
> > in software, not with the hardware floating-point unit with which we
> > normally do single- and double-precision arithmetic.

>
> Check on the IDL code contrib site sometime next week. I just
> uploaded DLMs that add arbitrary precision floating point as well as
> integer and rational types to IDL. These are wrappers on the MPFR and
> GMP libraries, respectively. Caveat emptor, but I'll answer emails.
> You will need to recompile if using something later than IDL 6.3.
> Examples included.
>
> Ron Kneusel
> rkneusel@ittvis.com


So, when you say DLMs, does that mean Windows only? It means nothing
to me as a Linux and Mac user.

Ken Bowman
Reply With Quote
  #8  
Old 09-05-2008, 11:57 AM
mgalloy@gmail.com
Guest
 
Default Re: IDL is not accurate enough!

On Sep 4, 2:33*pm, "Kenneth P. Bowman" <k-bow...@null.edu> wrote:
> So, when you say DLMs, does that mean Windows only? *It means nothing
> to me as a Linux and Mac user.


DLMs (Dynamically Loadable Modules) are available on all platforms.
This is a way of wrapping and loading C code to make it usable from
within IDL. DLLs are a Windows thing (the equivalent of a shared
object on Unix).

Mike
--
www.michaelgalloy.com
Tech-X Corporation
Software Developer


Reply With Quote
  #9  
Old 09-05-2008, 12:18 PM
Mark Piper
Guest
 
Default Re: IDL is not accurate enough!

On Sep 5, 9:57*am, "mgal...@gmail.com" <mgal...@gmail.com> wrote:

> DLMs (Dynamically Loadable Modules) are available on all platforms.
> This is a way of wrapping and loading C code


and Fortran code, too!

mp

Reply With Quote
  #10  
Old 09-05-2008, 12:53 PM
Kenneth P. Bowman
Guest
 
Default Re: IDL is not accurate enough!

In article
<53e9aaf0-6cd2-41c0-95ca-1559353845a4@m36g2000hse.googlegroups.com>,
"mgalloy@gmail.com" <mgalloy@gmail.com> wrote:

> On Sep 4, 2:33*pm, "Kenneth P. Bowman" <k-bow...@null.edu> wrote:
> > So, when you say DLMs, does that mean Windows only? *It means nothing
> > to me as a Linux and Mac user.

>
> DLMs (Dynamically Loadable Modules) are available on all platforms.
> This is a way of wrapping and loading C code to make it usable from
> within IDL. DLLs are a Windows thing (the equivalent of a shared
> object on Unix).
>
> Mike
> --
> www.michaelgalloy.com
> Tech-X Corporation
> Software Developer


Thanks, Mike. I will take a look and see what I need to do to
make one work.

Ken
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 03:47 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.