umath: Redo module docs.

This reworks the documentation for the umath module, as done previously as per https://github.com/pybricks/pybricks-api/pull/64 and https://github.com/pybricks/pybricks-api/issues/63

The presentation and docstrings are inspired by the Python 3 math module documentation instead of the MicroPython math module documentation. Functions are grouped roughly by use case.
This commit is contained in:
Laurens Valk
2021-07-14 11:22:04 +02:00
parent a0e4ffdb5c
commit 727ec3fe46
2 changed files with 374 additions and 164 deletions
+76 -3
View File
@@ -1,4 +1,77 @@
:mod:`umath` -- Mathematical functions
======================================
:mod:`umath <umath>` -- Math functions
============================================================
.. automodule:: umath
This module is available on the the City Hub, Technic Hub,
Prime Hub, and Inventor Hub.
This MicroPython module is similar to the `math module`_ in Python.
.. module:: umath
Rounding and sign
-------------------------------------
.. autofunction:: umath.ceil
.. autofunction:: umath.floor
.. autofunction:: umath.trunc
.. autofunction:: umath.fmod
.. autofunction:: umath.fabs
.. autofunction:: umath.copysign
Powers and logarithms
-------------------------------
.. autodata:: umath.e
.. autofunction:: umath.exp
.. autofunction:: umath.pow
.. autofunction:: umath.log
.. autofunction:: umath.sqrt
Trigonomety
-------------------------------
.. autodata:: umath.pi
.. autofunction:: umath.degrees
.. autofunction:: umath.radians
.. autofunction:: umath.sin
.. autofunction:: umath.asin
.. autofunction:: umath.cos
.. autofunction:: umath.acos
.. autofunction:: umath.tan
.. autofunction:: umath.atan
.. autofunction:: umath.atan2
Other math functions
-------------------------------
.. autofunction:: umath.isfinite
.. autofunction:: umath.isinfinite
.. autofunction:: umath.isnan
.. autofunction:: umath.modf
.. autofunction:: umath.frexp
.. autofunction:: umath.ldexp
.. _math module: https://docs.python.org/3.5/library/math.html#module-math