On 11/3/09 at 2:51 AM, lawrence
...@yahoo.com (Lawrence Teo) wrote:
>Thanks for the insight. So Simplify[] in Mathematica is right. But
>why I observe small delta if I subtract the two expressions with //
>N? Is it because of machine precision related limitation?
>a = Cos[x]^2 - Sin[x]^2
>b = Cos[x]^4 - Sin[x]^4
>Table[a - b, {x, -10, 10}] // N
>Return small delta...
The issue is the limitations of machine precision numbers. This
is easily demonstrated by
In[36]:= a = Cos[x]^2 - Sin[x]^2;
b = Cos[x]^4 - Sin[x]^4;
Union[Table[a - b, {x, -10, 10}] // Simplify]
Out[38]= {0}
or
In[39]:= Union[Table[a - b, {x, -10, 10}] // N // Chop]
Out[39]= {0}
or most directly by
In[41]:= a - b // Simplify
Out[41]= 0