Message Boards Message Boards

0
|
3153 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

[?] Control the precision of a sum?

Posted 5 years ago

Hi community,

if I have a sum of this kind

Parameters:

c = 0.3

Nmax = 100

Sum:

Subscript[f, 123] = (Erf[Sqrt[i^2 + j^2 + k^2] (c \[Pi])/Sqrt[2]] - 
   1)^2
Subscript[J, 1] = Timing[Sum[Subscript[f, 123], {i, -Nmax, +Nmax}, {j, -Nmax, +Nmax}, {k, -Nmax, +Nmax}]]

How can I manage the number of digits of the outputs?

I tried with N[...], I tried the option "displayed precision" in the preferences of the application, workingprecision, goalprecision, ecc..., but anything helped me!

If I want, for instance, 30 decimal digits, which I know to be right, what I have to do?

Thank you so much! Regards,

Nico

Attachment

Attachments:
POSTED BY: Nic Bat
2 Replies
Posted 5 years ago

Try

c = 3/10;
Nmax = 100;
Subscript[f, 123] = (Erf[Sqrt[i^2 + j^2 + k^2] (c \[Pi])/Sqrt[2]] - 1)^2;
N[Sum[Subscript[f, 123], {i,-Nmax,Nmax}, {j,-Nmax,Nmax}, {k,-Nmax,Nmax}],32]

or

c = SetPrecision[3/10,32];
Nmax = 100;
Subscript[f, 123] = (Erf[Sqrt[i^2 + j^2 + k^2] (c \[Pi])/Sqrt[2]] - 1)^2;
Sum[Subscript[f, 123], {i,-Nmax,Nmax}, {j,-Nmax,Nmax}, {k,-Nmax,Nmax}]
POSTED BY: Bill Nelson

Hi Bill,

Thank you for your reply: your second answer was successful!

Nico

POSTED BY: Nic Bat
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract