Archive for the 'Python' Category

Nuovo costruttore monomio

Monday, October 31st, 2005

Ho ottimizzato il costruttore del monomio. Ora non vengono automaticamente incluse le incognite di grado minore o uguale a 0 e il valore dell’attributo “degree” indica il grado complessivo del monomio.
def __init__(self, coefficient, **kwargs):
    self.letteralPart = dict()
    for unknown in kwargs:
        # Doesn’t include in the dictionary the unknowns with
        # degree < = 0
        if kwargs[unknown] > 0:
            self.letteralPart[unknown] = […]

Piccoli monomi crescono

Sunday, October 30th, 2005

La classe sta venendo su bene: ho fatto qualche modifica al costruttore, ho aggiunto il supporto all’addizione e alla sottrazione di monomi e ho scritto anche qualche test. Prima o poi la metterò on-line…

Monomi con Python

Sunday, October 30th, 2005

Sto scrivendo una classe per gestire i monomi con Python. Questo è il costruttore:
class Monomial:
    ”"”A class which provides some methods to manage monomials”"”
    def __init__(self, coefficient, *args, **kwargs):
        ”"”Build a list which has for first element the
        coefficient of the monomial and for second a dictionary
        that has for keys the unknown quantities and for values
        the grade of the […]

Frazioni con Python

Sunday, October 30th, 2005

Segnalo questa libreria che estende i tipi di variabili presenti nella distrubuzione standard di Python.