Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Loss of precision

23 views
Skip to first unread message

sam....@yahoo.com

unread,
May 25, 2012, 4:57:44 AM5/25/12
to
Hi,

I understand intuitively why Sin[Large Number] cannot be computed too accurately. For example

Precision[Sin[SetPrecision[10^10, 100]]] = 89.75

We can I find an explanation of precisely why and how 100 becomes 89.75.

Many thanks in advance,

Sam

da...@wolfram.com

unread,
May 26, 2012, 5:14:15 AM5/26/12
to
The most likely method used would involve first subtracting an appropriate multiple of Pi so as to bring the argument into a small range. I will illustrate with the range (-pi/4,pi/4).

In[20]:= rem = Mod[SetPrecision[10^10,100],Pi/2,-Pi/4];

In[21]:= {N[rem],Precision[rem],Precision[Sin[rem]]}

Out[21]= {-0.509231, 89.7069, 89.7469}

So we get the result you are seeing. Why is precision of the remainder around 89.7? That's a consequence of subtracting some integral multiple of pi/2 from a a number with magnitude 10^10 (that is, roughly digit number ten times the magnitude of our divisor). Consider multiplying both divisor and dividend by 10^90, so that the dividend, which was known to 100 places (90 to the right of the decimal) is now an integer. Once we subtract, we have at most 90 known digits. Slightly less, actually, because the result must be 10^90 times the result we get by not multiplying, and we know that has to be strictly less than pi/4, hence less than 1.

Daniel Lichtblau
Wolfram Research


Richard Fateman

unread,
May 29, 2012, 5:50:46 AM5/29/12
to
On 5/26/2012 2:14 AM, da...@wolfram.com wrote:
> On Friday, May 25, 2012 3:57:44 AM UTC-5, sam....@yahoo.com wrote:
>> Hi,
>>
>> I understand intuitively why Sin[Large Number] cannot be computed too accurately. For example
>>
>> Precision[Sin[SetPrecision[10^10, 100]]] = 89.75
>>
>> We can I find an explanation of precisely why and how 100 becomes 89.75.

Sin[Large Number] can be computed accurately to any desired number of
digits. Just as one can compute pi to any specified number of digits,
one can compute 10^10 or 10^100 modulo pi/2 to any specified number of
digits.

Daniel does describe what Mathematica does, which is hardly
mathematically or computationally inevitable.
RJF


da...@wolfram.com

unread,
May 31, 2012, 2:48:21 AM5/31/12
to
On Tuesday, May 29, 2012 4:50:46 AM UTC-5, Richard Fateman wrote:
The operand in question was not 10^10, but rather a finite precision approximation thereto. Once you pin the precision of the operand to a finite value, you are subject to precision loss. If your convention is that, for example, .001 "really" means .001000000... then of course it is a different matter, because you have not pinned the precision to something finite. As you observe, tacitly, that's not what Mathematica does.

Daniel Lichtblau
Wolfram Research


0 new messages