Numeric Solver.
Project description
pysolvemath
Numeric Solver.
Usage
Real-valued Equations
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.
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pysolvemath-0.3.tar.gz
(6.4 kB
view hashes)
Built Distribution
Close
Hashes for pysolvemath-0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a82f23eb642270432b025601e6a777c3b6bb9be93c17a29cd02c433fd9eebb8 |
|
MD5 | 10456547632abbe3654ab7902af6d424 |
|
BLAKE2b-256 | 7fd66f3a6724e381025402d6735f555d07a992f183c478d5afe7c8069b5b9fb1 |