pypdevsbbl.extra.equations module

This file contains a set of mathematical equations as functions.

These equations can be used as an input for the pypdevsbbl.generic.math.Equation block for simplicity.

Note

The described functions were written with the idea of numerical values as inputs. While it is advised to refrain from using non-numerical arguments, it is allowed within Python. There are no guarantees on what might happen if you decide to use non-numeric input.

pypdevsbbl.extra.equations.SUBTRACT(x, y)[source]

Subtracts two values.

Parameters:
  • x (numeric) – The value to subtract from.
  • y (numeric) – The value that subtracts.
Returns:

\(x - y\)

pypdevsbbl.extra.equations.DIVIDE(x, y)[source]

Divides two values.

Parameters:
  • x (numeric) – The numerator.
  • y (numeric) – The denominator.
Returns:

\(\dfrac{x}{y}\)

pypdevsbbl.extra.equations.IDIVIDE(x, y)[source]

Integer divides two values.

Parameters:
  • x (numeric) – The numerator.
  • y (numeric) – The denominator.
Returns:

\(\left\lfloor\dfrac{x}{y}\right\rfloor\)

pypdevsbbl.extra.equations.MODULO(x, y)[source]

Modulo divides two values.

Parameters:
  • x (numeric) – The numerator.
  • y (numeric) – The denominator.
Returns:

\(x \textrm{ mod } y\)

pypdevsbbl.extra.equations.NEGATE(x)[source]

Negates a value.

Parameters:x (numeric) – The value to negate.
Returns:\(- x\)
pypdevsbbl.extra.equations.INVERT(x)[source]

Inverts a value.

Parameters:x (numeric) – The value to invert.
Returns:\(\dfrac{1}{x}\)
pypdevsbbl.extra.equations.POWER(x, y)[source]

Raises x to the power of y.

Parameters:
  • x (numeric) – The base.
  • y (numeric) – The power.
Returns:

\(x^y\)

pypdevsbbl.extra.equations.AND(x, y)[source]

Boolean AND gate between x and y.

Parameters:
  • x (numeric) – The left hand side of the gate.
  • y (numeric) – The right hand side of the gate.
Returns:

\(x \textrm{ AND } y\)

pypdevsbbl.extra.equations.OR(x, y)[source]

Boolean OR gate between x and y.

Parameters:
  • x (numeric) – The left hand side of the gate.
  • y (numeric) – The right hand side of the gate.
Returns:

\(x \textrm{ OR } y\)

pypdevsbbl.extra.equations.BAND(x, y)[source]

Bitwise AND gate between x and y.

Parameters:
  • x (numeric) – The left hand side of the gate.
  • y (numeric) – The right hand side of the gate.
Returns:

\(x \textrm{ & } y\)

pypdevsbbl.extra.equations.BOR(x, y)[source]

Bitwise OR gate between x and y.

Parameters:
  • x (numeric) – The left hand side of the gate.
  • y (numeric) – The right hand side of the gate.
Returns:

\(x \textrm{ | } y\)

pypdevsbbl.extra.equations.NOT(x)[source]

Boolean NOT gate of x.

Parameters:x (numeric) – The value to invert.
Returns:\(\textrm{NOT } x\)
pypdevsbbl.extra.equations.XOR(x, y)[source]

The XOR gate between x and y.

Parameters:
  • x (numeric) – The left hand side of the gate.
  • y (numeric) – The right hand side of the gate.
Returns:

\(x \textrm{ XOR } y\)

pypdevsbbl.extra.equations.NOR(x, y)[source]

The NOR gate between x and y.

Parameters:
  • x (numeric) – The left hand side of the gate.
  • y (numeric) – The right hand side of the gate.
Returns:

\(x \textrm{ NOR } y\)

pypdevsbbl.extra.equations.XNOR(x, y)[source]

The XNOR or XAND gate between x and y.

Parameters:
  • x (numeric) – The left hand side of the gate.
  • y (numeric) – The right hand side of the gate.
Returns:

\(x \textrm{ XNOR } y\)

pypdevsbbl.extra.equations.LT(x, y)[source]

Checks if x is less than y.

Parameters:
  • x (numeric) – The smaller value.
  • y (numeric) – The larger value.
Returns:

\(x < y\)

pypdevsbbl.extra.equations.LE(x, y)[source]

Checks if x is less than or equal to y.

Parameters:
  • x (numeric) – The smaller value.
  • y (numeric) – The larger value.
Returns:

\(x \leq y\)

pypdevsbbl.extra.equations.LEQ(x, y)

Synonym of LE().

pypdevsbbl.extra.equations.GT(x, y)[source]

Checks if x is greater than y.

Parameters:
  • x (numeric) – The larger value.
  • y (numeric) – The smaller value.
Returns:

\(x > y\)

pypdevsbbl.extra.equations.GE(x, y)[source]

Checks if x is greater than or equal to y.

Parameters:
  • x (numeric) – The larger value.
  • y (numeric) – The smaller value.
Returns:

\(x \geq y\)

pypdevsbbl.extra.equations.GEQ(x, y)

Synonym of GE().

pypdevsbbl.extra.equations.EQ(x, y)[source]

Checks if x equals y.

Parameters:
  • x (numeric) – The left hand side.
  • y (numeric) – The right hand side.
Returns:

\(x == y\)

pypdevsbbl.extra.equations.EQUALS(x, y)

Synonym of EQ().

pypdevsbbl.extra.equations.IDENTICAL(x, y)[source]

Checks if x is identical to y.

Parameters:
  • x (numeric) – The left hand side.
  • y (numeric) – The right hand side.
Returns:

\(x \textrm{ is } y\)