{"id":19924569,"url":"https://github.com/artemis-beta/equatic","last_synced_at":"2025-07-02T21:34:21.339Z","repository":{"id":81705979,"uuid":"81878754","full_name":"artemis-beta/equatic","owner":"artemis-beta","description":"Safe Equation String Parser Project via Sympy and Numpy","archived":false,"fork":false,"pushed_at":"2020-06-17T23:09:49.000Z","size":154,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-01T10:26:35.923Z","etag":null,"topics":["equation","parse","plot","python","string-equation-parser","sympy"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/artemis-beta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-13T22:29:35.000Z","updated_at":"2020-06-17T23:09:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"27c5cbf4-0e76-4e8c-a6e4-ead9b0f72fdd","html_url":"https://github.com/artemis-beta/equatic","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/artemis-beta/equatic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artemis-beta%2Fequatic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artemis-beta%2Fequatic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artemis-beta%2Fequatic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artemis-beta%2Fequatic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/artemis-beta","download_url":"https://codeload.github.com/artemis-beta/equatic/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artemis-beta%2Fequatic/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263219047,"owners_count":23432598,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["equation","parse","plot","python","string-equation-parser","sympy"],"created_at":"2024-11-12T22:18:05.933Z","updated_at":"2025-07-02T21:34:21.307Z","avatar_url":"https://github.com/artemis-beta.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EquatIC v1.0.4\nEquatic is a string equation parser which utilises the Sympy and Numpy libraries to evaluate equations for a given set of values, the two aims being to include more functions than those included in other methods and to evaluate values without the risk of 'danger' which is currently present within these. \n\n## Installation\n\nThere are two methods for installing EquatIC at present. You can either use `pip` from the package folder:\n\n`pip install -r requirements.txt`\n\nor you can run the setup script:\n\n`python setup.py`\n\nto ensure EquatIC is behaving as expected you may also wish to run the included tests:\n\n`python setup.py test`\n\nboth methods install EquatIC as well as the other python packages it requires to run.\n\n## Quick Use\nYou can quickly parse either a single value or range of values using the following syntax:\n\n`equatic.parse('npdf(x)', 0.5)`\n\nIn the case of using a value range either a length 2 or length 3 list can be given where the third argument is the optional number of points to calculate.\n\n`equatic.parse('npdf(x)', [-0.5, 0.5])`\n\nor\n\n`equatic.parse('npdf(x)', func_range=[-0.5, 0.5, 100], debug='ERROR')`\n\n## Creating a Parser\nBelow is an example of how the parser can be used, here a set of x values is generated using Numpy and then handed to the parser with the function then being parsed after. The x value set is not compulsary however when a set is specified the `parse_equation_string` method will return the resultant values for f(x). \n\n```\nfrom equatic import EquationParser      \nimport numpy as np\n\n\n# Create a set of x values between -5pi and 5pi\n\nx = np.linspace(-5*np.pi, 5*np.pi, 1000)\n\n# Create a parser object giving the generated x values\n\nparser = EquationParser( 'my parser'           ,\n                          xarray     =  x      , \n                          log        =  'ERROR'\n                       )\n\n# Finally tell the parser the equation to process\n\ny = parser.parse_equation_string('sinc(x)')\n\n\n# Use MatplotLib to plot the results!\n\nimport matplotlib.pyplot as plt\nplt.plot(x, y)\nplt.show()\n```\n\n## Evaluating the Equation for a Single Value\nOnce the parser has been given an equation to process it can then evaluated it for a single value/list of values outside of initialisation.\n\n`parser.calculate(0.5)`\n`parser.calculate([0.5, 0.6, 0.7])`\n\n## Specifying Logging Detail\nBy default EquatIC parsers are set to be run with the logging level set to 'INFO'. This can be specified either when initialising the parser itself or after using the function:\n\n`parser.set_logger_level('DEBUG')`\n\nfor a full list of options see the documentation for the `logging` python module.\n\n## EquatIC Console App\nCurrently in early development but available in this version is the console application which can currently be found in the `equatic` directory as `equatic_app.py` within the main package folder. The command to run the application can itself take options:\n\n- `--verbose` or `-v` sets the logging option to `DEBUG`\n- `--info` or `-i` sets the logging option to `INFO`\n- `--save` or `-s` saves the output within the session\n- `--saveas` or `-o` does the same as the above but allows the user to specify an output file name\n\n`python equatic_app.py --verbose --saveas 'my_session.log'`\n\n```\nEquatIC[0]: tan(1)\n1.55740772465\nEquatIC[1]: cos(1)\n0.540302305868\n```\n\nthe session is exited using `quit` or `q`.\n\n## Plotting Functions\nEquatIC includes a function for plotting via MatplotLib:\n```\nequatic.plot(equation_string, func_range=[0.1, 10], xlabel='x', ylabel='y', debug='ERROR', plot_opts = '-', save=None, show=True, title=None)\n```\nFor example if we wanted to plot the function `tan(x-1)` in the range `[0,3.14]` we would do the following:\n```\nequatic.plot(   'tan(x-1)'                                      , \n                [0,3.14]                                        ,\n                xlabel    = 'x'                                 ,\n                ylabel    = 'f(x)'                              , \n                title     = r\"Plot of the Function '$tan(x-1)$'\",\n                plot_opts = 'o'                                 , \n                save      = 'my_plot.png'                       )\n```\nNote EquatIC maintains MatplotLib's support of LaTeX strings for titles.\n\n## Add Your Own Functions\nEquatIC parsers can be expanded to include additional single argument functions using the `add_function` method. \n\nFor example say we wanted to add a simple function `quad` which multiplies any number by 4, firstly we define our function:\n```\ndef quad(x):\n    return 4*x\n```\nthen we add it to the parser's functions library:\n```\nparser.add_function('quad', quad)\n```\nwe can now perform calculations using it:\n```\nparser.parse_equation_string('quad(x)')\nparser.plot()\n```\n| Branch  | Tests |\n|---|---|\n| Master | [![CircleCI](https://circleci.com/gh/artemis-beta/equatic/tree/master.svg?style=svg)](https://circleci.com/gh/artemis-beta/equatic/tree/master)|\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartemis-beta%2Fequatic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartemis-beta%2Fequatic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartemis-beta%2Fequatic/lists"}