# pysolvemath
Numeric Solver.
## Usage
### Real-valued Equations
```python
from pysolvemath import solve_equations
def equations(x, y):
x + y == 10
2 * x == 8
res = solve_equations(equations)
# res == {"x": 4.0, "y": 6.0}
```
By default, result are of type `float`, representing arbitrary real numbers.
Caller can use type hint of `int` and `fractions.Fraction` to specify unknown to "corerce" to that type.
```python
from fractions import Fraction
from pysolvemath import solve_equations
def equations(x: int, y, z: Fraction):
x + z == 1.5
x**2 == 9
y + z == 2
res = solve_equations(equations)
# res == {"x": 3, "y": 3.5, "z": -3/2}
```
As this is a numerical solver, this package only gets one (set of) root depending on starting point.
In the example above, we can also derive `{"x": -3, "y": -2.5, "z": 9/2}`, if we start the root finder from negative `x`.
User can proivde `init_guess_func` to specify the starting point.
Raw data
{
"_id": null,
"home_page": "https://github.com/yx-z/pysolvemath",
"name": "pysolvemath",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "David",
"author_email": "yx.z@hotmail.com",
"download_url": "https://files.pythonhosted.org/packages/59/78/4c03bc45f08def41caad685b38ccce0f0d4449326a633c1526cde769226f/pysolvemath-0.3.tar.gz",
"platform": null,
"description": "# pysolvemath\r\nNumeric Solver.\r\n\r\n## Usage\r\n\r\n### Real-valued Equations\r\n\r\n```python\r\nfrom pysolvemath import solve_equations\r\n\r\ndef equations(x, y):\r\n x + y == 10\r\n 2 * x == 8\r\n\r\n\r\nres = solve_equations(equations) \r\n# res == {\"x\": 4.0, \"y\": 6.0}\r\n```\r\n\r\nBy default, result are of type `float`, representing arbitrary real numbers.\r\n\r\nCaller can use type hint of `int` and `fractions.Fraction` to specify unknown to \"corerce\" to that type. \r\n\r\n```python\r\nfrom fractions import Fraction\r\nfrom pysolvemath import solve_equations\r\n\r\ndef equations(x: int, y, z: Fraction):\r\n x + z == 1.5\r\n x**2 == 9\r\n y + z == 2\r\n\r\nres = solve_equations(equations)\r\n# res == {\"x\": 3, \"y\": 3.5, \"z\": -3/2}\r\n```\r\n\r\nAs this is a numerical solver, this package only gets one (set of) root depending on starting point.\r\n\r\nIn the example above, we can also derive `{\"x\": -3, \"y\": -2.5, \"z\": 9/2}`, if we start the root finder from negative `x`.\r\n\r\nUser can proivde `init_guess_func` to specify the starting point.\r\n",
"bugtrack_url": null,
"license": "",
"summary": "Numeric Solver.",
"version": "0.3",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7fd66f3a6724e381025402d6735f555d07a992f183c478d5afe7c8069b5b9fb1",
"md5": "10456547632abbe3654ab7902af6d424",
"sha256": "6a82f23eb642270432b025601e6a777c3b6bb9be93c17a29cd02c433fd9eebb8"
},
"downloads": -1,
"filename": "pysolvemath-0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "10456547632abbe3654ab7902af6d424",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7408,
"upload_time": "2023-02-06T01:19:33",
"upload_time_iso_8601": "2023-02-06T01:19:33.563030Z",
"url": "https://files.pythonhosted.org/packages/7f/d6/6f3a6724e381025402d6735f555d07a992f183c478d5afe7c8069b5b9fb1/pysolvemath-0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "59784c03bc45f08def41caad685b38ccce0f0d4449326a633c1526cde769226f",
"md5": "aeed110ab03c80475b83e848af383ebf",
"sha256": "d0525ba06612f0492f82bf4b923d1bf6adb1246c53a69b3b81f9ab73cbddfab7"
},
"downloads": -1,
"filename": "pysolvemath-0.3.tar.gz",
"has_sig": false,
"md5_digest": "aeed110ab03c80475b83e848af383ebf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6381,
"upload_time": "2023-02-06T01:19:34",
"upload_time_iso_8601": "2023-02-06T01:19:34.976169Z",
"url": "https://files.pythonhosted.org/packages/59/78/4c03bc45f08def41caad685b38ccce0f0d4449326a633c1526cde769226f/pysolvemath-0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-02-06 01:19:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "yx-z",
"github_project": "pysolvemath",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "scipy",
"specs": []
},
{
"name": "numpy",
"specs": []
}
],
"lcname": "pysolvemath"
}