Con la ayuda del sympy.combinatorics.IntegerPartition().as_dict()
método, podemos obtener el diccionario de elementos enteros de los subarreglos junto con sus valores de coeficiente utilizando el sympy.combinatorics.IntegerPartition().as_dict()
método.
Sintaxis:
sympy.combinatorics.IntegerPartition().as_dict()
Retorno: Retorna el diccionario que tiene elementos junto con sus valores de coeficiente.
Ejemplo #1:
En este ejemplo, podemos ver que al usar el sympy.combinatorics.IntegerPartition().as_dict()
método, podemos obtener el diccionario de valores enteros con sus valores de coeficiente.
# import sympy and IntegerPartition from sympy.combinatorics.partitions import IntegerPartition from sympy import * # Using sympy.combinatorics.partitions.IntegerPartition().as_dict() method gfg = IntegerPartition([1] + 3 * [2, 3]).as_dict() print(gfg)
Producción :
{3: 3, 2: 3, 1: 1}
Ejemplo #2:
# import sympy and IntegerPartition from sympy.combinatorics.partitions import IntegerPartition from sympy import * # Using sympy.combinatorics.partitions.IntegerPartition().as_dict() method gfg = IntegerPartition([1] + 2 * [2, 3] + 4 * [4] + 5 * [5]).as_dict() print(gfg)
Producción :
{5: 5, 4: 4, 3: 2, 2: 2, 1: 1}
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