Skip to main content

Numerica

PyPI version

My own experimental implementations of numerical methods as homework.
Use documentation to see how to use, and check test.py for real examples.

Table of Contents

Usage

python >= 3.8 is required

Importing

import numerica as n
from numerica import f // function definition
from numerica import m // matrix definition

Function Definition

f('expression')

fx = f('3x^2 + 2x + 3')
fx(2)

Matrix Definition

m(
    a11, a12, a13;
    a21, a22, a23;
    a31, a32, a33
)

matrix = m('1,2,3; 4,5,6; 7,8,9');

Documentation

1- Solving Nonlinear Equations

Root Bracketing Methods

Graph

n.nl_graph(fx, dx, epsilon, x)

Bisection

n.nl_bisection(fx, epsilon, a, b)

Regula-Falsi

n.nl_regulafalsi(fx, epsilon, a, b)

Iterative Methods

Fixed-Point Iteration

n.nl_fixedpoint(hx, epsilon, x)

Newton-Raphson

n.nl_newtonraphson(fx, epsilon, x)

Secant

n.nl_secant(fx, epsilon, x0, x1)

2- Matrix Operations

Basic Operations

Matrix Definition

m(
    a11, a12, a13;
    a21, a22, a23;
    a31, a32, a33
)

Identity Matrix

n.m_id(n)

Size of Matrix

(m, n) = n.m_size(A)

Transpose of a Matrix

n.m_transpose(A)

Finding Inverse of a Matrix

Gauss-Jordan Method

n.mi_gaussjordan(A)

Matrix Utils

Concat Matrices by Row (Horizontal)

n.m_rowconcat(A, B)

Concat Matrices by Column (Vertical)

n.m_colconcat(A, B)

Map a Row of Matrix

n.m_rowmap(A, i, iteratee)

Map all Matrix Cells

n.m_cellmap(A, iteratee)

Is Matrix Check

n.is_matrix(A)

Slice Matrix Vertically

n.m_rowslice(A, start, stop, step)

3- Solving Systems of Linear Equations

Gauss Elimination

n.ls_gauss(A, C)

Jacobi

n.ls_jacobi(A, C, X, epsilon=0.001)

Gauss-Seidel

n.ls_gaussseidel(A, C, X, epsilon=0.001)

4- Solving Systems of Nonlinear Equations

5- Numerical Integration

Trapezoidal

n.itg_trapezoidal(fx, x0, xn, n)

Simpson

n.itg_simpson(fx, x0, xn, n)

6- Numerical Differentiation

Euler Methods

Backward

n.diff_backward(fx, x)

Forward

n.diff_forward(fx, x)

Midpoint

n.diff_midpoint(fx, x)

7- Finite Differences

Determine Degree of a Polynomial

n.fd_degree(pair_tuples)
n.fd_degree([(x0,y0), (x1,y1), (x2,y3), ...])

8- Interpolation

Lagrange

n.itp_lagrange(pair_tuples)
n.itp_lagrange([(x0,y0), (x1,y1), (x2,y3), ...], x)

9- Regression

Least Squares

n.reg_leastsquares(pair_tuples)
n.reg_leastsquares([(x0,y0), (x1,y1), (x2,y3), ...], x, deg)

Resources

Testing Package

Test Directly as Script
python3.8 -m numerica
or Install Package Locally (from repo root dir)
pip3.8 install .
and Test It from REPL
import numerica as n
# ...
or Use test.py Interactively
python3.8 -i test.py
# ...
or Just Test and Exit
python3.8 test.py

Uploading to PyPI

Install Twine
pip3.8 install twine
Build
rm -rf build & rm -rf dist & rm -rf numerica.egg-info
python3.8 setup.py sdist bdist_wheel
Upload
twine upload dist/*

Metadata

Release files for numerica 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for numerica 0.3.1
File Size Uploaded Provenance Actions
numerica-0.3.1.tar.gz 11.5 kB Without provenance Details for numerica-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for numerica 0.3.1
File Interpreter ABI Platform Actions
numerica-0.3.1-py3-none-any.whl Python 3 none any Details for numerica-0.3.1-py3-none-any.whl

Total release size: 27.3 kB

Release files / numerica-0.3.1.tar.gz

Download URL numerica-0.3.1.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8a577386456df2eb117645d484869ba2168352ad886b25d1402bab5bedfe6198
BLAKE2b-256 checksum
How to use checksums
62d7767af59aaf1739db8d52609d5669da46c13936e4102ca275c8a89c915c57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

Release files / numerica-0.3.1-py3-none-any.whl

Download URL numerica-0.3.1-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ddd1fbd982535d3e671ab213770bf7007b513fd7ffc6d548248d20ad2d763ff5
BLAKE2b-256 checksum
How to use checksums
539d133508e3f0a83227f8845f6149d9ae18619a5266cef106330801a93504c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

Security for numerica 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page