On Wed, Apr 29, 2009 at 10:41 AM, William Stein <wst...@gmail.com> wrote:
>
> On Wed, Apr 29, 2009 at 10:18 AM, John H Palmieri
> <jhpalmier...@gmail.com> wrote:
>>
>> On Apr 29, 9:51 am, mark mcclure <mcmcc...@unca.edu> wrote:
>>>
>>> On the other hand, I'll happily go on record as saying that I find
>>> Wolfram's explanation of "Why You Do Not Usually Need to Know
>>> about Internals" personally offensive.  You can read that 
>>> here:http://reference.wolfram.com/mathematica/tutorial/WhyYouDoNotUsuallyN...
>>>
>>> The funny thing about that statement is that no one who believes
>>> it could possibly be inquisitive enough to be employed in a
>>> technical position at Wolfram in the first place.  I honestly
>>> assume that virtually nobody there believes it.
>>
>> One interesting thing from this page, though:
>>
>> In[7]:= N[Sin[10^50], 20]
>> Out[7]= -0.78967...   (I can't copy and paste from that page, but this
>> is how the number starts)
>> In[8] := Sin[10.^50]
>> Out[8] := 0.669369
>>
>> Sage doesn't get the right answer here (assuming that -0.78967... is
>> the right answer):
>>
>> sage: sin(10^50).n
>> (10)
>> 0.74
>> sage: sin(10^50).n
>> (20)
>> 0.82842
>> sage: sin(10^50).n
>> (40)
>> -0.052373001636
>> sage: sin(10^50).n
>> (80)
>> 0.90620599081868764998830
>> sage: sin
>> (10.^50)
>> -0.480500143493759
>>
>
> The Sage implementation of numerical_approx currently (and correctly)
> simply does all the arithmetic in the expression tree using the given
> bits of precision for the leaf nodes, and by that definition the above
> output by Sage is correct.    I thought that I had clearly documented
> this in the numerical_approx docstring, but I haven't.
>
> I would not be opposed to somebody rewriting numerical_approx to
> instead use interval arithmetic, and hence given a proven number of
> correct digits of precision of output, which would fix the above
> problem.  This should be easy given how good Cwitty's RIF and CIF is
> now.

I myself prefer if .n(20) returns the 20 correct digits.

sage: sin(10^50).n(10)
0.74
sage: from sympy import sin
sage: sin(10^50).n(10)
-0.7896724934
sage: sin(10^50).n(20)
-0.78967249342931008271


O.

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to