It is my recollection that the definition of sqrt of a negative number, say -9, in the unix math library is the sqrt of abs value. Hence it returns 3. So that's another choice.
Contrary to Tom's note, I am not requiring that the range and domain of a function be the same, though it may have appeared that way by the examples. It is that when there is agreement on the extension of a function (as factorial extended to gamma), it makes sense to use it in a CAS. In calculus texts you see the answers to some integrals include log(abs( ...)) . Why? It is because the audience doesn't know about log extended to negative numbers. So some people used to post bug reports about Macsyma leaving out the abs(). Sometimes there is not unanimity in such extensions. Consider fractional derivatives. That is, if diff(E(x),x,2) is the notation for the second derivative of E(x), what is diff(E(x),x, 1/2) ?? Can this be defined so as to coincide perfectly with the definition of diff on integer-valued orders? Yes. But, as I recall, in two ways. :( RJF On Jun 17, 3:07 am, David Kirkby <david.kir...@onetel.net> wrote: > On 16 June 2010 15:48, rjf <fate...@gmail.com> wrote: > > > > > On Jun 15, 9:28 pm, Tom Coates <t.coa...@imperial.ac.uk> wrote: > > > By your reasoning, and for other domains we would have the following > > behavior: > > sqrt(-1) --> error. after all, some Sage users may not have > > encountered imaginary numbers. > > RJF > > That's a very weak argument. > > The failure to understand sqrt(-1)=j (as electrical engineers use), or > 'i' as mathematicians use, is purely the result of a lack of > mathematical knowledge. It would be dumb for Sage class sqrt(-1) as an > error. That appears to be a different situation than factorial. > > BTW, the #6 hit for factorial in Google, and the number 1 hit for > factorial calculator is this > > http://www.cs.uml.edu/~ytran/factorial.html > > One might have hoped a professor of computer science could have done a > bit better. > > Dave -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org