Re: [sage-devel] SQRT of negative number is negative? Or positive? Or what?

2013-05-14 Thread Marco Streng
As for the question html( In which kind of school do they teach
$\\sqrt{-2.4995} = - i 1.58$ ??? );, I think any good school that teaches
about complex numbers should teach that both - i 1.58 and i 1.58
are equally valid (approximate) square roots of -2.4995. One choice is as
good as another. Any choice one makes on the whole complex plane involves
(at least) a branch cut, cutting up the complex plane from the origin
outwards. At the branch cut, the square root function is non-continuous, so
any floating point implementation will be erratic near the branch cut (like
Sage and C are around the negative real axis). If you want to make a choice
that is different from your computer programme (such as mapping all numbers
to numbers with non-negative imaginary part), you will have to add a few
lines to the square root code that check the imaginary part of the output
and change the sign of the number if necessary.







2013/5/13 man...@gmx.net

 Could anyone shed a bit of light on this?

 The more I try, the more SAGE's types get in my way. It turns out to be
 an unpredictable element. Unless I make sure *every* involved function
 really returns one specific type, calculations are becoming practically
 impossible, because the results are completely random (malfunctions).

 Here is just the last and most annoying of my encounters I can't make
 heads or tails of, enjoy:

 http://alpha.sagenb.org/home/pub/701/

 --
 You received this message because you are subscribed to the Google Groups
 sage-devel group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to sage-devel+unsubscr...@googlegroups.com.
 To post to this group, send email to sage-devel@googlegroups.com.
 Visit this group at http://groups.google.com/group/sage-devel?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-devel] SQRT of negative number is negative? Or positive? Or what?

2013-05-13 Thread manday
Could anyone shed a bit of light on this?

The more I try, the more SAGE's types get in my way. It turns out to be
an unpredictable element. Unless I make sure *every* involved function
really returns one specific type, calculations are becoming practically
impossible, because the results are completely random (malfunctions).

Here is just the last and most annoying of my encounters I can't make
heads or tails of, enjoy:

http://alpha.sagenb.org/home/pub/701/

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.