[SciPy-dev] Zeta Functions !

josef.pktd@gmai... josef.pktd@gmai...
Sun Jan 3 21:07:56 CST 2010


On Sun, Jan 3, 2010 at 9:38 PM, Warren Weckesser
<warren.weckesser@enthought.com> wrote:
> I don't know the reason for the names of the functions, but it appears
> that the function that you should use to compute the zeta function for
> an arbitrary argument is zetac(x) + 1:
>
> In [1]: from scipy.special import zeta, zetac
>
> In [2]: zetac(0) + 1
> Out[2]: -0.5
>
> In [3]: zetac(-1) + 1
> Out[3]: -0.083333333333333259
>
> In [4]: zetac(0.5) + 1
> Out[4]: -1.4603545088095866
>
> In [5]: zetac(1) + 1
> Out[5]: 1.7014118346046923e+38
>
> In [6]: zetac(2) + 1
> Out[6]: 1.6449340668482264
>
> In [7]: zetac(-2) + 1
> Out[7]: 0.0
>
>
> zeta() and zetac() are wrappers for functions from the cephes library;
> you can find the source code at the end of this list:
>
>    http://projects.scipy.org/scipy/browser/trunk/scipy/special/cephes
>
> In the C file zeta.c, you can see that zeta(x,q) returns NaN if x < 1.0.
>
> Of course, a SciPy user should not have to dig into the C code to find
> this out.  Clearly the docstrings for zeta() and zetac() should be improved.

c at end of name usually stands for complement, only in this case the
docstring for zetac gets it wrong.

y=zetac(x) returns 1.0 - the Riemann zeta function: sum(k**(-x), k=2..inf)

In the c source you linked to, it says

25	 * is related to the Riemann zeta function by
26	 *
27	 *      Riemann zeta(x) = zetac(x) + 1.

for scipy.special (and lapack) the docs is usually better (or only
exist) in the c or fortran files.

Josef

>
>
> Warren
>
> P.S. Be careful: don't forget the 1/2 is zero, unless you are using
> Python 3.
>
>
> Arkapravo Bhaumik wrote:
>> Dear Friends
>>
>> I found some serious discrepancies with the zeta function modules. I
>> have discussed them in my blogspot
>> : http://3chevrons.blogspot.com/2010/01/zeta-in-scipy.html . Please
>> feel free to comment on it, any other suggestion to improve the module
>> is welcome.
>>
>> Regards
>>
>> Arkapravo
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> SciPy-Dev mailing list
>> SciPy-Dev@scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-dev
>>
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>


More information about the SciPy-Dev mailing list