Skip to content

Triangle

Triangle

Bases: Term

Basic Term that represents the triangle membership function.

Equation

\(\mu(x)= \begin{cases} 0 & \mbox{if } x < a \vee x > c \cr h & \mbox{if } (x = b) \vee (a=-\infty \wedge x < b) \vee (c=\infty \wedge x > b) \cr h \dfrac{x - a}{b - a} & \mbox{if } a \le x < b \cr h \dfrac{c - x}{c - b} & \mbox{if } b < x \le c \end{cases}\)

where

  • \(h\): height of the Term
  • \(a\): left vertex of the Triangle
  • \(b\): top vertex of the Triangle
  • \(c\): right vertex of the Triangle

Attributes

left instance-attribute

left = left

right instance-attribute

right = right

top instance-attribute

top = top

Functions

__init__

__init__(name: str = '', left: float = nan, top: float = nan, right: float = nan, height: float = 1.0) -> None

Constructor.

Parameters:

Name Type Description Default
name str

name of the Term

''
left float

first vertex of the Triangle

nan
top float

second vertex of the Triangle

nan
right float

third vertex of the Triangle

nan
height float

height of the Term

1.0

configure

configure(parameters: str) -> None

Configure the term with the parameters.

Parameters:

Name Type Description Default
parameters str

left top right [height].

required

membership

membership(x: Scalar) -> Scalar

Computes the membership function evaluated at \(x\).

Parameters:

Name Type Description Default
x Scalar

scalar

required

Returns:

Type Description
Scalar

\(\mu(x)= \begin{cases} 0 & \mbox{if } x < a \vee x > c \cr h & \mbox{if } (x = b) \vee (a=-\infty \wedge x < b) \vee (c=\infty \wedge x > b) \cr h \dfrac{x - a}{b - a} & \mbox{if } a \le x < b \cr h \dfrac{c - x}{c - b} & \mbox{if } b < x \le c \end{cases}\)

parameters

parameters() -> str

Return the parameters of the term.

Returns:

Type Description
str

left top right [height].