Skip to main content

SingleVariableExpressionParser Build Status

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.

Release files for single-variable-expression-parser-ALIEZZAT 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for single-variable-expression-parser-ALIEZZAT 0.0.2
File Size Uploaded
single-variable-expression-parser-ALIEZZAT-0.0.2.tar.gz 4.8 kB Details

Release files / single-variable-expression-parser-ALIEZZAT-0.0.2.tar.gz

Download URL single-variable-expression-parser-ALIEZZAT-0.0.2.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e6c846731e2b020add24e0c12fca32bf963e85a58579e56d8539bd41e14a9ce7
BLAKE2b-256 checksum
How to use checksums
d1debbb5cf246467afffebc80418ac66867ac15df88dce86c2135c37107ea154
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page