1
$\begingroup$

I have the following summations:

The code:

Nmax = 60

ρ = SetPrecision[10/10, 30]

Mmax = 60

c = SetPrecision[1/10000, 30]

G[i_, j_, k_, n_, m_] = 
  E^(-(1/8) 
    ((c π)/ρ)^2 ((n + 1/2)^2 + (m + 1/2)^2 + 
     8 ρ^2 (i^2 + j^2 + k^2)))/(((n + 1/2)^2 + 
     4 ρ^2 (i^2 + j^2 + k^2)) ((m + 1/2)^2 + 
     4 ρ^2 (i^2 + j^2 + k^2))) 
    (2 + Cos[π (n - m)] + Cos[π (n + m + 1)])

H[n_, m_] = 
  (G[0, 0, 0, n, m] + 
   Sum[6*G[i, 0, 0, n, m], {i, 1, +Nmax}] +
   Sum[12*G[i, i, 0, n, m], {i, 1, +Nmax}] + 
   Sum[24*G[i, j, 0, n, m], {i, 1, +Nmax}, {j, 1, i - 1}] +
   Sum[8*G[i, i, i, n, m], {i, 1, +Nmax}] +
   Sum[24*G[i, i, j, n, m], {j, 1, +Nmax}, {i, 1, j - 1}] + 
   Sum[24*G[i, i, j, n, m], {i, 1, +Nmax}, {j, 1, i - 1}] +
   Sum[48*G[i, j, k, n, m], {i, 1, +Nmax}, {j, 1, i - 1}, {k, 1, j - 1}])


Subscript[J, 5] = 
  (Sqrt[2] c^3 ρ^2)/((8 - 5 Sqrt[2]) / (24 π^(5/2))) 
    (H[0, 0] + 2*Sum[H[n, 0] + H[-n, 0], {n, 1, Mmax}] +
     Sum[H[n, n] + 2*H[n, -n] + H[-n, -n], {n, 1, Mmax}] + 
     2*Sum[H[n, m], {n, 1, Mmax}, {m, 1, n - 1}])  

enter image description here

The formulae are correct, but I don't understand what I'm doing wrong.

What I get is the following error mex:

2.607130362672965*10^-304 0.000071315866888934451803845708122 is too small to represent as a normalized machine number; precision may be lost.

enter image description here

Could you help me?

Moreover, I used SetPrecision in that way because of a suggestion on this forum, it worked in a previous cas. Can you suggest something better?

$\endgroup$

closed as off-topic by Michael E2, garej, Edmund, MarcoB, rhermans Jul 5 at 16:09

This question appears to be off-topic. The users who voted to close gave these specific reasons:

  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – MarcoB, rhermans
  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Michael E2, garej, Edmund
If this question can be reworded to fit the rules in the help center, please edit the question.

2
$\begingroup$

I don't see that you are doing anything wrong. That warning just indicates that Exp[-x] is too small to be represented as a machine sized number. It will be approximated to zero which generally is OK. You can get around the problem by using exact numbers. The only inexact number that I see is c. I get no warnings with:

Nmax = 60
ρ = 1
Mmax = 60
c = 1/10

The rest the same as you have. Output the numerical answer

Subscript[J, 5] // N[#, 30] &
(*119.934233306915048382716902712*)

for the c that matches your screenshot,

for c = 1/10000 which matches your code:

Subscript[J, 5] // N[#, 30] &
(*3.57168015500528945976180486670*10^-7*)

No warnings in this case, but you can see for c = .1, both results are pretty much the same.

$\endgroup$

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