What's that "z" in the definition of zeta??
The numeric value seems rather crude, which is not surprising given that you're
using only 100 terms. You can do much better by using, say, 1000 terms or even
10000 terms.
Here's a reference value, provided by Mathematica:
Zeta[2]
Pi^2/6 (* exact value! *)
N[Zeta[2], 100]
1.644934066848226436472415166646025189218949901206798437735558229370007470403200873833628900619758705
I wonder how many terms you'd need with J, and how long it would take, to get
that high a precision!
(I seem to recall that the original definition of zeta, which you're
implementing by truncating the usual series, doesn't converge so rapidly,
though, but there are different, rapidly convergent series for obtaining high
precision.)
Then of course, there's the issue of getting values of the zeta function at
arguments other than positive integers, e.g., at complex numbers such as
(again, with Mathematica):
N[Zeta[-3/2 + I]]
0.02783755981481996 - 0.05278834217307019*I
On 9 Mar 2014 17:22:56 +0000, Jon Hough <[email protected]> wrote:
> I have created a tacit verb to calculate the Zeta function for any integer
> greater than 1.
> http://mathworld.wolfram.com/ZetaFunction.html
> My verb was built up step by step as follows:
> pwr =. ^~ NB. this is y to the power x (dyadic tacit verb)
> recip =. %@ pwr NB. take the reciprocal
> zeta =. +/"_ @: z NB. sum all
>
> I tested it
> 2 zeta >: i.100
> 1.63498
> This seems about right (should be about pi*pi/6) . . .
——
Murray Eisenberg [email protected]
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 240 246-7240 (H)
University of Massachusetts
710 North Pleasant Street
Amherst, MA 01003-9305
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm