numpoly


Namenumpoly JSON
Version 1.3.6 PyPI version JSON
download
home_pageNone
SummaryPolynomials as a numpy datatype
upload_time2024-12-06 12:27:40
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseBSD-2-Clause
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://github.com/jonathf/numpoly/raw/master/docs/.static/numpoly_logo.svg
   :height: 200 px
   :width: 200 px
   :align: center

|circleci| |codecov| |readthedocs| |downloads| |pypi|

.. |circleci| image:: https://circleci.com/gh/jonathf/numpoly/tree/master.svg?style=shield
    :target: https://circleci.com/gh/jonathf/numpoly/tree/master
.. |codecov| image:: https://codecov.io/gh/jonathf/numpoly/branch/master/graph/badge.svg
    :target: https://codecov.io/gh/jonathf/numpoly
.. |readthedocs| image:: https://readthedocs.org/projects/numpoly/badge/?version=master
    :target: http://numpoly.readthedocs.io/en/master/?badge=master
.. |downloads| image:: https://img.shields.io/pypi/dm/numpoly
    :target: https://pypistats.org/packages/numpoly
.. |pypi| image:: https://badge.fury.io/py/numpoly.svg
    :target: https://badge.fury.io/py/numpoly

Numpoly is a generic library for creating, manipulating and evaluating
arrays of polynomials based on ``numpy.ndarray`` objects.

* Intuitive interface for users experienced with ``numpy``, as the library
  provides a high level of compatibility with the ``numpy.ndarray``, including
  fancy indexing, broadcasting, ``numpy.dtype``, vectorized operations to name
  a few.
* Computationally fast evaluations of lots of functionality inherent from
  ``numpy``.
* Vectorized polynomial evaluation.
* Support for arbitrary number of dimensions.
* Native support for lots of ``numpy.<name>`` functions using ``numpy``'s
  compatibility layer (which also exists as ``numpoly.<name>``
  equivalents).
* Support for polynomial division through the operators ``/``, ``%`` and
  ``divmod``.
* Extra polynomial specific attributes exposed on the polynomial objects like
  ``poly.exponents``, ``poly.coefficients``, ``poly.indeterminants`` etc.
* Polynomial derivation through functions like ``numpoly.derivative``,
  ``numpoly.gradient``, ``numpoly.hessian`` etc.
* Decompose polynomial sums into vector of addends using ``numpoly.decompose``.
* Variable substitution through ``numpoly.call``.

Installation
============

Installation should be straight forward:

.. code-block:: bash

    pip install numpoly

Example Usage
=============

Constructing polynomial is typically done using one of the available
constructors:

.. code-block:: python

    >>> import numpoly
    >>> numpoly.monomial(start=0, stop=3, dimensions=2)
    polynomial([1, q0, q0**2, q1, q0*q1, q1**2])

It is also possible to construct your own from symbols together with
`numpy <https://python.org>`_:

.. code-block:: python

    >>> import numpy
    >>> q0, q1 = numpoly.variable(2)
    >>> numpoly.polynomial([1, q0**2-1, q0*q1, q1**2-1])
    polynomial([1, q0**2-1, q0*q1, q1**2-1])

Or in combination with numpy objects using various arithmetics:

.. code-block:: python

    >>> q0**numpy.arange(4)-q1**numpy.arange(3, -1, -1)
    polynomial([-q1**3+1, -q1**2+q0, q0**2-q1, q0**3-1])

The constructed polynomials can be evaluated as needed:

.. code-block:: python

    >>> poly = 3*q0+2*q1+1
    >>> poly(q0=q1, q1=[1, 2, 3])
    polynomial([3*q1+3, 3*q1+5, 3*q1+7])

Or manipulated using various numpy functions:

.. code-block:: python

    >>> numpy.reshape(q0**numpy.arange(4), (2, 2))
    polynomial([[1, q0],
                [q0**2, q0**3]])
    >>> numpy.sum(numpoly.monomial(13)[::3])
    polynomial(q0**12+q0**9+q0**6+q0**3+1)

Installation
============

Installation should be straight forward from `pip <https://pypi.org/>`_:

.. code-block:: bash

    pip install numpoly

