Python | método Sympy as_ferrers()

Con la ayuda del sympy.combinatorics.IntegerPartition().as_ferrers()método, podemos obtener el diagrama de Ferrer de los valores de partición usando el sympy.combinatorics.IntegerPartition().as_ferrers()método.

Sintaxis: sympy.combinatorics.IntegerPartition().as_ferrers()

Return : Devuelve el diagrama Ferrer.

Ejemplo #1:
En este ejemplo, podemos ver que al usar sympy.combinatorics.IntegerPartition().as_ferrers()el método, podemos obtener el diagrama de Ferrer.

# import sympy and IntegerPartition
from sympy.combinatorics.partitions import IntegerPartition
from sympy import *
   
# Using sympy.combinatorics.partitions.IntegerPartition().as_ferrers() method
gfg = IntegerPartition([1] + [2, 3]).as_ferrers()
   
print(gfg)

Producción :

###
##
#

Ejemplo #2:

# import sympy and IntegerPartition
from sympy.combinatorics.partitions import IntegerPartition
from sympy import *
   
# Using sympy.combinatorics.partitions.IntegerPartition().as_ferrers() method
gfg = IntegerPartition([1] + [2, 3] + [4] + [5]).as_ferrers(char ='$')
   
print(gfg)

Producción :

$$$$$
$$$$
$$$
$$
$

Publicación traducida automáticamente

Artículo escrito por Jitender_1998 y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *