Package: numerica
NumericaMy own experimental implementations of numerical methods as homework.Usedocumentationto see how to use, and checktest.pyfor real examples.Table of ContentsUsageImportingFunction DefinitionMatrix DefinitionDocumentation1- Solving Nonlinear EquationsRoot Bracketing MethodsGraphBisectionRegula-FalsiIterative MethodsFixed-Point IterationNewton-RaphsonSecant2- Matrix OperationsBasic OperationsDefinitionCreating an Identity Matrix by nGetting Dimensions of a MatrixTranspose of a MatrixFinding Inverse of a MatrixGauss-Jordan MethodMatrix UtilsConcat Matrices by Row (Horizontal)Concat Matrices by Column (Vertical)Map a Row of MatrixMap all Matrix CellsIs Matrix CheckSlice Matrix Vertically3- Solving Systems of Linear EquationsGauss EliminationJacobiGauss-Seidel4- Solving Systems of Nonlinear Equations5- Numerical IntegrationTrapezoidalSimpson6- Numerical DifferentiationEuler MethodsBackwardForwardMidpoint7- Finite DifferencesDetermine  Degree of a Polynomial8- InterpolationLagrange9- RegressionLeast SquaresResourcesTesting PackageUploading to PyPIUsagepython >= 3.8 is requiredImportingimport numerica as n
from numerica import f // function definition
from numerica import m // matrix definitionFunction Definitionf('expression')

fx = f('3x^2 + 2x + 3')
fx(2)Matrix Definitionm(
    a11, a12, a13;
    a21, a22, a23;
    a31, a32, a33
)

matrix = m('1,2,3; 4,5,6; 7,8,9');Documentation1- Solving Nonlinear EquationsRoot Bracketing MethodsGraphn.nl_graph(fx, dx, epsilon, x)Bisectionn.nl_bisection(fx, epsilon, a, b)Regula-Falsin.nl_regulafalsi(fx, epsilon, a, b)Iterative MethodsFixed-Point Iterationn.nl_fixedpoint(hx, epsilon, x)Newton-Raphsonn.nl_newtonraphson(fx, epsilon, x)Secantn.nl_secant(fx, epsilon, x0, x1)2- Matrix OperationsBasic OperationsMatrix Definitionm(
    a11, a12, a13;
    a21, a22, a23;
    a31, a32, a33
)Identity Matrixn.m_id(n)Size of Matrix(m, n) = n.m_size(A)Transpose of a Matrixn.m_transpose(A)Finding Inverse of a MatrixGauss-Jordan Methodn.mi_gaussjordan(A)Matrix UtilsConcat Matrices by Row (Horizontal)n.m_rowconcat(A, B)Concat Matrices by Column (Vertical)n.m_colconcat(A, B)Map a Row of Matrixn.m_rowmap(A, i, iteratee)Map all Matrix Cellsn.m_cellmap(A, iteratee)Is Matrix Checkn.is_matrix(A)Slice Matrix Verticallyn.m_rowslice(A, start, stop, step)3- Solving Systems of Linear EquationsGauss Eliminationn.ls_gauss(A, C)Jacobin.ls_jacobi(A, C, X, epsilon=0.001)Gauss-Seideln.ls_gaussseidel(A, C, X, epsilon=0.001)4- Solving Systems of Nonlinear Equations5- Numerical IntegrationTrapezoidaln.itg_trapezoidal(fx, x0, xn, n)Simpsonn.itg_simpson(fx, x0, xn, n)6- Numerical DifferentiationEuler MethodsBackwardn.diff_backward(fx, x)Forwardn.diff_forward(fx, x)Midpointn.diff_midpoint(fx, x)7- Finite DifferencesDetermine Degree of a Polynomialn.fd_degree(pair_tuples)
n.fd_degree([(x0,y0), (x1,y1), (x2,y3), ...])8- InterpolationLagrangen.itp_lagrange(pair_tuples)
n.itp_lagrange([(x0,y0), (x1,y1), (x2,y3), ...], x)9- RegressionLeast Squaresn.reg_leastsquares(pair_tuples)
n.reg_leastsquares([(x0,y0), (x1,y1), (x2,y3), ...], x, deg)ResourcesYTU Numerical Analysis Lecture Noteshttps://mat.iitm.ac.in/home/sryedida/public_html/caimna/index1.htmlTesting PackageTest Directly as Scriptpython3.8 -m numericaor Install Package Locally (from repo root dir)pip3.8 install .and Test It from REPLimport numerica as n
# ...or Use test.py Interactivelypython3.8 -i test.py
# ...or Just Test and Exitpython3.8 test.pyUploading to PyPIInstall Twinepip3.8 install twineBuildrm -rf build & rm -rf dist & rm -rf numerica.egg-info
python3.8 setup.py sdist bdist_wheelUploadtwine upload dist/*