Hello,

I am currently working with set partitions and I encountered possible bug 
when creating SetPartitions instance with specified partition sizes:

```
sage: SetPartitions(10, [4,3,2,1])                                         
                                                                  
Set partitions of {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} with sizes in [4, 3, 2, 1]
```

The above works, but changing the order of sizes gives error:
```
sage: SetPartitions(10, [1,2,3,4])                                         
                                                                            
                                                            
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-4-90164a225d10> in <module>
----> 1 SetPartitions(Integer(10), 
[Integer(1),Integer(2),Integer(3),Integer(4)])

/usr/lib/python3/dist-packages/sage/misc/classcall_metaclass.pyx in 
sage.misc.classcall_metaclass.ClasscallMetaclass.__call__ 
(build/cythonized/sage/misc/classcall_metaclass.c:1714)()
    332         """
    333         if cls.classcall is not None:
--> 334             return cls.classcall(cls, *args, **kwds)
    335         else:
    336             # Fast version of type.__call__(cls, *args, **kwds)

/usr/lib/python3/dist-packages/sage/combinat/set_partition.py in 
__classcall_private__(cls, s, part)
   2025             else:
   2026                 if part not in Partitions(len(s)):
-> 2027                     raise ValueError("part must be a partition of 
%s"%len(s))
   2028                 else:
   2029                     return SetPartitions_setparts(s, 
Partition(part))

ValueError: part must be a partition of 10
```

Other orders od partition sizes (other than descending) also gives the same 
error:
```
sage: SetPartitions(10, [4,2,3,1])
<the same error as above> 
```

Diferent sets also show this behavior:
```
sage: SetPartitions(8, [4,3,1])
<OK>                                                                       
                                                                            
     
```

```
sage: SetPartitions(8, [4,3,1])                                             
                                                                
<Error>
```

The same happens when using sage as a module within Python

I am using Sage version 9.0, using Python 3.8.10.
Operating system is Ubuntu 20.04.3 (64bit)

Best regards,
Ondra

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/045a26f8-2d4d-4fa3-97dd-88298e99ba54n%40googlegroups.com.

Reply via email to