Group Abstract Group Abstract

Message Boards Message Boards

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

Modulo reduction of input for trigonometric functions

Posted 1 day ago

For reducing such input from a range (-infinity; +infinity) to the target interval (-π; +π] on which trigonometric functions shall operate, the original input must be taken modulo 2π. Performance of such a modulo reduction on limited hardware systems depends on the number of digits you provide for 2π. Said number may be in the order of some hundred to some thousand. How can I specify this number for WolframAlpha?

WolframAlpha understands my request to give me, e.g., 700 digits of 2π and returns them properly. But if and when I try to compute a given real number modulo (700 digits of 2π) it fails to decode my wish and, alas, doesn't advise me what to do instead. Any hint in this matter is appreciated. Thanks in advance.

POSTED BY: Walter Bonin
8 Replies

The number 5.319372648326541416707296656673541083813*10^255 is a floating point number, with an accuracy of something like 10^216. For such a number it makes no sense to ask mod(x,2Pi), if it is divisible by 6, its cosine, or similar things.

POSTED BY: Gianluca Gorni

This worked for me:

Mod[239,2Pi] with 700 decimal digits
POSTED BY: Gianluca Gorni
Posted 15 hours ago

Thanks! But this does not the same: it computes modulo with full (infinite) precision and then returns 700 digits of the result.

POSTED BY: Walter Bonin
Posted 1 day ago

Is there any chance that this might do what you want

mod(239,floor(2 pi,10^-700))

That tries to do mod on 239, over the first 700 digits of 2 pi.

I just randomly picked 239 and chose 700 digits because you mentioned 700 digits above.

Before you trust this I urge you to try this with much smaller numbers and see if you get exactly the result that you are expecting. Please test this multiple different ways to try to make sure this is correct. The limited testing that I have done seems like it is doing this correctly.

POSTED BY: Bill Nelson
Posted 15 hours ago

Thank you! Seems to work. What's irritating, however, is that the result of mod( r, floor(, 10^(-n))) for r being some 10^260 stays constant from n = 300 to 1100 digits of . Looks like a precision limit in WA to me. Do you have an idea?

POSTED BY: Walter Bonin
Posted 10 hours ago

Could you come up with one specific value for r and two specific values for n where the result should be different for those two values of n and why those two results should be different instead of the same? With that I can try to pound on this and see if I can reproduce your result and try to understand why there should be two when we only get one.

POSTED BY: Bill Nelson
Posted 9 hours ago

Two examples as requested:

mod((5.319372648326541416707296656673541083813×Power[10,255]), floor(2π,1e-300))

mod((5.319372648326541416707296656673541083813×Power[10,255]), floor(2π,1e-1100))

I expect different results for obvious reasons but WA returns identical ones.

POSTED BY: Walter Bonin

I got different results (on www.wolframalpha.com). Did you click the "More digits" button until it stopped giving more digits?

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