Triangular Fuzzy Numbers

class pyfdm.TFN.tfn.TFN(a, b, c)[source]

Bases: object

__add__(other) TFN[source]

Overloads the ‘+’ operator for addition of Triangular Fuzzy Numbers. Also handling an addition with number.

Returns a new Triangular Fuzzy Number representing the sum.

__eq__(other: TFN) bool[source]

Checks if two Triangular Fuzzy Numbers are equal. Returns True if they are equal, False otherwise.

__mul__(other) TFN[source]

Overloads the ‘*’ operator for multiplication of Triangular Fuzzy Numbers. Also handling a multiplication by number.

Returns a new triangular fuzzy number representing the product.

__repr__() str[source]

Returns a string representation of the Triangular Fuzzy Number.

__sub__(other) TFN[source]

Overloads the ‘-’ operator for subtraction of Triangular Fuzzy Numbers. Also handling a subtraction with number.

Returns a new Triangular Fuzzy Number representing the difference.

__truediv__(other: TFN) TFN[source]

Overloads the ‘/’ operator for division of Triangular Fuzzy Numbers. Also handling a division by number.

Returns a new Triangular Fuzzy Number representing the quotient.

Raises a ValueError if the denominator contains zero.

centroid() float[source]

Calculates the centroid of the Triangular Fuzzy Number.

Returns: - float: The centroid of the Triangular Fuzzy Number.

core() list[source]

Calculates the core of the Triangular Fuzzy Number.

Returns: - list: A list containing the core values of the Triangular Fuzzy Number.

is_included_in(other: TFN) bool[source]

Checks if the current Triangular Fuzzy Number is included in the other.

Returns: - bool: True if the current Triangular Fuzzy Number is included in the other, False otherwise.

membership_function(x: float | ndarray) float | ndarray[source]

Calculates the membership function value at a given point x. Also handles calculation for an array of values.

Parameters: - x (float): The point at which to calculate the membership function.

Returns: - float: The membership function value at the given point x.

s_norm(other)[source]

S-norm operator for fuzzy OR operation.

Parameters: - other (TFN): Another Triangular Fuzzy Number.

Returns: - TFN: Result of the fuzzy OR operation.

t_norm(other)[source]

T-norm operator for fuzzy AND operation.

Parameters: - other (TFN): Another Triangular Fuzzy Number.

Returns: - TFN: Result of the fuzzy AND operation.