[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gsl] Negative chi squared value in MC Vegas

From: L. A. Pritchett-Sheats
Subject: [Help-gsl] Negative chi squared value in MC Vegas
Date: Tue, 7 Oct 2008 09:55:06 -0600 (MDT)
User-agent: SquirrelMail/1.4.8-4.0.1.el5.lanl.4

Thought I would post this on the help list before reporting this as a bug.

I'm writing an integration package which calculates N dimensional
integrals on infinite intervals using the GSL Monte Carlo functions. I'm
using tan(pi/2 x) to transform the integral to the (0,1) domain. For
different functions, I've seen negative values for the chi/dof values.
This is a reproducer integrating a gaussian on (0,+inf) that follows the
sample code found in the GSL manual where I've seen this problem on both a
Mac ( 10.4.11, Intel ) and a Linux machine (AMD Operton 86x_64). Although
the values differ on the two machines, at least 2-3 calls in the loop will
return a negative value for chi/dof.

I searched through the bug list archives and I didn't see this reported.
Is this a bug or am I doing something wrong here?

Compile: gcc -o vegas.x gaussian_vegas.c -lgsl -lgslcblas -lm

Output from the Mac

After warm up ====================
result     = 5.000000214E-01
est error  = 3.714575544E-08
answer     = 5.000000000E-01
true error = 2.136549626E-08
sigma      = 0.575
chisq/dof = 0.648
result = 4.999999999E-01 sigma = 3.757398332E-10 chisq/dof = 0.000
result = 4.999999995E-01 sigma = 3.830138812E-10 chisq/dof = -64.000
result = 5.000000006E-01 sigma = 3.842008411E-10 chisq/dof = -64.000
result = 5.000000003E-01 sigma = 3.900425646E-10 chisq/dof = 64.000
result = 5.000000000E-01 sigma = 3.869444558E-10 chisq/dof = 64.000
result = 4.999999998E-01 sigma = 3.927335539E-10 chisq/dof = -64.000
result = 4.999999994E-01 sigma = 3.912789134E-10 chisq/dof = 0.000
result = 5.000000002E-01 sigma = 3.898697784E-10 chisq/dof = 0.000
result = 5.000000000E-01 sigma = 3.983946547E-10 chisq/dof = -64.000
result = 5.000000001E-01 sigma = 3.881925195E-10 chisq/dof = -64.000
Final results ====================
result     = 5.000000001E-01
est error  = 3.881925195E-10
answer     = 5.000000000E-01
true error = 1.362355784E-10
sigma      = 0.351

Lori A. Pritchett-Sheats, PhD.
Technical Staff Member
HPC-5, Integration Systems
Phone: (505) 665-6675   Fax: (505) 664-0172
Snail Mail
Los Alamos National Laboratory
PO Box 1663
MS T080
Los Alamos, New Mexico 87544

Attachment: gaussian_vegas.c
Description: /

reply via email to

[Prev in Thread] Current Thread [Next in Thread]