Solve-sum-minmax

Latest version: v0.1.1

Safety actively analyzes 682387 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

7.1

* **Accurate**: it handles exact Rational numbers and intervals.
* **Flexible**:you have a lot of flexibility in defining your equation,
see below.
****
**Format guide**:
Because the module depends heavily on regular expressions, please follow
the guide on how to define your equations carefully, or the module might break.
In a nutshell, wrap the equation you want to solve in a string with the format
similar to the example:

>>> eq = "20 + max(600*a, 400) + min(200*a, 500) + min(100, 300*a) + 50*a = 600"

Before we delve into explanations in details, let's define a few terms:
* **value_term**: the value you want to solve your equation for, here it's `600`.
* **minmax_term**: it is what it means in English, for example, `max(600*a, 400)`.
* **cons_var_term**: terms with constants times variables, such as `50*a`.

In brief, what you **can** do include:
* put the variable either in the 1st or 2nd place inside the parenthesis, for
example, either `min(200, 300*a)` or `min(300*a, 200)` is fine.
* use min and max together in one equation.
* use + and/or -.
* have constants in front of min or max, such as `2*min(400, 400a)`.
* have any space between each component.
* have leading 0s before variable, such as `min(0*a, 200)`.
* have constants inside min or max, such as `min(20, 30)`.

What you **can't** do include:
* use `==` instead of `=`.
* for the `cons_var_term`, have variables before constants, such as `a*50`
instead of `50*a`.
* missing any parenthesis.
* use other operators instead of + or -.
* missing any necessary `*` operator for each variable.
* put any constants on the left-hand side of the equation. Do me a favor, if
you have any constants, subtract it from the right-hand side and
rearrange your terms before using the module.
****
**Limitations**:
* Currently, the module only supports `"a"` as the variable.
* Because the module heavily depends on regular expressions,
the user needs to follow the format of the
equation carefully, or the module might break.
* The equation must be uni-variate, i.e., there can only be one independent
variable.
****
**Version history**:
Version | Core Ideas | Return Rationals | Return Intervals
------------ | ------------- | ------------- | -------------

0.1.0

****
**Contact**:
* **Email**: yz4175columbia.edu
* **Collaboration**: collaborations are welcomed, please email me if you
are interested.

0.0.4

****
**Contact**:
* **Email**: yz4175columbia.edu
* **Collaboration**: collaborations are welcomed, please email me if you
are interested.

0.0.3

* Now the module is able to return exact values as fractions, such as 1/6.
* When there isn't a solution, the function would return `None`.
* you can put the variable either in the first place inside the parenthesis
or in the second place.
* you can use any characters in the alphabet except `"m"` for the variable.
* you can use min and max together in one equation.
* you can use + or -.
* you can have constants in front of min or max, such as 2*min(400, 400a).
****
**Limitations**:
* One of the biggest limitations now is when there are infinitely many solutions,
the module cannot handle it well and would only return a single real number.
* Because the module is written in a way that it heavily depends on regular
expressions, it currently doesn't support `"m"` as user-defined variable name.
* With the reason same as above, the user needs to follow the format of the
equation carefully, or the module might break.
* The equation must be univariate, i.e., there can only be one independent
variable.
****
**Contact**:
* **Email**: yz4175columbia.edu
* **Collaboration**: collaborations are welcomed, please send me an email if you
are interested.

0.0.2

0.0.1

Links

Releases

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.