{ "info": { "author": "Michael Goerz", "author_email": "mail@michaelgoerz.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Scientific/Engineering" ], "description": "=================\nsymbolic_equation\n=================\n\n.. image:: https://img.shields.io/badge/github-goerz/symbolic_equation-blue.svg\n :alt: Source code on Github\n :target: https://github.com/goerz/symbolic_equation\n.. image:: https://img.shields.io/pypi/v/symbolic_equation.svg\n :alt: SymbolicEquation on the Python Package Index\n :target: https://pypi.python.org/pypi/symbolic_equation\n.. image:: https://img.shields.io/travis/goerz/symbolic_equation.svg\n :alt: Travis Continuous Integration\n :target: https://travis-ci.org/goerz/symbolic_equation\n.. image:: https://img.shields.io/coveralls/github/goerz/symbolic_equation/master.svg\n :alt: Coveralls\n :target: https://coveralls.io/github/goerz/symbolic_equation?branch=master\n.. image:: https://img.shields.io/badge/License-BSD-green.svg\n :alt: BSD License\n :target: https://opensource.org/licenses/BSD-3-Clause\n\nA simple Python package providing the ``Eq`` class for manipulating symbolic\nequations.\n\nThe ``Eq`` class defines an equation, and allows to apply arbitrary\nmanipulations to the left-hand-side and/or right-hand-side of that equation. It\noptionally keeps track all of these manipulations, and displays them neatly as a\nmulti-line equation in an interactive interpreter session or a `Jupyter\nnotebook`_ (using a LaTeX representation). It is mainly intended for use with\nSymPy_.\n\nDevelopment of the ``symbolic_equation`` package happens on `Github`_.\n\n\nInstallation\n------------\n\nTo install the latest released version of ``symbolic_equation``, run this command in your terminal:\n\n.. code-block:: console\n\n $ pip install symbolic_equation\n\nThis is the preferred method to install ``symbolic_equation``, as it will always install the most recent stable release.\n\nIf you don't have `pip`_ installed, the `Python installation guide`_, respectively the `Python Packaging User Guide`_ can guide\nyou through the process.\n\nTo install the latest development version of ``symbolic_equation`` from `Github`_.\n\n.. code-block:: console\n\n $ pip install git+https://github.com/goerz/symbolic_equation.git@master#egg=symbolic_equation\n\n\nExample\n-------\n\n.. code-block:: pycon\n\n >>> from symbolic_equation import Eq\n >>> from sympy import symbols\n >>> x, y = symbols('x y')\n >>> eq1 = Eq(2*x - y - 1, tag='I')\n >>> eq1\n 2*x - y - 1 = 0 ('I')\n\n >>> eq2 = Eq(x + y - 5, tag='II')\n >>> eq2\n x + y - 5 = 0 ('II')\n\n >>> eq_y = (\n ... (eq1 - 2 * eq2).set_tag(\"I - 2 II\")\n ... .apply(lambda v: v - 9, cont=True)\n ... .apply(lambda v: v / (-3), cont=True, tag='y')\n ... )\n >>> eq_y\n 9 - 3*y = 0 ('I - 2 II')\n -3*y = -9\n y = 3 ('y')\n\n >>> eq_x = (\n ... eq1.apply_mtd_to_lhs('subs', eq_y.as_dict, tag=r'y in I')\n ... .apply(lambda v: v / 2, cont=True)\n ... .apply(lambda v: v + 2, cont=True, tag='x')\n ... )\n >>> eq_x\n 2*x - 4 = 0 ('y in I')\n x - 2 = 0\n x = 2 ('x')\n\nReference\n---------\n\n.. code-block:: pycon\n\n >>> help(Eq) # doctest: +NORMALIZE_WHITESPACE\n Help on class Eq in module symbolic_equation:\n \n class Eq(builtins.object)\n | Eq(lhs, rhs=None, tag=None, _prev_lhs=None, _prev_rhs=None, _prev_tags=None)\n |\n | Symbolic equation.\n |\n | This class keeps track of the :attr:`lhs` and :attr:`rhs` of an equation\n | across arbitrary manipulations.\n |\n | Args:\n | lhs: the left-hand-side of the equation\n | rhs: the right-hand-side of the equation. If None, defaults to zero.\n | tag: a tag (equation number) to be shown when printing\n | the equation\n |\n | Class Attributes:\n | latex_renderer: If not None, a callable that must return a LaTeX\n | representation (:class:`str`) of `lhs` and `rhs`.\n |\n | Methods defined here:\n |\n | __add__(self, other)\n | Add another equation, or a constant.\n |\n | __eq__(self, other)\n | Compare to another equation, or a constant.\n |\n | This does not take into account any mathematical knowledge, it merely\n | checks if the :attr:`lhs` and :attr:`rhs` are exactly equal. If\n | comparing against a constant, the :attr:`rhs` must be exactly equal to\n | that constant.\n |\n | __init__(self, lhs, rhs=None, tag=None, _prev_lhs=None, _prev_rhs=None, _prev_tags=None)\n | Initialize self. See help(type(self)) for accurate signature.\n |\n | __mul__(self, other)\n |\n | __radd__ = __add__(self, other)\n |\n | __repr__(self)\n | Return repr(self).\n |\n | __rmul__(self, other)\n |\n | __rsub__(self, other)\n |\n | __str__(self)\n | Return str(self).\n |\n | __sub__(self, other)\n |\n | __truediv__(self, other)\n |\n | apply(self, func, *args, cont=False, tag=None, **kwargs)\n | Apply `func` to both sides of the equation.\n |\n | Returns a new equation where the left-hand-side and right-hand side\n | are replaced by the application of `func`::\n |\n | lhs=func(lhs, *args, **kwargs)\n | rhs=func(rhs, *args, **kwargs)\n |\n | If ``cont=True``, the resulting equation will keep a history of its\n | previous state (resulting in multiple lines of equations when printed).\n |\n | The resulting equation with have the given `tag`.\n |\n | apply_mtd(self, mtd, *args, cont=False, tag=None, **kwargs)\n | Call the method `mtd` on both sides of the equation.\n |\n | That is, the left-hand-side and right-hand-side are replaced by::\n |\n | lhs=lhs.(*args, **kwargs)\n | rhs=rhs.(*args, **kwargs)\n |\n | The `cont` and `tag` parameters are as in :meth:`apply`.\n |\n | apply_mtd_to_lhs(self, mtd, *args, cont=False, tag=None, **kwargs)\n | Call the method `mtd` on the :attr:`lhs` of the equation only.\n |\n | Like :meth:`apply_mtd`, but modifying only the left-hand-side.\n |\n | apply_mtd_to_rhs(self, mtd, *args, cont=False, tag=None, **kwargs)\n | Call the method `mtd` on the :attr:`rhs` of the equation.\n |\n | Like :meth:`apply_mtd`, but modifying only the right-hand-side.\n |\n | apply_to_lhs(self, func, *args, cont=False, tag=None, **kwargs)\n | Apply `func` to the :attr:`lhs` of the equation only.\n |\n | Like :meth:`apply`, but modifying only the left-hand-side.\n |\n | apply_to_rhs(self, func, *args, cont=False, tag=None, **kwargs)\n | Apply `func` to the :attr:`rhs` of the equation only.\n |\n | Like :meth:`apply`, but modifying only the right-hand-side.\n |\n | copy(self)\n | Return a copy of the equation\n |\n | set_tag(self, tag)\n | Return a copy of the equation with a new `tag`.\n |\n | ----------------------------------------------------------------------\n | Data descriptors defined here:\n |\n | __dict__\n | dictionary for instance variables (if defined)\n |\n | __weakref__\n | list of weak references to the object (if defined)\n |\n | as_dict\n | Mapping of the lhs to the rhs.\n |\n | This allows to plug an equation into another expression.\n |\n | lhs\n | The left-hand-side of the equation.\n |\n | rhs\n | The right-hand-side of the equation.\n |\n | tag\n | A tag (equation number) to be shown when printing the equation, or\n | None\n |\n | ----------------------------------------------------------------------\n | Data and other attributes defined here:\n |\n | __hash__ = None\n |\n | latex_renderer = None\n \n\n\n\nUse in the Jupyter notebook\n---------------------------\n\nIn a `Jupyter notebook`_, equations will be rendered in LaTeX.\nSee `examples.ipynb`_.\n\nThe rendering presumes that both the ``lhs`` and the ``rhs`` have a LaTeX\nrepresentation. If the ``Eq`` class has a ``latex_renderer`` attribute defined,\nthat renderer will be used to obtain the LaTeX representation of the ``lhs``\nand ``rhs``. Otherwise:\n\n* If the ``lhs`` or ``rhs`` object has a ``_latex`` method, that method will be\n called; or lastly,\n* The ``lhs`` and ``rhs`` will be passed to ``sympy.latex``.\n\n\nRelation to SymPy's Eq class\n----------------------------\n\nThe SymPy package also provides an `Eq class`_ that represents equality between\ntwo SymPy expressions. The class provided by SymPy and the class provided by\nthis package are not interchangeable: SymPy's ``Eq`` does not track\nmodifications or print out as multiline equations. While the\n``symbolic_equation.Eq`` class is not a SymPy expression, it can be converted\nto a ``sympy.Eq`` instance via the ``sympy.sympify`` function.\n\n.. _examples.ipynb: https://nbviewer.jupyter.org/github/goerz/symbolic_equation/blob/master/examples.ipynb\n.. _Github: https://github.com/goerz/symbolic_equation\n.. _pip: https://pip.pypa.io\n.. _Python installation guide: http://docs.python-guide.org/en/latest/starting/installation/\n.. _Python Packaging User Guide: https://packaging.python.org/tutorials/installing-packages/\n.. _Eq class: https://docs.sympy.org/latest/modules/core.html?highlight=eq#sympy.core.relational.Equality\n.. _SymPy: https://www.sympy.org/\n.. _Jupyter notebook: https://jupyter.org\n\n\n=======\nHistory\n=======\n\n0.1.0-dev (2019-05-26)\n----------------------\n\n* Initial release\n\n\n", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/goerz/symbolic_equation", "keywords": "sympy,equation,algebra", "license": "BSD license", "maintainer": "", "maintainer_email": "", "name": "symbolic-equation", "package_url": "https://pypi.org/project/symbolic-equation/", "platform": "", "project_url": "https://pypi.org/project/symbolic-equation/", "project_urls": { "Homepage": "https://github.com/goerz/symbolic_equation" }, "release_url": "https://pypi.org/project/symbolic-equation/0.1.0.dev0/", "requires_dist": [ "uniseg", "black ; extra == 'dev'", "coverage ; extra == 'dev'", "flake8 ; extra == 'dev'", "gitpython ; extra == 'dev'", "isort ; extra == 'dev'", "ipython ; extra == 'dev'", "jupyter ; extra == 'dev'", "nbsphinx ; extra == 'dev'", "nbval ; extra == 'dev'", "pre-commit ; extra == 'dev'", "pylint ; extra == 'dev'", "pytest ; extra == 'dev'", "pytest-cov ; extra == 'dev'", "pytest-xdist ; extra == 'dev'", "sympy ; extra == 'dev'", "twine ; extra == 'dev'", "watermark ; extra == 'dev'", "wheel ; extra == 'dev'" ], "requires_python": ">=3.6", "summary": "A class for multiline symbolic equations in the Jupyter Notebook", "version": "0.1.0.dev0" }, "last_serial": 5321135, "releases": { "0.1.0.dev0": [ { "comment_text": "", "digests": { "md5": "602c00f9d605e89df7587751ea7b31a5", "sha256": "fc182482066a85ab38650cdfd2c600e425a0d73bc2dfb2caa8f89f4a34c1fd5b" }, "downloads": -1, "filename": "symbolic_equation-0.1.0.dev0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "602c00f9d605e89df7587751ea7b31a5", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6", "size": 8471, "upload_time": "2019-05-27T07:30:42", "url": "https://files.pythonhosted.org/packages/6d/5e/6f4e13988c60a4a927120e6f2c2b86f1cf23af5f6d381cf4de2f441672fc/symbolic_equation-0.1.0.dev0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9f3a012d47cd75c7f5de83af7b6d2dea", "sha256": "6fcef5d5e7f0d979316746b90415fd0d5cf1c83adf5999910cea2a7c5da7a7ef" }, "downloads": -1, "filename": "symbolic_equation-0.1.0.dev0.tar.gz", "has_sig": false, "md5_digest": "9f3a012d47cd75c7f5de83af7b6d2dea", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 17018, "upload_time": "2019-05-27T07:30:44", "url": "https://files.pythonhosted.org/packages/82/24/f2d7f428affdf263bec4ce2d49f8b202100fa26a51c4f89b5e1bfe1110e8/symbolic_equation-0.1.0.dev0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "602c00f9d605e89df7587751ea7b31a5", "sha256": "fc182482066a85ab38650cdfd2c600e425a0d73bc2dfb2caa8f89f4a34c1fd5b" }, "downloads": -1, "filename": "symbolic_equation-0.1.0.dev0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "602c00f9d605e89df7587751ea7b31a5", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6", "size": 8471, "upload_time": "2019-05-27T07:30:42", "url": "https://files.pythonhosted.org/packages/6d/5e/6f4e13988c60a4a927120e6f2c2b86f1cf23af5f6d381cf4de2f441672fc/symbolic_equation-0.1.0.dev0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9f3a012d47cd75c7f5de83af7b6d2dea", "sha256": "6fcef5d5e7f0d979316746b90415fd0d5cf1c83adf5999910cea2a7c5da7a7ef" }, "downloads": -1, "filename": "symbolic_equation-0.1.0.dev0.tar.gz", "has_sig": false, "md5_digest": "9f3a012d47cd75c7f5de83af7b6d2dea", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 17018, "upload_time": "2019-05-27T07:30:44", "url": "https://files.pythonhosted.org/packages/82/24/f2d7f428affdf263bec4ce2d49f8b202100fa26a51c4f89b5e1bfe1110e8/symbolic_equation-0.1.0.dev0.tar.gz" } ] }