From: James Theiler <jt@lanl.gov>
To: Giulio Bottazzi <giulio.bottazzi@libero.it>
Cc: gsl-discuss@sourceware.org
Subject: Re: problem with gsl_sf_lnpoch
Date: Fri, 29 Sep 2006 17:26:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.44.0609291108260.22186-100000@yks.lanl.gov> (raw)
In-Reply-To: <20060929190112.49d85f61.giulio.bottazzi@libero.it>
I think Giulio is right; I took a quick look at the code,
and the value when the second argument is zero is hardcoded;
ie:
int
gsl_sf_lnpoch_e(const double a, const double x, gsl_sf_result * result)
{
/* CHECK_POINTER(result) */
if(a <= 0.0 || a+x <= 0.0) {
DOMAIN_ERROR(result);
}
else if(x == 0.0) {
result->val = 1.0; <=================== should be 0.0
result->err = 0.0;
return GSL_SUCCESS;
}
else {
return lnpoch_pos(a, x, result);
}
}
jt
On Fri, 29 Sep 2006, Giulio Bottazzi wrote:
] Hi,
] It seems that the exponential of the logarithm of the Pochhammer symbol
] with second argument equal to zero is NOT one. Consider the following
] little program, which should print two times the number 1 separated by
] a space
]
] /* -- START test.c */
] #include <stdio.h>
] #include <math.h>
] #include <gsl/gsl_sf_gamma.h>
] int main(){
]
] printf("exp(log(poch))=%g poch=%g\n",
] exp( gsl_sf_lnpoch(7,0)),gsl_sf_poch(7,0));
]
] return 0;
] }
] /* -- END test.c */
]
] If I compile it with
] #gcc -Wall test.c -lgsl -lgslcblas -lm -o test
] and run
] #./test
] I get:
] #exp(log(poch))=2.71828 poch=1
]
] What's going on? I can't see any mistake in my code.
]
] Best,
] Giulio.
]
]
] --
] Giulio Bottazzi PGP Key ID:BAB0A33F
] giulio.bottazzi@libero.it http://www.sssup.it/~bottazzi
]
--
James Theiler
MS-B244, ISR-2, LANL; Los Alamos, NM 87544
Space and Remote Sensing Sciences; Los Alamos National Laboratory
http://public.lanl.gov/jt
next prev parent reply other threads:[~2006-09-29 17:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-29 17:01 Giulio Bottazzi
2006-09-29 17:26 ` James Theiler [this message]
2006-10-02 19:25 ` Brian Gough
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.44.0609291108260.22186-100000@yks.lanl.gov \
--to=jt@lanl.gov \
--cc=giulio.bottazzi@libero.it \
--cc=gsl-discuss@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).