Skip to main content

No project description provided

Project description

NsmPy Version 1.0.3: What's new and how do I use it?

NsmPy is a big little python library designed to make scientific, mathematical, and numerical equations easier to grasp. This module, as of this version (release 1.0.3) only contains one datatype - matricies. (more will be comming soon hopefully.)

Installation

NsmPy is availiable via the pip command. However, there is one other library needed - NumPy. I highly recommend using NumPy version 1.16.1 because it is the most stable. Installing this version will be covered in the installation steps.

Install with:

(mac/linux)
#$ sudo pip uninstall numpy
#$ sudo pip install numpy==1.16.1
#$ sudo pip install nsmpy==1.0.2
(PC)
#C:> pip uninstall numpy
#C:> pip install numpy==1.16.1
#C:> pip install nsmpy==1.0.2

What's new?

This update does not add much to the library other than bug fixes. datatype.

Using the library

The NsmPy library offers lots of different features for the matrix datatype - you can run callbacks on the elements, you can reshape matricies, and you can even treat the class like a list!

First off, how do you create a matrix? It's as simple as typing

from nsmpy import matrix
x = matrix([1,2,3,4],shape=(2,2))

Just like that we just created a 2x2 matrix! It's that simple! We can also do matrix multiplication - a common mathematical practice when working with matricies. We can do this with the following code:

from nsmpy import matrix
x = matrix([2,3,4,5],shape=(2,2))
y = matrix([3,4,5,6],shape=(2,2))

z = x.matrix_mult(y) # matrix_mult(n) -> matrix()

That's it! When you actually compare this library to the NumPy library, you will see that it is a much better option for matricies. Here is an example of defining matricies in both modules. NumPy:

mat = np.array([[2,2],
                [2,2]])

NsmPy:

mat = matrix([2,2,2,2],(2,2))

As you can see, the NumPy version, while being excellent, just doesn't look as good as the NsmPy version. It also is less efficient due to more typing being needed.

Method documentation

matrix(array, shape)                  -> matrix
matrix.reshape(new_shape)             -> matrix{new shape}
matrix.flatten()                      -> matrix{new shape}
matrix.add_element(element,new_shape) -> matrix{el+1, new shape}
matrix.get_type()                     -> dtype
matrix.matrix_mult(b_mat,a_mat=None)  -> matrix{new shape, new values}
matrix.as_numpy_array()               -> np.array(matrix)
matrix.multiply(mat_b,mat_a=None)     -> matrix{new values, a_matrix shape}
matrix.convert_to_list()              -> list{matrix elements}
matrix.inverse()                      -> matrix{inverse elements}
matrix.generate_identity(r,c,start)   -> matrix{identity matrix}
matrix.run_function_on_elements(func) -> matrix{other elements}
matrix.convert_type(new_type)         -> matrix{new type}
matrix.shape                          -> shape
matrix.as_array                       -> array-type matrix
matrix.temp                           -> nothing to see here
matrix.type                           -> the current matrix type.

Have fun!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nsmpy-1.0.3.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nsmpy-1.0.3-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file nsmpy-1.0.3.tar.gz.

File metadata

  • Download URL: nsmpy-1.0.3.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for nsmpy-1.0.3.tar.gz
Algorithm Hash digest
SHA256 f2b93a81f85ee2767b248aab67cd42bf93c5e7696ce0fcf9a05102931a56eb54
MD5 ebab08f32eed7228035c14a1219a5dd1
BLAKE2b-256 5ce3b0e64086fc3272261215564955d90bf86eed76f69b7effaa6532a671bf6f

See more details on using hashes here.

File details

Details for the file nsmpy-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: nsmpy-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for nsmpy-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6ba1874983596d0600d02c2063dd1fff56aa8da275dbe911bd2a164f700e1edb
MD5 e70fea3949b3b9f66cdbe97f4ee21f04
BLAKE2b-256 9a025e01e5dd6b40370861e1c67c51e74b37705b889cb92691a3800241973e57

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page