[sage-devel] Re: imaginary unit I is smaller than 1

2017-02-20 Thread Simon King
Hi,

On 2017-02-20, Daniel Krenn  wrote:
> On 2017-02-19 17:57, rjf wrote:
>> It might be comparing the real parts.  What did you expect?  Perhaps
>> Error "<" requires that both operands be members of the same ordered
>> field  ??
>> Or perhaps just
>> False
>
> I, for sure, did not expect "True".

It is clear that there is no mathematical meaning associated with the
comparison "I<1" --- so, I wouldn't have any expectation of mathematical
meaning here. "bool(I<1)" is a different story: It *has* to return
True/False for political reasons (Python decided against using "Unknown"
or "Alternative" as truth values). Or it could raise an error.
Indeed it would be a good idea to have a switch as in Maxima.

I believe it would be good to have an "Ordered" axiom for fields, so that
one can easily check "CC in Fields.Ordered()" respectively
"QQ in Fields.Ordered()".

Also, for an *ordered* field K, it might be a good idea to have a method
K.cmp (implemented via Fields.Ordered.ParentMethods) so that K.cmp(x,y)
returns -1,0,+1, according to how the elements x,y of K compare (and
raises an error if x,y do not coerce into K): Explicit is better than
implicit.

Best regards,
Simon


-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: imaginary unit I is smaller than 1

2017-02-19 Thread Daniel Krenn
On 2017-02-19 17:57, rjf wrote:
> It might be comparing the real parts.  What did you expect?  Perhaps
> Error "<" requires that both operands be members of the same ordered
> field  ??
> Or perhaps just
> False

I, for sure, did not expect "True".


-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: imaginary unit I is smaller than 1

2017-02-19 Thread Ralf Stephan
Certainly the design of bool(rel) (where rel compares symbolics) can
be improved, including the interface to Maxima with all its switches,
but this specific case is better solved by moving I out of SR:

https://trac.sagemath.org/ticket/18036

Regards,

On Sunday, February 19, 2017 at 12:56:49 PM UTC+1, Daniel Krenn wrote:
>
> Dear all, 
>
> I am surprised by 
>   sage: bool(I < 1) 
>   True 
>
> Best Daniel 
>

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: imaginary unit I is smaller than 1

2017-02-19 Thread rjf
There are a whole bunch of issues raised in the context of   bool(x>0) and 
some mention of what
Maxima does, in that thread from 4 years ago.

But the description of what Maxima* actually does* was essentially missing 
from the discussion.

As is often the case when several different conflicting opinions emerged in 
the design community
for Macsyma/ Maxima , a flag is available to choose a design

Thus
is (a>0)returns unknown.

prederror:true;
is(a>0)   produces an error  "unable to evaluate predicate a>0"


There are  probably other options that have to do with domain:real or 
domain:complex,
and assumptions on individual names.  It is also possible for the system to
return an unevaluated conditional as

if (a>=0 then 1 else 2
  returns unevaluated.   (though  is (a>0)   returns unknown  )

[note difference between is()   and if. ]

I suppose (but have not observed this) that the unevaluated 'if' could be 
simplified. e.g.

if (a^2=a) then 1 else 2 might be simplified to

if  (a=1)or(a=0) then 1 else 2

Now if you wanted to have a program that evaluated a boolean expression 
where
each value was a canonical True or False, and objected somehow otherwise,
that might be a different functionality, and certainly WAY simpler than 
what 
people seem to expect in a computer algebra system.

You could also have a 3 way branching if:   yes/no/unknown.  if a then be 
else c otherwise d.

Perhaps related,

Note also that for IEEE standard floats with  NaNs  (Not a numbers), of 
which there
are a huge number ..all comparisons return false.  That
is for N a NaN and X a float,  all these are false:
N>x
N
> In my opinion not this only particular case but the current bool() design 
> in sage is a tremendous failure.
> This was already discussed on sage-devel several times. 
>
> Here is one of that threads:
> https://groups.google.com/d/msg/sage-devel/vNxnHSeRBW4/UkaBOPGYT0QJ
>
> Jakob
>
> Am Sonntag, 19. Februar 2017 12:56:49 UTC+1 schrieb Daniel Krenn:
>>
>> Dear all, 
>>
>> I am surprised by 
>>   sage: bool(I < 1) 
>>   True 
>>
>> Best Daniel 
>>
>

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: imaginary unit I is smaller than 1

2017-02-19 Thread Jakob Kroeker
In my opinion not this only particular case but the current bool() design 
in sage is a tremendous failure.
This was already discussed on sage-devel several times. 

Here is one of that threads:
https://groups.google.com/d/msg/sage-devel/vNxnHSeRBW4/UkaBOPGYT0QJ

Jakob

Am Sonntag, 19. Februar 2017 12:56:49 UTC+1 schrieb Daniel Krenn:
>
> Dear all, 
>
> I am surprised by 
>   sage: bool(I < 1) 
>   True 
>
> Best Daniel 
>

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: imaginary unit I is smaller than 1

2017-02-19 Thread rjf
It might be comparing the real parts.  What did you expect?  Perhaps
Error "<" requires that both operands be members of the same ordered field 
 ??
Or perhaps just
False


On Sunday, February 19, 2017 at 3:56:49 AM UTC-8, Daniel Krenn wrote:
>
> Dear all, 
>
> I am surprised by 
>   sage: bool(I < 1) 
>   True 
>
> Best Daniel 
>

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.