A package for parsing mathmatical expressions
Project description
SingleVariableExpressionParser 
Python package for parsing single variable mathmatical expressions.
Table of supported math operations:
| Operation | Syntax | # of operands |
|---|---|---|
| Addition | + | 2 |
| Subtraction | sub | 2 |
| Multiplication | * | 2 |
| Division | / | 2 |
| L.Parantheses | ( | >=1 |
| R.Parantheses | ) | >=1 |
| sin | sin | 1 |
| cos | cos | 1 |
| tan | tan | 1 |
| seq | seq | 1 |
| csc | csc | 1 |
| cot | cot | 1 |
| power | ^ | 2 |
| square root | sqr | 1 |
| minus | - | 1 |
Install
To install the package using pip:
pip install single-variable-expression-parser-ALIEZZAT
Usage
Import the module as the following:
from math_expression_parser.single_variable_parser import SingleVariableParser
Then it should be used as:
parser = SingleVariableParser()
parser.set_math_function_text('sqr(16)+1') # For constant expression
result = parser.compute_function_at_value(0) # Here input has no effect on result since it is constant
print(result) # 5 will be printer
parser = SingleVariableParser()
parser.set_math_function_text('x*2+x^2+5')
result = parser.compute_function_at_value(4) # Value of x will be 4
print(result) # 29 will be printed
Running unit tests
Run python3 -m unittest discover to execute the unit tests via unittest.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file single-variable-expression-parser-ALIEZZAT-0.0.2.tar.gz.
File metadata
- Download URL: single-variable-expression-parser-ALIEZZAT-0.0.2.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6c846731e2b020add24e0c12fca32bf963e85a58579e56d8539bd41e14a9ce7
|
|
| MD5 |
fd1de2940885241e0b8237ece1167ea9
|
|
| BLAKE2b-256 |
d1debbb5cf246467afffebc80418ac66867ac15df88dce86c2135c37107ea154
|