Re: [sage-combinat-devel] tensor products and rings, was: several alphabets for symmetric functions
On Thu, Aug 02, 2012 at 10:36:20AM +0200, Martin Rubey wrote: > So in the particular case of determinant, would you vote for "is_field" > or for "in Fields()"? > > In other words, what would be a case where I am satisfied with "known to > be a Field"? Is the risk of dividing by zero good enough reason to use > "is_field"? In any cases, the only risk is to use a potentially slower division-free algorithm. I guess I would vote for "in Fields()". Deciding whether it's worth precalculating K.is_field() on the base ring K depends too much on the use case; so this decision is best left ultimately to the user. > Finally, should I open a ticket and push a patch for > > > > Ok, one should add a method Rings.ParentMethods.is_field that raises > > > a NotImplementedError. > ??? Yes, please! Cheers, Nicolas -- Nicolas M. Thiéry "Isil" http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.
Re: [sage-combinat-devel] tensor products and rings, was: several alphabets for symmetric functions
Hi Nicolas! thanks for the detailed explanation! One thing I don't quite understand: > A consequence of the above is that a piece of code that takes a > decision upon the properties of a parent should use the `R in Fields` > or `R in Fields()` idiom, unless there is a very good reason not to. So in the particular case of determinant, would you vote for "is_field" or for "in Fields()"? In other words, what would be a case where I am satisfied with "known to be a Field"? Is the risk of dividing by zero good enough reason to use "is_field"? Finally, should I open a ticket and push a patch for > > Ok, one should add a method Rings.ParentMethods.is_field that raises > > a NotImplementedError. > > Great, that works. ??? Martin -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.
Re: [sage-combinat-devel] tensor products and rings, was: several alphabets for symmetric functions
On Sun, Jul 29, 2012 at 08:58:18AM +0200, Martin Rubey wrote: > why does the is_field method exist at all? In other words, why > wouldn't one rather test > > if R in Fields: > > ??? The intention is that: sage: R in Fields() or equivalently sage: R in Fields returns whether R is known by Sage to be a field. In other words, R.category() returns a subcategory of Fields(). On the other hand: sage: R.is_field() will *compute* whether R is a field (or raise a NotImplementedError). Of course the is_... methods are cached; but still this might be expensive to decide (e.g. testing whether n is prime for IntegerModRing(n)). If not plain undecidable. If the answer is yes, ``R.is_field()`` updates the category of R to a subcategory of Fields(). The above should apply to any category, except that updating the category on the fly is not yet super robust, so not all is_... method do it. Now, to finish explaining the strange results you mentioned in your follow up e-mail, I should say that, for backward compatibility reasons (not all parents in Sage use categories yet), there is a special case for `R in Fields()` and a few others that currently call their is_...() counterparts. A consequence of the above is that a piece of code that takes a decision upon the properties of a parent should use the `R in Fields` or `R in Fields()` idiom, unless there is a very good reason not to. There are lots of places in Sage that should be updated w.r.t. the above. Cheers, Nicolas -- Nicolas M. Thiéry "Isil" http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.
Re: [sage-combinat-devel] tensor products and rings, was: several alphabets for symmetric functions
Martin Rubey writes: > (I see that Integers(13) is not in Fields...) Oh, the truth is not so simple: -- | Sage Version 5.1, Release Date: 2012-07-09 | | Type "notebook()" for the browser-based notebook interface.| | Type "help()" for help.| -- Loading Sage library. Current Mercurial branch is: combinat sage: ZZ in Rings True sage: ZZ in Fields False sage: Integers(13) in Fields False sage: Integers(13) in Fields() True sage: Integers(13) in Fields True Is this to be expected? Martin -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.
Re: [sage-combinat-devel] tensor products and rings, was: several alphabets for symmetric functions
"Nicolas M. Thiery" writes: > On Fri, Jul 20, 2012 at 03:40:44PM +0200, Martin Rubey wrote: >> AttributeError: 'CombinatorialFreeModule_Tensor_with_category' >> object has no attribute 'is_field' > > Ok, one should add a method Rings.ParentMethods.is_field that raises a > NotImplementedError. Great, that works. Sorry for raising the next question: why does the is_field method exist at all? In other words, why wouldn't one rather test if R in Fields: ??? (I see that Integers(13) is not in Fields...) Thanks for your patience, Martin -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.
Re: [sage-combinat-devel] tensor products and rings, was: several alphabets for symmetric functions
On Fri, Jul 20, 2012 at 03:40:44PM +0200, Martin Rubey wrote: > Well, in the code for determinants, you find > > if algorithm is None: > try: > R_is_field_attempt = R.is_field() > except NotImplementedError: > R_is_field_attempt = False > > Now, if R is a tensor product of some symmetric function space, the > method is_field doesn't exist, so we get an > > AttributeError: 'CombinatorialFreeModule_Tensor_with_category' > object has no attribute 'is_field' Ok, one should add a method Rings.ParentMethods.is_field that raises a NotImplementedError. I'll try to look more at your other e-mails around August 1st. In the mean time, you might want to dig in the MuPAD-Combinat code / mailing list for the plethysm implementation. Good luck in any cases! Cheers, Nicolas -- Nicolas M. Thiéry "Isil" http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.
Re: [sage-combinat-devel] tensor products and rings, was: several alphabets for symmetric functions
"Nicolas M. Thiery" writes: > On Wed, Jul 18, 2012 at 01:43:50PM +0200, Martin Rubey wrote: >> I am hitting a bug when creating a matrix of tensor products of >> symmetric funcions and then trying to compute the determinant. (The >> workaround is to say algorithm=df) >> >> Is it the responsibility of CombinatorialFreeModule_Tensor_with_category >> to implement the methods of ring? I would have thought that the default >> methods should apply? > > Can you give an explicit example? Well, in the code for determinants, you find if algorithm is None: try: R_is_field_attempt = R.is_field() except NotImplementedError: R_is_field_attempt = False Now, if R is a tensor product of some symmetric function space, the method is_field doesn't exist, so we get an AttributeError: 'CombinatorialFreeModule_Tensor_with_category' object has no attribute 'is_field' Here is a different example: sage: Sym = SymmetricFunctions(FractionField(QQ['t'])); JP = Sym.jack().P() sage: M = matrix([[JP[i+k] for i in range(1,5)] for k in range(1,5)]) sage: M.det() --- AttributeErrorTraceback (most recent call last) It appears to me, that if I have sage: X in Rings True then X should actually inherit the methods from Ring. No? Martin -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.
Re: [sage-combinat-devel] tensor products and rings, was: several alphabets for symmetric functions
On Wed, Jul 18, 2012 at 01:43:50PM +0200, Martin Rubey wrote: > I am hitting a bug when creating a matrix of tensor products of > symmetric funcions and then trying to compute the determinant. (The > workaround is to say algorithm=df) > > Is it the responsibility of CombinatorialFreeModule_Tensor_with_category > to implement the methods of ring? I would have thought that the default > methods should apply? Can you give an explicit example? Cheers, Nicolas -- Nicolas M. Thiéry "Isil" http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.
[sage-combinat-devel] tensor products and rings, was: several alphabets for symmetric functions
I am hitting a bug when creating a matrix of tensor products of symmetric funcions and then trying to compute the determinant. (The workaround is to say algorithm=df) Is it the responsibility of CombinatorialFreeModule_Tensor_with_category to implement the methods of ring? I would have thought that the default methods should apply? Help appreciated, Martin -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.