Alternatively, to get the most current experimental version, the code can be
installed from `Github <https://github.com/>`_ as follows:

* First time around, download the repository:

  .. code-block:: bash

      git clone git@github.com:jonathf/numpoly.git

* Every time, move into the repository:

  .. code-block:: bash

      cd numpoly/

* After  the first time, you want to update the branch to the most current
  version of ``master``:

  .. code-block:: bash

      git checkout master
      git pull

* Install the latest version of ``numpoly`` with:

  .. code-block:: bash

      pip install .

Development
-----------

Installing ``numpoly`` for development can
be done from the repository root with the command::

    pip install -e .[dev]

The deployment of the code is done with Python 3.10 and dependencies are then
fixed using::

    pip install -r requirements-dev.txt

Testing
-------

To run test:

.. code-block:: bash

    pytest --doctest-modules numpoly test docs/user_guide/*.rst README.rst

Documentation
-------------

To build documentation locally on your system, use ``make`` from the ``doc/``
folder:

.. code-block:: bash

    cd doc/
    make html

Run ``make`` without argument to get a list of build targets. All targets
stores output to the folder ``doc/.build/html``.

Note that the documentation build assumes that ``pandoc`` is installed on your
system and available in your path.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "numpoly",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/b9/03/73b222c4341e02991ad97ce5b8facbc2d2f8430768f8ecaa20b749e9df9b/numpoly-1.3.6.tar.gz",
    "platform": null,
    "description": ".. image:: https://github.com/jonathf/numpoly/raw/master/docs/.static/numpoly_logo.svg\n   :height: 200 px\n   :width: 200 px\n   :align: center\n\n|circleci| |codecov| |readthedocs| |downloads| |pypi|\n\n.. |circleci| image:: https://circleci.com/gh/jonathf/numpoly/tree/master.svg?style=shield\n    :target: https://circleci.com/gh/jonathf/numpoly/tree/master\n.. |codecov| image:: https://codecov.io/gh/jonathf/numpoly/branch/master/graph/badge.svg\n    :target: https://codecov.io/gh/jonathf/numpoly\n.. |readthedocs| image:: https://readthedocs.org/projects/numpoly/badge/?version=master\n    :target: http://numpoly.readthedocs.io/en/master/?badge=master\n.. |downloads| image:: https://img.shields.io/pypi/dm/numpoly\n    :target: https://pypistats.org/packages/numpoly\n.. |pypi| image:: https://badge.fury.io/py/numpoly.svg\n    :target: https://badge.fury.io/py/numpoly\n\nNumpoly is a generic library for creating, manipulating and evaluating\narrays of polynomials based on ``numpy.ndarray`` objects.\n\n* Intuitive interface for users experienced with ``numpy``, as the library\n  provides a high level of compatibility with the ``numpy.ndarray``, including\n  fancy indexing, broadcasting, ``numpy.dtype``, vectorized operations to name\n  a few.\n* Computationally fast evaluations of lots of functionality inherent from\n  ``numpy``.\n* Vectorized polynomial evaluation.\n* Support for arbitrary number of dimensions.\n* Native support for lots of ``numpy.<name>`` functions using ``numpy``'s\n  compatibility layer (which also exists as ``numpoly.<name>``\n  equivalents).\n* Support for polynomial division through the operators ``/``, ``%`` and\n  ``divmod``.\n* Extra polynomial specific attributes exposed on the polynomial objects like\n  ``poly.exponents``, ``poly.coefficients``, ``poly.indeterminants`` etc.\n* Polynomial derivation through functions like ``numpoly.derivative``,\n  ``numpoly.gradient``, ``numpoly.hessian`` etc.\n* Decompose polynomial sums into vector of addends using ``numpoly.decompose``.\n* Variable substitution through ``numpoly.call``.\n\nInstallation\n============\n\nInstallation should be straight forward:\n\n.. code-block:: bash\n\n    pip install numpoly\n\nExample Usage\n=============\n\nConstructing polynomial is typically done using one of the available\nconstructors:\n\n.. code-block:: python\n\n    >>> import numpoly\n    >>> numpoly.monomial(start=0, stop=3, dimensions=2)\n    polynomial([1, q0, q0**2, q1, q0*q1, q1**2])\n\nIt is also possible to construct your own from symbols together with\n`numpy <https://python.org>`_:\n\n.. code-block:: python\n\n    >>> import numpy\n    >>> q0, q1 = numpoly.variable(2)\n    >>> numpoly.polynomial([1, q0**2-1, q0*q1, q1**2-1])\n    polynomial([1, q0**2-1, q0*q1, q1**2-1])\n\nOr in combination with numpy objects using various arithmetics:\n\n.. code-block:: python\n\n    >>> q0**numpy.arange(4)-q1**numpy.arange(3, -1, -1)\n    polynomial([-q1**3+1, -q1**2+q0, q0**2-q1, q0**3-1])\n\nThe constructed polynomials can be evaluated as needed:\n\n.. code-block:: python\n\n    >>> poly = 3*q0+2*q1+1\n    >>> poly(q0=q1, q1=[1, 2, 3])\n    polynomial([3*q1+3, 3*q1+5, 3*q1+7])\n\nOr manipulated using various numpy functions:\n\n.. code-block:: python\n\n    >>> numpy.reshape(q0**numpy.arange(4), (2, 2))\n    polynomial([[1, q0],\n                [q0**2, q0**3]])\n    >>> numpy.sum(numpoly.monomial(13)[::3])\n    polynomial(q0**12+q0**9+q0**6+q0**3+1)\n\nInstallation\n============\n\nInstallation should be straight forward from `pip <https://pypi.org/>`_:\n\n.. code-block:: bash\n\n    pip install numpoly\n\nAlternatively, to get the most current experimental version, the code can be\ninstalled from `Github <https://github.com/>`_ as follows:\n\n* First time around, download the repository:\n\n  .. code-block:: bash\n\n      git clone git@github.com:jonathf/numpoly.git\n\n* Every time, move into the repository:\n\n  .. code-block:: bash\n\n      cd numpoly/\n\n* After  the first time, you want to update the branch to the most current\n  version of ``master``:\n\n  .. code-block:: bash\n\n      git checkout master\n      git pull\n\n* Install the latest version of ``numpoly`` with:\n\n  .. code-block:: bash\n\n      pip install .\n\nDevelopment\n-----------\n\nInstalling ``numpoly`` for development can\nbe done from the repository root with the command::\n\n    pip install -e .[dev]\n\nThe deployment of the code is done with Python 3.10 and dependencies are then\nfixed using::\n\n    pip install -r requirements-dev.txt\n\nTesting\n-------\n\nTo run test:\n\n.. code-block:: bash\n\n    pytest --doctest-modules numpoly test docs/user_guide/*.rst README.rst\n\nDocumentation\n-------------\n\nTo build documentation locally on your system, use ``make`` from the ``doc/``\nfolder:\n\n.. code-block:: bash\n\n    cd doc/\n    make html\n\nRun ``make`` without argument to get a list of build targets. All targets\nstores output to the folder ``doc/.build/html``.\n\nNote that the documentation build assumes that ``pandoc`` is installed on your\nsystem and available in your path.\n",
    "bugtrack_url": null,
    "license": "BSD-2-Clause",
    "summary": "Polynomials as a numpy datatype",
    "version": "1.3.6",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b90373b222c4341e02991ad97ce5b8facbc2d2f8430768f8ecaa20b749e9df9b",
                "md5": "289510b99278a88e25ca6967793f1e39",
                "sha256": "587e8459e9f43b10bafe84f15500382f75e031e2f0b06cb0f0c9d2fc7efbbe12"
            },
            "downloads": -1,
            "filename": "numpoly-1.3.6.tar.gz",
            "has_sig": false,
            "md5_digest": "289510b99278a88e25ca6967793f1e39",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 369686,
            "upload_time": "2024-12-06T12:27:40",
            "upload_time_iso_8601": "2024-12-06T12:27:40.326515Z",
            "url": "https://files.pythonhosted.org/packages/b9/03/73b222c4341e02991ad97ce5b8facbc2d2f8430768f8ecaa20b749e9df9b/numpoly-1.3.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-06 12:27:40",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "numpoly"
}
        
Elapsed time: 0.38113s