#13783: Set Partitions, either a bug or something is unclear.
---------------------------------+------------------------------------------
Reporter: startakovsky | Owner: tbd
Type: defect | Status: needs_review
Priority: major | Milestone:
sage-duplicate/invalid/wontfix
Component: combinatorics | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
---------------------------------+------------------------------------------
Changes (by tscrim):
* status: new => needs_review
* type: PLEASE CHANGE => defect
* component: PLEASE CHANGE => combinatorics
* milestone: sage-5.9 => sage-duplicate/invalid/wontfix
Old description:
> Consider the following code. The first is an example of not being able
> to verify the type Set Partition, the second is an analogous example with
> Permutations. Please advise on this discrepancy and how to get around
> it.
>
> > sage: sp = SetPartitions(5).random_element()
> > sage: sp
> {{5}, {2, 3}, {1, 4}}
> > sage: type(sp)
> <class 'sage.sets.set.Set_object_enumerated_with_category'>
> > sage: type(sp) == Set_object_enumerated_with_category
> ----------------------------------------------- NameError
> Traceback (most recent call last)
> /home/sage-admin/<ipython console> in <module>()
> NameError: name 'Set_object_enumerated_with_category' is not
> defined
> > sage:
> > sage:
> > sage: p = Permutations(5).random_element()
> > sage: p
> (1,4,3,5,2)
> > sage: type(p)
> <class 'sage.combinat.permutation.Permutation_class'>
> > sage: type(p) == Permutation_class
> True
New description:
Consider the following code. The first is an example of not being able to
verify the type Set Partition, the second is an analogous example with
Permutations. Please advise on this discrepancy and how to get around it.
{{{
sage: sp = SetPartitions(5).random_element()
sage: sp
{{5}, {2, 3}, {1, 4}}
sage: type(sp)
<class 'sage.sets.set.Set_object_enumerated_with_category'>
sage: type(sp) == Set_object_enumerated_with_category
----------------------------------------------- NameError
Traceback (most recent call last)
/home/sage-admin/<ipython console> in <module>()
NameError: name 'Set_object_enumerated_with_category' is not defined
sage: p = Permutations(5).random_element()
sage: p
(1,4,3,5,2)
sage: type(p)
<class 'sage.combinat.permutation.Permutation_class'>
sage: type(p) == Permutation_class
True
}}}
--
Comment:
This is taken care of by #14140:
{{{
sage: sp = SetPartitions(5).random_element(); sp
{{1, 4}, {2, 5}, {3}}
sage: type(sp)
sage.combinat.set_partition.SetPartitions_set_with_category.element_class
sage: sp.parent()
Set partitions of {1, 2, 3, 4, 5}
}}}
There were two problems:
1 - The underlying/central problem was that there was no specified element
class before #14140.
2 - The `Set_object_enumerated` class (which is a subclass of `Parent`) is
changed by the category framework into the `with_category` class which
doesn't exist as code. There's also the fact that permutations are not yet
in the category framework.
Hope that clarifies some things.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13783#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.