PyPoSolver
PyPoSolver is a Python library for performing mathematical and physics calculations, including numerical integration, root-finding, linear algebra operations, and basic mechanics.
Installation
pip install pyposolver
Usage
Mathematics
Integration
Use the trapezoidal_rule function to perform numerical integration:
from pyposolver.maths.integration import trapezoidal_rule
def f(x):
return x**2
result = trapezoidal_rule(f, 0, 1, 100) # Integrate f(x) from 0 to 1 using 100 intervals
print(result) # Expected: 0.333...
Root-Finding
- Bisection Method
Use bisection_method to find the root of a function within a specified interval:
from pyposolver.maths.root_finding import bisection_method
def f(x):
return x**2 - 4
root = bisection_method(f, 0, 3) # Find root of f(x) in the interval [0, 3]
print(root) # Expected: 2.0
- Newton-Raphson Method
Use newton_raphson_method for root-finding with an initial guess and the function's derivative:
from pyposolver.maths.root_finding import newton_raphson_method
def f(x):
return x**3 - 2*x - 5
def df(x):
return 3*x**2 - 2
root = newton_raphson_method(f, df, 2) # Initial guess: 2
print(root) # Expected: 2.094...
Linear Algebra
- Dot Product
Calculate the dot product of two vectors:
from pyposolver.maths.linear_algebra import dot_product
vector1 = [1, 2, 3]
vector2 = [4, 5, 6]
result = dot_product(vector1, vector2)
print(result) # Expected: 32
- Cross Product
Compute the cross product of two 3D vectors:
from pyposolver.maths.linear_algebra import cross_product
vector1 = [1, 2, 3]
vector2 = [4, 5, 6]
result = cross_product(vector1, vector2)
print(result) # Expected: [-3, 6, -3]
- Matrix Multiplication
Multiply two matrices:
from pyposolver.maths.linear_algebra import matrix_multiply
matrix1 = [[1, 2], [3, 4]]
matrix2 = [[5, 6], [7, 8]]
result = matrix_multiply(matrix1, matrix2)
print(result) # Expected: [[19, 22], [43, 50]]
Physics
- Velocity
Calculate velocity given initial velocity, acceleration, and time:
from pyposolver.physics.mechanics import velocity
initial_velocity = 5
acceleration = 2
time = 3
result = velocity(initial_velocity, acceleration, time)
print(result) # Expected: 11
- Force
Calculate force using mass and acceleration:
from pyposolver.physics.mechanics import force
mass = 10
acceleration = 5
result = force(mass, acceleration)
print(result) # Expected: 50
Metadata
Release files for pyposolver 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyposolver-0.2.tar.gz | 8.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyposolver-0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.8 kB
Release files / pyposolver-0.2.tar.gz
| Download URL | pyposolver-0.2.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b3cdaf02770da753fa6cf7bf6247cfb0e751c5e072b85ff6173e3b054dc0191d
|
|
BLAKE2b-256 checksum How to use checksums |
4a1a3a72415ba7fa2b67a312579e5392bf9549e2e833e037b727290b58ab10b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Release files / pyposolver-0.2-py3-none-any.whl
| Download URL | pyposolver-0.2-py3-none-any.whl |
|---|---|
| Size | 11.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad475ba17a1937f102746c736d6826db1526f73f25aefc9967faa581513374d6
|
|
BLAKE2b-256 checksum How to use checksums |
e3d7b442509899300789c495ce5485c9f5d8d2b75a5a7c5cbbc2c18d63e0bb47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|