Skip to main content

Math parser for simple and compound strings math expressions evaluations

Project description

pyBigParser

pyBigParser provides a class for parsing long and compound math expresions. You might find it most useful for tasks involving evaluating from single functions to compounds functions.

Installation

pip install pyBigParser

Example

Typical usage often looks like this::

#!/usr/bin/env python

from pybigparser import evaluator

parser = evaluator.MathParser()
parser.set_function("x**2+2*y")
parser.add_sub("x", "24+6*c")
parser.addSub("y", "25 / d")
parser.addSub("c", "1")
parser.addSub("d", "4")

parser.evaluate()

print(parser.value)
print(parser.get_sub_value("x"))
print(parser.get_sub_value("y"))

Supported Functions and Constants

pyBigParser comes with support for evaluating the following functions and constants.

  • cos
  • sin
  • abs
  • log10
  • log
  • exp
  • tan
  • pi
  • e

Versions

  • 1.3 - It saves the values for each sub-function.
  • 1.5 - Fixed OverFlow Error with Exp function.
  • 2.0 - Python 3 support.

Warnings

  • The variables e and pi are reserved for the evaluator.
  • Exceptions for iterative variables are not supported.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyBigParser-2.0.tar.gz (4.0 kB view hashes)

Uploaded Source

Built Distribution

pyBigParser-2.0-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page