New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pyposolver

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pyposolver

A Python library for mathematical and physics calculations.

  • 0.2
  • PyPI
  • Socket score

Maintainers
1

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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc