Skip to main content

NumpSy - Integrated NumPy, SymPy, SciPy and Pandas with unit management for scientific programming with IPython.

Project description

NumpSy

Straight up mix between NumPy, SymPy and Pandas into a value single-declaration extendable framework to simulatenously perform symbolic and numerical operations.

Objectives:

  1. Ever think you wanted to simultaneously perform numerical and symbolic mathematics for an engineering or optimization derivation? Now you can pretty much intuitively derivate simultaneously whilst performing unit management automatically.
  2. Integrate mathematical analytical derivation Python toolchains into a single handy one that retains and expands each of the constituent packages methods. Retain intuitive compatibility.
  3. Have fun!

Is it any good?

I think it's an elegant mathematical representation to simultanously perform symbolic, numerical, and data science operations into a single system.

Quick Start

Download the Anaconda distribution first.

Pip install:

$ pip install numpsy

Local install for most recent version:

$ git clone https://github.com/daquintero/numpsy.git
$ cd numpsy
$ python3 setup.py install

Quick Example

See the 10 minutes to NumpSy jupyter notebook for much more.

Installation

Import NumpSy

import numpsy as nsy

Units

Declare a Unit

meter = nsy.Unit(name="meter", symbol="m")
meter
Unit
name meter
symbol \begin{equation}m\end{equation}
symbolic_expression \begin{equation}Ø\end{equation}

Retrieve attributes from this Unit

meter.s

$\displaystyle m$

meter.symbol

$\displaystyle m$

meter.name
'meter'

Operate with this unit

farad_per_meter = nsy.Unit(name="Farad", symbol="F") / meter
farad_per_meter
Unit
name (Farad)per(meter)
symbol \begin{equation}Ø\end{equation}
symbolic_expression \begin{equation}\frac{F}{m}\end{equation}

Append to Unit Library

nsy.Units().data
Hertz     Unit       name name_expression               ...
Farad     Unit       name name_expression               ...
meter     Unit       name name_expression               ...
ohm       Unit     name name_expression                 ...
ratio     Unit       name name_expression               ...
second    Unit        name name_expression              ...
Name: 0, dtype: object
nsy.u
Hertz     Unit       name name_expression               ...
Farad     Unit       name name_expression               ...
meter     Unit       name name_expression               ...
ohm       Unit     name name_expression                 ...
ratio     Unit       name name_expression               ...
second    Unit        name name_expression              ...
Name: 0, dtype: object

Constant

e_0 = nsy.Constant(
    name="permittivity_vaccum",
    symbol= "\epsilon_0",
    numerical=8.8541878128e-12,
    unit=farad_per_meter
)
e_0
Constant
name permittivity_vaccum
symbol \begin{equation}\epsilon_0\end{equation}
symbolic_expression \begin{equation}Ø\end{equation}
numerical 8.8541878128e-12
unit Symbol: \begin{equation}Ø\end{equation}
Symbolic Expression: \begin{equation}\frac{F}{m}\end{equation}
e_0.s

$\displaystyle \epsilon_0$

e_0.n
8.8541878128e-12
e_d = nsy.Constant(
    name="dielectric_permittivity",
    symbol= "\epsilon_d",
    numerical=5,
    unit=nsy.u.ratio
)
e_d
Constant
name dielectric_permittivity
symbol \begin{equation}\epsilon_d\end{equation}
symbolic_expression \begin{equation}Ø\end{equation}
numerical 5
unit Symbol: \begin{equation}\end{equation}
Symbolic Expression: \begin{equation}Ø\end{equation}

Constants cannot be mutated

e_d.n = 10
Constant cannot be mutated. You cannot set any attribute value. Instantiate a new variable.

Variable

capacitor_plate_separation = nsy.Variable(
    name="capacitor_plate_separation",
    symbol= "d",
    numerical=None,
    unit=nsy.u.meter
)
capacitor_plate_separation
Variable
name capacitor_plate_separation
symbol \begin{equation}d\end{equation}
symbolic_expression \begin{equation}Ø\end{equation}
numerical
unit Symbol: \begin{equation}m\end{equation}
Symbolic Expression: \begin{equation}Ø\end{equation}
capacitor_plate_separation.s

$\displaystyle d$

capacitor_plate_separation.u
Unit
name meter
symbol \begin{equation}m\end{equation}
symbolic_expression \begin{equation}Ø\end{equation}

Variables can be mutated

capacitor_plate_separation.n = 1e-6
capacitor_plate_separation.n
1e-06
capacitor_plate_separation.numerical = 3e-5
capacitor_plate_separation.numerical
3e-05

Operate between Value objects

Constants and Variables are value objects.

capacitance_per_plate_cross_sectional_area = e_d / (e_0 * capacitor_plate_separation)
capacitance_per_plate_cross_sectional_area
Value
name
symbol \begin{equation}Ø\end{equation}
symbolic_expression \begin{equation}\frac{\epsilon_d}{\epsilon_0 d}\end{equation}
numerical 1.8823484456216984e+16
unit Symbol: \begin{equation}Ø\end{equation}
Symbolic Expression: \begin{equation}\frac{}{F}\end{equation}
capacitance_per_plate_cross_sectional_area.se

$\displaystyle \frac{\epsilon_d}{\epsilon_0 d}$

capacitance_per_plate_cross_sectional_area.n
1.8823484456216984e+16

Perform Flexible Class Operations

raw_capacitor_cross_sectional_area = (1e-6) ** 2
raw_capacitor_cross_sectional_area
1e-12
device_capacitance = capacitance_per_plate_cross_sectional_area * raw_capacitor_cross_sectional_area
device_capacitance
Value
name
symbol \begin{equation}Ø\end{equation}
symbolic_expression \begin{equation}\frac{\epsilon_d Ø}{\epsilon_0 d}\end{equation}
numerical 18823.484456216982
unit Symbol: \begin{equation}Ø\end{equation}
Symbolic Expression: \begin{equation}\frac{Ø}{F}\end{equation}
device_capacitance.name
''
device_capacitance.se

$\displaystyle \frac{\epsilon_d Ø}{\epsilon_0 d}$

device_capacitance.symbol = "F"
device_capacitance.symbol

$\displaystyle F$

raw_capacitor_cross_sectional_area
1e-12
Example Functions
nsy.sqrt(device_capacitance)
Value
name
symbol \begin{equation}Ø\end{equation}
symbolic_expression \begin{equation}\sqrt{F}\end{equation}
numerical 137.19870428038664
unit Symbol: \begin{equation}Ø\end{equation}
Symbolic Expression: \begin{equation}\sqrt{\frac{Ø}{F}}\end{equation}
nsy.sinh(device_capacitance)
Value
name
symbol \begin{equation}Ø\end{equation}
symbolic_expression \begin{equation}\sinh{\left(F \right)}\end{equation}
numerical inf
unit Symbol: \begin{equation}Ø\end{equation}
Symbolic Expression: \begin{equation}\sqrt{\frac{Ø}{F}}\end{equation}

Future plans

  • Extend unit management and verification.
  • Create a full constants list, probably even in Excel or as an importable CSV file into Pandas.

Open to contributions.

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

numpsy-0.0.4.tar.gz (11.5 kB view details)

Uploaded Source

Built Distributions

numpsy-0.0.4-py3.8.egg (19.5 kB view details)

Uploaded Source

numpsy-0.0.4-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file numpsy-0.0.4.tar.gz.

File metadata

  • Download URL: numpsy-0.0.4.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for numpsy-0.0.4.tar.gz
Algorithm Hash digest
SHA256 ddf0957487822a73f756f5153dbc1ab0d6754275559db976f6aa0bf5be99aab4
MD5 b0871d7fdaa25b0b45ce248d3c295731
BLAKE2b-256 e132c443de3191e2e7147a87e0e076831a8ac156a888e4a3de09cea5a8b193d9

See more details on using hashes here.

File details

Details for the file numpsy-0.0.4-py3.8.egg.

File metadata

  • Download URL: numpsy-0.0.4-py3.8.egg
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for numpsy-0.0.4-py3.8.egg
Algorithm Hash digest
SHA256 e1c0ee971488bdf80a80bede9de3c0dfb4299fafa81a996acc0814bd097381e8
MD5 89b93cfbed34557f642d69c5a79e2092
BLAKE2b-256 bc3a5e39c8f000a1f43fa5dde73fc1b720e03f73dbe8e76aba21c7c704b74ccc

See more details on using hashes here.

File details

Details for the file numpsy-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: numpsy-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for numpsy-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 03925bc6b69f59eb0fe2124a19efc747ad6041852fcc3a60eafcd1e8e8ae56af
MD5 5b98b2886341b51100f2c53e95f1ffa2
BLAKE2b-256 45625f109ea566364ef2b022e857d1c08b4710784eb017e2e0f3280970b6effa

See more details on using hashes here.

Supported by

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