Bill Allombert on Thu, 08 Jun 2023 15:10:18 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Help evaluating a logarithmic integral
|
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: Help evaluating a logarithmic integral
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Thu, 8 Jun 2023 15:05:35 +0200
- Arc-authentication-results: i=1; smail; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1686229525; c=relaxed/relaxed; bh=qRMVwjOn3qJBU58+LfAqjYbaQGrdapbhYCioN0eBh5k=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:Mail-Followup-To: References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; b=ui3ZOTDXctOxSnQEOPwSRY+ewDf1YlDO+qILXi1b5ZTfaso719EPVLdURNO7ZvaWTDVac+4L9oQ6EWR+e8ohmbIc3Opu5ZCUpfwt/Su1V4QocbOyjRbqfv6w6dAVO8KkpS1F/2llltADccY/xt4xTPFuUAO8JxMDrGUYDA3G5fDSKhK0KsoYAih3KsPSUdNmGPfOu9qyzzVuIkGVmbphUU2+9VDBc3mc/CKKrrquYg5tL6oNSNPYjLevQ9nZAxl0rhqUAe8zG5KWjw86uCN83R2yuJ+nBdPLlF4FrDwlIDa3e6pIUFwHoyElE1s31CUIpE18vBy113wwYDWEIzkpwnreZ97tY1vu+rzLByZBJ2e4hvdLFo3RNATINtQAS4GH8yWXa/StsgR9+WVnW/syb/VMPdcjqrPa9wQHAYuFTE0N/IFjlHLU3qXz8nYoFjidmeWnpnWr3HLFHKyCXYPxyPrQdF/NYCBrq8+T8axzrtWxsnAq/rHdY6TuKpPGnpmJyvfkNt6o+xCZqGgyghQTXYx8occ1LuIxBliIX1epxGAw8i+1pNLrq++E0v1KgW8kt1csaBirh9bhD+zZWHolxf+y7TMGFX3YJtRr6ujZnn6hVa09TtrW6PR3IcWPSydvxFvA+eJmxSpmHs8ywkZF6ot30jYIml1QWUuR9zB8ucE=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1686229525; cv=none; b=hj/9yB1sGhkfdKABXfAz+4fb1Vwq4R/4Sw0dlNR0F3auD3QD9isZ9dNefVCphqejIS/eTr7DNrSO2uONhnW5U2h6SEYoi9HPpF9jU05bMddN3OIjgdB4+NNyIHzvPjKuabb8OWSzDBihzJrEAoTTJzuDZzdQfrB6ZIfRNK0qT/YCjZuLrmts8RPHm8GhUp5PCD3usvphQ8m4uLjDJd1npsbGW+fJWSaL/FieeLN+9sWJVvVM6+o1ZmbW3Fzkfil50XrljugSIwJnBcfXOEk4/hU2muwbVNkQMhQbb67yeNQxiqVJH6cUqS8CrfPYsmn3g6sP0RHkZf3NUxMVvktg80J+t+MNEcawNd5hPg+dJtLXHlXOiiBIn68/KimuKyznCgdkbHkzAzQhJm+h8CEtGeNBFhQz+nqBeve/Q9zqB3XZPVgv8G7++pbdoddLb7dYNjT4ntJaQT6afTl2e5XsXsEQJkvdyg+JgZaWpNrARye1h6SxTmaEelRka+y1ZRYrId8sCkel9QPCHcyrQlhKJOwCfSpU9l//84BhxBEzSzJ8fbUzNkO3YU4YN50n2Q75mGl7czR4Nb6UeiA9qMc6nyLYCqFfsv1RwkZqIbt3oZunpNomgGH8EtUpzBS7kOkteIYxOLmyDCDPi1kSX/Fxj+3W7XfAYzZPYvFiGjytXlo=
- Authentication-results: smail; dmarc=none header.from=math.u-bordeaux.fr
- Authentication-results: smail; arc=none
- Delivery-date: Thu, 08 Jun 2023 15:10:18 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1686229525; bh=qRMVwjOn3qJBU58+LfAqjYbaQGrdapbhYCioN0eBh5k=; h=Date:From:To:Subject:References:In-Reply-To:From; b=sAP4lUGRCH9pLjlhBuNr0gN+a/8Q5eQXNspT7oZoc3sCcgSFkvdzA4XOYoVgd0le0 0CGatYs4XblQ79Wf6uyDZDfMYlCgGvouvjYcE275ZpYkKG4qaoRHxA6YLwvi3rScf1 OOUhfW75XD7Shk8+3h+MMsGTKC6ysNBG7xidajT1WRWRy9cmcUvBG3m0a3i83tqG9P 1Pvw67Jn4f8wCazv9JDksPnGEc1BsGfiu3XvRQSaxTEpwPDfy5j3Z+pcUbOClADAa2 TSjRghb62po1/i0vi3x84xSvPZFM6mK641c16mMcxatiGacoEIhDyW6PjVmEZwb+1k xs06WwDvOvAtv8cHmhf2+fl0HVYz87w+WqQwub3sUtseJumAPYcFuZLRQOoXHUjzo2 IYF17tSyay3EFj9lVUhBhFkaspXAie9Ez9MxRBInVj2FP3ShWUPNOjgTt9562uFISM n5sKCoqjH0DD8FfRQjzaI1xLf9W3aN61eM4t97tYCf/t26fvnoUGz4gleUBVGuaxA9 X1U+U+0J53dcrDeu8sLH6lTccw1gvqE7SX447lTsRwcRIM8yg4U2428lfbMgiC2e7M YET6IqyfHrb5zPdVPufpwnCtXBFWSuz9pJhRGNE0gjNUYdD4xevkxubpSSXqGsexCB Vgr9NgfWcZquQMaulQi1hmV4=
- In-reply-to: <CACESMjK4cgWvLEpZAXnbbWx=9FsdDZ_8Mw9LZj=hKqM50M30nQ@mail.gmail.com>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <CACESMjKyBa-Fu6=k05dcqHjgXPtkiuwXKk3+beU8wbvxgPtq8Q@mail.gmail.com> <84B4E670-309B-4B5A-9F42-384C17339BE4@math.unipd.it> <CAMLkfFScktwb85DUu8f11hK8SOpvYPx4WLOtdtGz9GnHDAOVfw@mail.gmail.com> <CACESMjK4cgWvLEpZAXnbbWx=9FsdDZ_8Mw9LZj=hKqM50M30nQ@mail.gmail.com>
On Thu, Jun 08, 2023 at 12:42:28PM +0200, kevin lucas wrote:
> Thank you both for responding.
> Even after splitting the domain as suggested in the first reply I still get
> a domain error in log with intnum when f is given a floating-point
> argument.
> As for taking the double of the integral over (0,1/2), the integrand is not
> symmetric about 1/2, there's a division by x. Is there something I am
> missing?
I assume you have got this:
? f(v) = intnum(x=0,1/2, log(abs(x^v - (1 - x)^v))/x)+intnum(x=1/2,1, log(abs(x^v - (1 - x)^v))/x);
? f(2)
%2 = -2.4674011002723396547086227499690377838
? f(2.)
*** at top-level: f(2.)
*** ^-----
*** in function f: intnum(x=0,1/2,log(abs(x^v-(1-x)^v))/x)+intnum
*** ^-------------------------------
*** log: domain error in log: argument = 0
The issue is that the expression x^v - (1 - x)^v induces cancellation when x is close to .5.
(so the result get too close to 0 for the log)
You should replace it by a formula that avoid cancellation.
if we set x=1/2+h then we have
(1/2+h)^v - (1/2 - h)^v
the term 1/2^v cancels out, reducing the precision.
when h is close to zero,
exp(v*log((1/2+h)))-exp(v*log((1/2-h)))
is close to 4*v*h
so you can do
t(x,v)=if(abs(x-1/2)>2^-precision(x),x^v - (1 - x)^v,4*v*(x-1/2))
f(v) = intnum(x=0,1/2, log(abs(t(x,v)))/x)+intnum(x=1/2,1, log(abs(t(x,v)))/x)
which gives something:
? f(2)
%35 = -2.4674011002723395953311558693610942877
? f(2.)
%36 = -2.4674011002723395953311558693610942876
I hope this gives the idea.
Cheers,
Bill.