{ "info": { "author": "Artem Yaschenko", "author_email": "ayaschenko@yahoo.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: Education", "Intended Audience :: Science/Research", "License :: Freeware" ], "description": "This module provides classes that can be used to evaluate math expression contained in string. \r\nMost common class is Ncalc. It allows you evaluate expression contains variables 'x', 'y' and most common \r\nfunctions such as sin, cos, tg, log2, log10, exp, mod, exp and factorial. \r\nFurthermore you can build your own 'calculator' with your own operator precedences \r\n(don't know why it can be need), functions and variables. \r\nTo build The Calculator see at Ncalc definition and do it like it: \r\n1. Define new class inherited from Matheval: \r\n\r\nclass Ncalc(Matheval): \r\n\r\n2. Using __init__ set up given math expression and context namely dictionary of variables and functions: \r\n\r\ndef __init__(self, mexp): \r\nsuper().__init__(mexp, { \r\n'x': 1, \r\n'y': 1, \r\n'factorial': Ncalc.__factorial, \r\n}) \r\n\r\n3. Wrap functions as 'staticmethod' or functions of module: \r\n\r\n@staticmethod \r\ndef __log10(a): \r\nreturn math.log10(a) \r\n\r\n4. That's it. :) \r\n\r\nUsing:\r\n>>> from ncalc.eval import Ncalc\r\n>>> e = Ncalc('2*factorial(5)')\r\n>>> e.eval()\r\n240\r\n>>> e.expression = '1+mod(5, 2)+sin(0)'\r\n>>> e.eval()\r\n2.0\r\n\r\nP.S. This version can work wrong cause I didn't test it as it's necessary.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "UNKNOWN", "keywords": "math expression evaluate string", "license": "GPL", "maintainer": "", "maintainer_email": "", "name": "ncalc", "package_url": "https://pypi.org/project/ncalc/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/ncalc/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/ncalc/1.0/", "requires_dist": null, "requires_python": null, "summary": "Allows evaluate math expression represented as string.", "version": "1.0" }, "last_serial": 1933140, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "f5d7360dffdb48c5fbcf7927084be7c8", "sha256": "9eb5d499bdfb38bbe02ca74a384d5d4a28cc38af425db3f56b739bfeee176264" }, "downloads": -1, "filename": "ncalc-1.0-py3.4.egg", "has_sig": false, "md5_digest": "f5d7360dffdb48c5fbcf7927084be7c8", "packagetype": "bdist_egg", "python_version": "3.4", "requires_python": null, "size": 8304, "upload_time": "2016-01-31T20:46:29", "url": "https://files.pythonhosted.org/packages/83/11/025ebdc8da5bc36f1ec9ffa4e1b31765ba5911f9e24510e058d1c53a0e9d/ncalc-1.0-py3.4.egg" }, { "comment_text": "", "digests": { "md5": "f7fa0778abde22e503c6149f757a8382", "sha256": "37f7c76f282130b58f540296d5c8824367f3b6b10b6c6a9b065e8bae5f560c79" }, "downloads": -1, "filename": "ncalc-1.0.tar.gz", "has_sig": false, "md5_digest": "f7fa0778abde22e503c6149f757a8382", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3722, "upload_time": "2016-01-31T20:46:43", "url": "https://files.pythonhosted.org/packages/ac/f4/66d379ea0f716ed714c26c6c9282942ec1d9f62ff30a5655b552bc845b35/ncalc-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f5d7360dffdb48c5fbcf7927084be7c8", "sha256": "9eb5d499bdfb38bbe02ca74a384d5d4a28cc38af425db3f56b739bfeee176264" }, "downloads": -1, "filename": "ncalc-1.0-py3.4.egg", "has_sig": false, "md5_digest": "f5d7360dffdb48c5fbcf7927084be7c8", "packagetype": "bdist_egg", "python_version": "3.4", "requires_python": null, "size": 8304, "upload_time": "2016-01-31T20:46:29", "url": "https://files.pythonhosted.org/packages/83/11/025ebdc8da5bc36f1ec9ffa4e1b31765ba5911f9e24510e058d1c53a0e9d/ncalc-1.0-py3.4.egg" }, { "comment_text": "", "digests": { "md5": "f7fa0778abde22e503c6149f757a8382", "sha256": "37f7c76f282130b58f540296d5c8824367f3b6b10b6c6a9b065e8bae5f560c79" }, "downloads": -1, "filename": "ncalc-1.0.tar.gz", "has_sig": false, "md5_digest": "f7fa0778abde22e503c6149f757a8382", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3722, "upload_time": "2016-01-31T20:46:43", "url": "https://files.pythonhosted.org/packages/ac/f4/66d379ea0f716ed714c26c6c9282942ec1d9f62ff30a5655b552bc845b35/ncalc-1.0.tar.gz" } ] }