6. Sub-package math — pvlab 0.1.0.dev1 documentation

# 6. Sub-package math

Provide tools for mathematical or statistical operations.

It contains the following modules:

## Module hypot

Contain the trigonometric function hypot, almost equal to math.hypot.

It supports n-dimensional coordinates, for compatibility with python versions previous than 3.8. In python v3.8, it was added support for n-dimensional points. In python 3.10, accuracy was improved.

Here for further information.

pvlab.math.hypot.hypot(*coordinates: Sequence[float]) → float

  Calculate the module of a vector, given its coordinates.

  Example 1: correct functioning.

      >>> coordinates = [5, 8, 3, 6]

      >>> round(hypot(*coordinates), 3)
      11.576

  Example 2: coordinates must be floats or ints.

      >>> coordinates = [5, 8, 3, '6']

      >>> hypot(*coordinates)
      Traceback (most recent call last):
          ...
      TypeError: Coordinate items must be 'int' or 'float' type.