Re: [sage-devel] Re: (fwd from sage-support) A mathematical mistake in root_lattice_realizations.py

2014-10-15 Thread Nicolas M. Thiery
Hi Dinakar,

On Mon, Oct 13, 2014 at 11:57:25PM -0700, Travis Scrimshaw wrote:
   I wrote that part of the code and was assuming the user would be
checking if a root is real or imaginary. However I'm definitely for
adding this feature and having a method `is_root`. We can check if an
element in the root space is a root in a finite root system by (the
perhaps somewhat dumb) checking if it is in the (finite) set of all
roots, which Sage can generate as you're probably aware. Also what's
there for is_short/long/imaginary_root follows Prop 5.10 in Kac, so we
could probably combine all 3 into a simple is_root for finite, affine,
and ([1]to be implemented #15974) hyperbolic types. Please create a
ticket on trac and cc me (tscrim) and we can fix things up.

Thanks for your feedback and interest in contributing!

Having a is_root method would indeed be of general interest, and like
Travis I am not sure how to implement it efficiently.

I would be in favor of checking, in is_real_root, that the input is
indeed a root, but *only* if doing so does not add a serious overhead
(that is checking is_root does not cost not much more than checking
is_real_root). Otherwise, I would do like for is_positive_root or
to_simple_root: namely adding in the specifications that the input
*should* be a root. Alternatively, we could add a check method, and
is_root would only be checked if check=True.

Cheers,
Nicolas
--
Nicolas M. ThiƩry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


[sage-devel] Re: (fwd from sage-support) A mathematical mistake in root_lattice_realizations.py

2014-10-14 Thread Travis Scrimshaw
Hey Dinakar,
   I wrote that part of the code and was assuming the user would be 
checking if a root is real or imaginary. However I'm definitely for adding 
this feature and having a method `is_root`. We can check if an element in 
the root space is a root in a finite root system by (the perhaps somewhat 
dumb) checking if it is in the (finite) set of all roots, which Sage can 
generate as you're probably aware. Also what's there for 
is_short/long/imaginary_root follows Prop 5.10 in Kac, so we could probably 
combine all 3 into a simple is_root for finite, affine, and (to be 
implemented #15974 http://trac.sagemath.org/ticket/15974) hyperbolic 
types. Please create a ticket on trac and cc me (tscrim) and we can fix 
things up.

Best,
Travis


On Sunday, October 12, 2014 1:49:39 PM UTC-7, vdelecroix wrote:

 Hi Dinakar, 

 It makes more sense to post it on sage-devel as it concerns Sage 
 development and not a question you have about Sage. So I did the 
 forward. 

 Vincent 

 -- Forwarded message -- 
 From: Dinakar Muthiah dmut...@gmail.com javascript: 
 Date: Sun, 12 Oct 2014 11:51:56 -0700 (PDT) 
 Subject: [sage-support] A mathematical mistake in 
 root_lattice_realizations.py 
 To: sage-s...@googlegroups.com javascript: 

 I claim there is currently a mathematical mistake in the way the 
 is_real_root method in the file root_lattice_realizations.py is 
 implemented. There is also a parallel mistake in is_imaginary_root. Let 
 me illustrate with an example: 

 sage: R = RootSystem([A,2,1]).weight_lattice() 
 sage: alpha = R.simple_roots() 
 sage: alpha[0].is_real_root() 
 True 
 sage: b = 2*alpha[0] 
 sage: b.is_real_root() 
 True 

 b.is_real_root() should return false because 2*alpha[0] is not a real 
 root. 
 In particular, 2*alpha[0] is not a root. 

 Looking at the implementation of is_real_root(), it is easy to see why 
 this isn't working properly. 

 def is_real_root(self): 
 r 
 Return ``True`` if ``self`` is a real root. 

 A root `\alpha` is real if it is `W` conjugate to a simple 
 root where `W` is the corresponding Weyl group. 

 EXAMPLES:: 

 sage: Q = RootSystem(['B',2,1]).root_lattice() 
 sage: alpha = Q.simple_roots() 
 sage: alpha[0].is_real_root() 
 True 
 sage: elt = alpha[0] + alpha[1] + 2*alpha[2] 
 sage: elt.is_real_root() 
 False 
  
 return self.norm_squared()  0 

 self.norm_squared() is not the way to check whether an element of the root 
 space or weight_space is a real root. 

 The problem is that there is no check to see whether self is a root. In 
 affine types, the following should work: 

 return (self.norm_squared()  0) and self.is_root() 

 where is_root() would be a method that checks whether self is a root. But 
 this isn't currently implemented, and I don't know what would be the most 
 intelligent way to implement this. In affine types, this is fairly 
 straight 
 forward assuming you have a test for checking whether something is a root 
 in the finite root system, but I don't know for general Cartan types. 

 What do people think about this? I have not contributed to sage in the 
 past, but I am interested in implementing the fix. 

 Also, is there a better place for me to post this bug. I looked 
 here: http://wiki.sagemath.org/support/ReportingBugs, and it suggested I 
 post on sage-support since I don't have experience developing sage or 
 using 
 trac. 

 Best, 
 Dinakar 


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