A Python library for mathematical and physics calculations.
Project description
pyposolver
pyposolver is a Python library for mathematical and physics calculations. It provides functions for various mathematical operations and physics calculations, including numerical methods, integration, root-finding, linear algebra, and more.
Installation
You can install pyposolver using pip:
pip install pyposolver
Usage
Numerical Methods
Bisection Method
from pyposolver.maths.root_finding import bisection_method
Define a test function
def f(x): return x3 - 6*x2 + 11*x - 6
Find the root of f(x) = x^3 - 6x^2 + 11x - 6 in the interval [1, 3]
root = bisection_method(f, 1, 3) print("Root:", root)
#### Newton-Raphson Method
```python
from pyposolver.maths.root_finding import newton_raphson_method
# Define a test function and its derivative
def f(x):
return x**3 - 6*x**2 + 11*x - 6
def df(x):
return 3*x**2 - 12*x + 11
# Find the root of f(x) = x^3 - 6x^2 + 11x - 6 with an initial guess of 2
root = newton_raphson_method(f, df, 2)
print("Root:", root)
Integration
Trapezoidal Rule
from pyposolver.maths.integration import trapezoidal_rule
# Define a test function
def f(x):
return x**2
# Integrate f(x) = x^2 from 0 to 1 using the trapezoidal rule
result = trapezoidal_rule(f, 0, 1)
print("Result of integration:", result)
Linear Algebra
Dot Product
from pyposolver.maths.linear_algebra import dot_product
# Define two vectors
vector1 = [1, 2, 3]
vector2 = [4, 5, 6]
# Calculate the dot product of the two vectors
result = dot_product(vector1, vector2)
print("Dot Product:", result)
Physics Calculations
Velocity
from pyposolver.physics.mechanics import velocity
# Calculate the final velocity using the kinematic equation: v = u + at
initial_velocity = 10 # m/s
acceleration = 2 # m/s^2
time = 5 # seconds
final_velocity = velocity(initial_velocity, acceleration, time)
print("Final Velocity:", final_velocity)
Electric Field Strength
from pyposolver.physics.electromagnetism import electric_field_strength
# Calculate the electric field strength due to a point charge
charge = 2e-6 # Coulombs
distance = 0.1 # meters
electric_field = electric_field_strength(charge, distance)
print("Electric Field Strength:", electric_field)
Contributing
Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue on GitHub or submit a pull request.# pyposolver-prod
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
Built Distribution
File details
Details for the file pyposolver-0.1.tar.gz
.
File metadata
- Download URL: pyposolver-0.1.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b30f53b4983644c0fc25b966a6eed23a90e824c252c75862dfd48292636368d7 |
|
MD5 | 75967b7b0dde530fb2387defc9446b87 |
|
BLAKE2b-256 | c2155c4ed1806111246499cc627382a28d20c646bb5ba002c3726aa520fcc227 |
File details
Details for the file pyposolver-0.1-py3-none-any.whl
.
File metadata
- Download URL: pyposolver-0.1-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb8b29e65035b927a63866aa1537b1888ea9ad243151f5d7659bff26c6084cd9 |
|
MD5 | f36fd24e0cac06c43400e484f432a248 |
|
BLAKE2b-256 | 068d072f68842daf95caa367f6ae01f1af28067aed0dfb6f947e617094d6deea |