4
$\begingroup$

I have some trouble. I've been using finite product to study a certain function (see below). However, when I wanted to compute it precisely, I decided to use NProduct with infinite limits. But for some reason it gives incorrect values.

Here is the finite product with $N=100$:

$MaxExtraPrecision=2000;
MatrixForm[Table[{j,N[Product[(1-Exp[- j (1/2+n)^2]),{n,-100,100}],20]},{j,1,20}]]
1   0.039007054895361795721
2   0.15139635144655065425
3   0.27774549346550162147
4   0.39947778367746877970
5   0.50906216159898177044
6   0.60352509325118028099
7   0.68264929923843500277
8   0.74764504964227035168
9   0.80031054484515174785
10  0.84256794946618008401
11  0.87623104899379818870
12  0.90290461543754440198
13  0.92395502352916748007
14  0.94051711512087823934
15  0.95351759265812542029
16  0.96370418485043370418
17  0.97167500055101208612
18  0.97790541672760206152
19  0.98277146142364643170
20  0.98656950593159155060

Here is the finite product with $N=10000$ (no difference):

$MaxExtraPrecision=2000;
MatrixForm[Table[{j,N[Product[(1-Exp[- j (1/2+n)^2]),{n,-10000,10000}],20]},{j,1,20}]]
1   0.039007054895361795721
2   0.15139635144655065425
3   0.27774549346550162147
4   0.39947778367746877970
5   0.50906216159898177044
6   0.60352509325118028099
7   0.68264929923843500277
8   0.74764504964227035168
9   0.80031054484515174785
10  0.84256794946618008401
11  0.87623104899379818870
12  0.90290461543754440198
13  0.92395502352916748007
14  0.94051711512087823934
15  0.95351759265812542029
16  0.96370418485043370418
17  0.97167500055101208612
18  0.97790541672760206152
19  0.98277146142364643170
20  0.98656950593159155060

And here is the values computed using NProduct:

$MaxExtraPrecision=2000;
MatrixForm[Table[{j,NProduct[(1-Exp[- j (1/2+n)^2]),{n,-Infinity,Infinity},WorkingPrecision->20]},{j,1,20}]]
1   0.395004075398529506
2   0.778193681409841966
3   1.054031296433842369
4   1.264085097890911425
5   1.426971844990617564
6   1.553737549589608497
7   1.652451874323043640
8   1.729329407189122372
9   1.789201548004194801
10  1.835830002441598713
11  1.872144277553199892
12  1.900425863260700209
13  1.922451584336175141
14  1.939605233155322500
15  1.952964508287977486
16  1.963368722222531184
17  1.971471532182001441
18  1.977782006923515382
19  1.982696609593758731
20  1.986524106001829066

The values are incorrect (they should be approaching $1$, not $2$) and I don't see any substantial change in my code except for using NProduct.

What is wrong here? Why are the values in the last case wrong?

I use Mathematica 10.3, student edition.


The finite product gives the correct values, since I've checked for an alternative expression:

$MaxExtraPrecision = 2000;
MatrixForm[Table[{j, Exp[-Sqrt[Pi/j] NSum[1/k^(3/2) EllipticTheta[3,Pi/2,E^(-(\[Pi]^2/(k j)))],{k,1,Infinity}, WorkingPrecision->10]]},{j, 1, 20}]]
1   0.0390070620
2   0.1513963515
3   0.2777454935
4   0.3994777837
5   0.5090621616
6   0.6035250933
7   0.6826492992
8   0.7476450496
9   0.8003105448
10  0.8425679495
11  0.8762310490
12  0.9029046154
13  0.92395502354
14  0.94051711513
15  0.95351759266
16  0.96370418485
17  0.97167500055
18  0.97790541673
19  0.98277146142
20  0.98656950594
$\endgroup$
  • 1
    $\begingroup$ Note NProduct works for either one sided infinite interval, you can do NProduct[ .. {0,Infinity}] or NProduct[ .. {-Infinity,0}] $\endgroup$ – george2079 Jan 9 '17 at 19:48
  • 2
    $\begingroup$ hmm... NProduct[(1 - Exp[-10 (1/2 + n)^2]), {n, 0, Infinity}] + NProduct[(1 - Exp[-10 (1/2 + n)^2]), {n, -Infinity, -1}] yields the exact same as NProduct[(1 - Exp[-10 (1/2 + n)^2]), {n, -Infinity, Infinity}] Obviously the half intervals ought to be multiplied, not added.. bug.. $\endgroup$ – george2079 Jan 9 '17 at 19:54
5
$\begingroup$

A bit of re-writing can get around this:

$MaxExtraPrecision = 2000;
expr = 1 - Exp[-j (1/2 + n)^2];
approx = Table[
          {j, NProduct[expr^2, {n, 0, Infinity}, WorkingPrecision -> 20]}, {j, 1, 20}];

Grid[approx]
1   0.0390070548953617957
2   0.1513963514465506542
3   0.277745493465501621
4   0.399477783677468780
5   0.509062161598981770
6   0.603525093251180281
7   0.682649299238435003
8   0.747645049642270352
9   0.800310544845151748
10  0.842567949466180084
11  0.876231048993798189
12  0.902904615437544402
13  0.923955023529167480
14  0.940517115120878239
15  0.953517592658125420
16  0.963704184850433704
17  0.971675000551012086
18  0.977905416727602062
19  0.982771461423646432
20  0.986569505931591551
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.