arsenalgear-py
A library containing general purpose Python utils.
Functions
arsenalgear.mathematics Namespace Reference

Functions

def Hermite (x, n)
 Orthogonal polynomials functions. More...
 
def Chebyshev (x, n)
 
def Legendre (x, n)
 
def Laguerre (x, n)
 
def IsInBounds (value, min_, max_)
 "IsInBounds" function More...
 
def e_parser (real_part, imaginary_part, n, x)
 "e_parser" function More...
 
def kronecker (i, j)
 "kronecker" function More...
 
def OrderOfMagnitude (number)
 OrderOfMagnitude. More...
 

Function Documentation

◆ Chebyshev()

def arsenalgear.mathematics.Chebyshev (   x,
  n 
)
Function used to compute the Chebyshev polynomials.

Args:
    x (any): variable.
    n (int): polynomials order
    
Returns:
    any: returns the value of the polynomials at a given order for a given variable value.
    
Testing:
    Already tested in some functions of the "functions.py" library.

◆ e_parser()

def arsenalgear.mathematics.e_parser (   real_part,
  imaginary_part,
  n,
  x 
)

"e_parser" function

Returns the complex value of a parsed expression.

Args:
    real_part (string): mathematical real expression part.
    imaginary_part (string): mathematical imaginary expression part.
    n (int): wave function index.
    x (any): expression variable.
    
Returns:
    complex: returns the value of a complex parsed expression for an index n and variable x.
    
Testing:
    >>> e_parser( "pow( x, n )", "0", 2, 2 )
    (4+0j)
    >>> e_parser( "n*np.cos( x )", "3*n", 2, np.pi )
    (-2+6j)
    >>> e_parser( "n*np.cos( k )", "3*n", 2, np.pi )
    Traceback (most recent call last):
        ...
    NameError: name 'k' is not defined
    >>> e_parser( "n*np.cos( x )", "3*z", 2, np.pi )
    Traceback (most recent call last):
        ...
    NameError: name 'z' is not defined
    >>> e_parser( "os.system", "0", 0, 1 )
    Traceback (most recent call last):
        ...
    RuntimeError: \033[31mDon't parse os.system strings! It is dangerous!\033[0m

◆ Hermite()

def arsenalgear.mathematics.Hermite (   x,
  n 
)

Orthogonal polynomials functions.

Function used to compute the Hermite polynomials.

Args:
    x (any): variable.
    n (int): polynomials order
Returns:

    any: returns the value of the polynomials at a given order for a given variable value.
    
Testing:
    Already tested in some functions of the "functions.py" library.

◆ IsInBounds()

def arsenalgear.mathematics.IsInBounds (   value,
  min_,
  max_ 
)

"IsInBounds" function

Function to check if a value is in certain bounds.

Args:
    value (any): the interested value.
    min (any): min value.
    max (any): max value.
    
Returns:
    bool: return true if is in the bound, otherwise false.
    
Testing:
    >>> IsInBounds( 3, 1, 5 )
    True
    >>> IsInBounds( 2.3, -2, 3 )
    True
    >>> IsInBounds( 1, 2, 3 )
    False

◆ kronecker()

def arsenalgear.mathematics.kronecker (   i,
  j 
)

"kronecker" function

Definition of the Kronecker delta function for two numbers i and j.

Args:
    i (int): index i
    j (int): index j
    
Returns:
    int: return the Kronecker delta value.
    
Testing:
    >>> kronecker( 2, 2 )
    1
    >>> kronecker( 1, 2 )
    0

◆ Laguerre()

def arsenalgear.mathematics.Laguerre (   x,
  n 
)
Function used to compute the Laguerre polynomials.
Args:
    x (any): variable.
    n (int): polynomials order
Returns:
    any: returns the value of the polynomials at a given order for a given variable value.
    
Testing:
    Already tested in some functions of the "functions.py" library.

◆ Legendre()

def arsenalgear.mathematics.Legendre (   x,
  n 
)
Function used to compute the Legendre polynomials.

Args:
    x (any): variable.
    n (int): polynomials order
    
Returns:
    any: returns the value of the polynomials at a given order for a given variable value.
    
Testing:
    Already tested in some functions of the "functions.py" library.

◆ OrderOfMagnitude()

def arsenalgear.mathematics.OrderOfMagnitude (   number)

OrderOfMagnitude.

Function used to find the order of magnitude of a number.

Args:
    number (any): the input number.

Returns:
    int: the order of magnitude of the number.
    
Testing:
    >>> OrderOfMagnitude( 1E+10 )
    10
    >>> OrderOfMagnitude( 1E-10 )
    -10
    >>> OrderOfMagnitude( 145 )
    2