Skip to main content

A package to solve the sum of min/max equations

Project description

solve-sum-minmax is used to solve a sum of min/max equations in python by using numerical methods. For instance, say you want to solve this equation: min(400, 500x) + min(200, 500x) + min(0, 500x) = 700 with the assumption that x is within range (0, 1).
In Math, the rigorous way would require you to set up all possible conditions, which might result in huge computation. Currently, there isn't any available packages in Python that allows you to solve this kind of equation fastly with minimum codes. Thus, this package is developed to fill the void and hopefully be of use to the broad population.
example: say you want to find the solution for the equation min(500, 600a) + max(400, 500a) = 500

from solve-sum-minmax import solve
>>> eq = "min(500, 600*a) + max(400, 500*a)"
>>> value = 500
>>> solve.solve_sum_minmax(eq, value)
0.16666

What's new in 0.0.2:

  1. you can put the variable either in the first place inside the parenthesis or in the second place.

  2. you can use [a-z] for the variable.

  3. you can use min and max together in one equation.

  4. you can use + or -.

  5. you can have constants in front of min or max, such as 2min(400, 400a).

  6. you can specify the magnitude of accuracy for your result (precision to how many decimal places).

current version: 0.0.2
email: yz4175@columbia.edu
disclaimer: this package is still under development, the current version only has very limited functionality
collaboration: collaborations are welcomed, please send me an email if you are interested.

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

solve-sum-minmax-0.0.2.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

solve_sum_minmax-0.0.2-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file solve-sum-minmax-0.0.2.tar.gz.

File metadata

  • Download URL: solve-sum-minmax-0.0.2.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.2

File hashes

Hashes for solve-sum-minmax-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d56d93a42fbb135f93cc2aa57891688c573c9d576945fa648a1a327f34f31566
MD5 efb7fad207bb75f20ad61373f5da5851
BLAKE2b-256 867c7d00a12a8b5351d77cb75b0fe7f1a3bf103f56507e535b06527cbe615790

See more details on using hashes here.

File details

Details for the file solve_sum_minmax-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: solve_sum_minmax-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.2

File hashes

Hashes for solve_sum_minmax-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a99a9db397c78069fc02b4a04280a6d982359ccd88e16407f5d604c7b7a00f0f
MD5 dcf5af0306562d2cf8ddc01b20463c3d
BLAKE2b-256 19cc6d0a089bc453639c945143f1ce7b91c93c0d0663e1e52f0d6aa9e5240cd6

See more details on using hashes here.

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