Re: Loss of precision
- To: mathgroup at smc.vnet.net
- Subject: [mg126624] Re: Loss of precision
- From: danl at wolfram.com
- Date: Sat, 26 May 2012 05:13:01 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jpnhi8$qa4$1@smc.vnet.net>
On Friday, May 25, 2012 3:57:44 AM UTC-5, sam.... at 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. > > Many thanks in advance, > > Sam 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