pysym
Advanced tools
+4
-0
@@ -0,1 +1,5 @@ | ||
| v0.2 | ||
| ==== | ||
| - Drop Cython extension (too slow, will write pure C++ instead) | ||
| v0.1 | ||
@@ -2,0 +6,0 @@ ==== |
+1
-1
| Metadata-Version: 1.1 | ||
| Name: pysym | ||
| Version: 0.1.0 | ||
| Version: 0.2.0 | ||
| Summary: Minimal symbolic manipulation framework. | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/bjodah/pysym |
| Metadata-Version: 1.1 | ||
| Name: pysym | ||
| Version: 0.1.0 | ||
| Version: 0.2.0 | ||
| Summary: Minimal symbolic manipulation framework. | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/bjodah/pysym |
@@ -9,3 +9,2 @@ AUTHORS | ||
| pysym/__init__.py | ||
| pysym/_pysym.c | ||
| pysym/_release.py | ||
@@ -12,0 +11,0 @@ pysym/core.py |
+3
-11
@@ -12,14 +12,6 @@ # -*- coding: utf-8 -*- | ||
| if os.environ.get('PYSYM_USE_NATIVE', '0') == '1': | ||
| # Will eventually provide a faster alternative | ||
| from ._pysym import ( | ||
| Symbol, Dummy, Number, ITE, gamma, abs, exp, log, | ||
| sin, cos, tan, asin, acos, atan, | ||
| Vector, Matrix, sqrt, _wrap_numbers, Add, Mul, | ||
| Lt, Le, Eq, Ne, Gt, Ge | ||
| ) | ||
| elif os.environ.get('PYSYM_USE_SYMPY', '0') == '1': | ||
| if os.environ.get('PYSYM_USE_SYMPY', '0') == '1': | ||
| # For debugging purposes only | ||
| from sympy import ( | ||
| Symbol, Dummy, Number, ITE, gamma, abs, exp, log, | ||
| Symbol, Dummy, Number, ITE, gamma, Abs, exp, log, | ||
| sin, cos, tan, asin, acos, atan, | ||
@@ -31,3 +23,3 @@ Vector, Matrix, sqrt, _wrap_numbers, Add, Mul, | ||
| from .core import ( | ||
| Symbol, Dummy, Number, ITE, gamma, abs, exp, log, | ||
| Symbol, Dummy, Number, ITE, gamma, Abs, exp, log, | ||
| sin, cos, tan, asin, acos, atan, | ||
@@ -34,0 +26,0 @@ Vector, Matrix, sqrt, _wrap_numbers, Add, Mul, |
@@ -1,1 +0,1 @@ | ||
| __version__ = '0.1.0' | ||
| __version__ = '0.2.0' |
+5
-6
@@ -12,5 +12,3 @@ # -*- coding: utf-8 -*- | ||
| # from fastcache import clru_cache | ||
| def _wrap_numbers(func): | ||
@@ -109,3 +107,2 @@ @functools.wraps(func) | ||
| @classmethod | ||
| # @clru_cache(maxsize=1024*1024, typed=True) | ||
| def create(cls, args): | ||
@@ -374,2 +371,3 @@ return cls(*args) # extra magic allowed | ||
| Two = Number(2) | ||
| nan = Number(float('nan')) | ||
@@ -656,9 +654,10 @@ | ||
| class abs(Function1): | ||
| class Abs(Function1): | ||
| _function = abs | ||
| _func_str = 'abs' | ||
| _func_str = 'Abs' | ||
| @staticmethod | ||
| def _deriv(arg): | ||
| return One | ||
| return ITE(Lt(arg, Zero), -One, | ||
| ITE(Gt(arg, Zero), One, nan)) | ||
@@ -665,0 +664,0 @@ |
@@ -8,3 +8,6 @@ # -*- coding: utf-8 -*- | ||
| from .. import Symbol, Add, gamma, Number, sin, cos, Mul, ITE, exp, Lt, tan | ||
| from .. import ( | ||
| Symbol, Add, gamma, Number, sin, cos, Mul, ITE, exp, Lt, tan, log, | ||
| Abs | ||
| ) | ||
@@ -181,2 +184,26 @@ | ||
| def test_diff7(): | ||
| x = Symbol('x') | ||
| expr = 2*exp(x*x)*x | ||
| subsd = {x: Number(0.2)} | ||
| ref_val = 2.2481512722555586 | ||
| assert abs(expr.diff(x).subs(subsd).evalf() - ref_val) < 1e-15 | ||
| def test_diff8(): | ||
| x = Symbol('x') | ||
| e = log(sin(x)) | ||
| subsd = {x: Number(0.2)} | ||
| ref_val = 4.93315487558689 | ||
| assert abs(e.diff(x).subs(subsd).evalf() - ref_val) < 4e-15 | ||
| def test_diff9(): | ||
| x = Symbol('x') | ||
| absx = Abs(x) | ||
| assert abs(absx.diff(x).subs({x: Number(-.1)}).evalf() + 1) < 1e-16 | ||
| assert abs(absx.diff(x).subs({x: Number(.1)}).evalf() - 1) < 1e-16 | ||
| assert math.isnan(absx.diff(x).subs({x: Number(0)}).evalf()) | ||
| def test_repr(): | ||
@@ -183,0 +210,0 @@ x, y = map(Symbol, 'x y'.split()) |
+9
-10
| pysym | ||
| ===== | ||
| .. image:: http://hera.physchem.kth.se:8080/github.com/bjodah/pysym/status.svg?branch=master | ||
| :target: http://hera.physchem.kth.se:8080/github.com/bjodah/pysym | ||
| .. image:: http://hera.physchem.kth.se:9090/api/badges/bjodah/pysym/status.svg | ||
| :target: http://hera.physchem.kth.se:9090/bjodah/pysym | ||
| :alt: Build status | ||
@@ -16,4 +16,4 @@ .. image:: https://img.shields.io/pypi/v/pysym.svg | ||
| :alt: airspeedvelocity | ||
| .. image:: http://hera.physchem.kth.se/~pysym/master/htmlcov/coverage.svg | ||
| :target: http://hera.physchem.kth.se/~pysym/master/htmlcov | ||
| .. image:: http://hera.physchem.kth.se/~pysym/branches/master/htmlcov/coverage.svg | ||
| :target: http://hera.physchem.kth.se/~pysym/branches/master/htmlcov | ||
| :alt: coverage | ||
@@ -24,2 +24,3 @@ | ||
| It tries to stay compatible with the API of `SymPy <http://www.sympy.org>`_. | ||
| It should be viewed as a prototype and not as a "production" package. | ||
@@ -29,14 +30,12 @@ The capabilities include: | ||
| - Differentiation | ||
| - Numerical evaluation (including "lambdify" support) | ||
| - (slow) numerical evaluation (including "lambdify" support) | ||
| The above capabilities are exactly what is needed by | ||
| `pyodesys <https://pypi.python.org/pypi/pyodesys>`_ | ||
| and `pyodesys <https://pypi.python.org/pypi/pyodesys>`_. The goal of pysym | ||
| is to be a lightweight and fast (thanks to its specialization) alternative | ||
| to SymPy when no other capabilities are needed (such as series expansion, integration, | ||
| equation solving, etc.). | ||
| and `pyneqsys <https://pypi.python.org/pypi/pyneqsys>`_. | ||
| Documentation | ||
| ------------- | ||
| Auto-generated API documentation is found here: `<https://bjodah.github.com/pysym>`_ | ||
| Autogenerated API documentation is found here: `<https://pythonhosted.org/pysym>`_ | ||
| (and dev docs are here: `<http://hera.physchem.kth.se/~pysym/branches/master/html>`_). | ||
@@ -43,0 +42,0 @@ Installation |
+6
-0
@@ -9,2 +9,8 @@ [pytest] | ||
| [upload_sphinx] | ||
| upload-dir = doc/_build/html | ||
| [bdist_wheel] | ||
| universal = 1 | ||
| [egg_info] | ||
@@ -11,0 +17,0 @@ tag_build = |
+1
-21
@@ -6,4 +6,3 @@ #!/usr/bin/env python | ||
| import shutil | ||
| import sys | ||
| from setuptools import setup, Extension | ||
| from setuptools import setup | ||
@@ -15,20 +14,2 @@ | ||
| # Cythonize .pyx file if it exists (not in source distribution) | ||
| ext_modules = [] | ||
| if len(sys.argv) > 1 and '--help' not in sys.argv[1:] and sys.argv[1] not in ( | ||
| '--help-commands', 'egg_info', 'clean', '--version'): | ||
| USE_CYTHON = os.path.exists('pysym/_pysym.pyx') | ||
| ext = '.pyx' if USE_CYTHON else '.c' | ||
| ext_modules = [Extension( | ||
| 'pysym._pysym', | ||
| ['pysym/_pysym'+ext] | ||
| )] | ||
| if USE_CYTHON: | ||
| from Cython.Build import cythonize | ||
| ext_modules = cythonize(ext_modules, | ||
| # include_path=['./include'], | ||
| gdb_debug=True) | ||
| # http://conda.pydata.org/docs/build.html#environment-variables-set-during-the-build-process | ||
@@ -82,3 +63,2 @@ if os.environ.get('CONDA_BUILD', '0') == '1': | ||
| packages=[pkg_name] + tests, | ||
| ext_modules=ext_modules, | ||
| ) | ||
@@ -85,0 +65,0 @@ |
Sorry, the diff of this file is too big to display
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
45873
-97.66%22
-4.35%1226
-0.33%