This is a library designed to solve systems of linear equations using the cramer solution method.
Project description
Cramer
A library designed to solve systems of linear equations using the cramer solution method.
In order to function correctly, it is necessary to have a system with the same number of unknowns as equations.
Functions:
matr:
generates an n-dimensional matrix with the matrices from which the different coefficients will be extracted. The first matrix inside the array corresponds to the "original" delta
delta:
receives a matrix as input and returns a coefficient, calculated by subtracting the products obtained by the cross multiplication.
Example Code:
#import numpy, cramer and creates a matrix with the factors to which each unknown number is multiplied and at the end of each row it adds the result of the linear equation
import numpy as np
from cramer import cramer
b = [[2 , 4 , 9 , 2],
[4 , 7 , 2 , 3],
[9 , 5 , 3 , 1]]
b = np.asarray(b)
# create an instance of the cramer class
cr = cramer(b)
#gets an array with the matrices corresponding to each coefficient
mds = cr.matr()
# generate a list with the coefficients obtained in each matrix after using the matr() method
deltas = []
for i in mds:
deltas.append(cr.delta(i))
# to obtain the values of each unknown, divide the different coefficients obtained by the first one, corresponding to that of the matrix of unknowns
for i in range(1 , len(deltas)):
print("Variable" , i , ":")
print(deltas[i] / deltas[0])
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
cramer-0.0.0.tar.gz
(2.8 kB
view details)
Built Distribution
File details
Details for the file cramer-0.0.0.tar.gz
.
File metadata
- Download URL: cramer-0.0.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/22.3.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cf390599963c5bdfecb5ecd52347d5c86c20c2296385a7ccd4f5aacdf81aaa7 |
|
MD5 | f1d520e43bb1ab94c7e44d7bcab4e9ff |
|
BLAKE2b-256 | c1e7de49e4e8466b20640e7d5a6c59f823832a4ea5c57136793a44b57765c323 |
File details
Details for the file cramer-0.0.0-py3-none-any.whl
.
File metadata
- Download URL: cramer-0.0.0-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/22.3.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fef068ae798d7a9ddfc881028d535046a5b47c47db6dbdfd0d288b084a312de3 |
|
MD5 | d48186ec15ca54e6362e51c1a105c7d6 |
|
BLAKE2b-256 | cd651c7292e9676ad79bdbcc065346cc74fb616957f2155344a6c50da2cb69eb |