undefined package
Submodules
undefined.API module
- undefined.API.trace(f, mode='forward', seeds=None, plot=False, **kwargs)[source]
This is the main function that the users will interact with.
- Args:
f ([LambdaType]): [This is the user defined function. Use list if there are multiple input functions] mode (str, optional): Defaults to ‘forward’. Determine with mode to use to calculate the derivatives. seeds ([type], optional): Defaults to None. Used to calculate the Jacobian matrix plot (bool, optional): Defaults to False. Need to use in combination with “reverse” mode. If True, it will save the computational graph to your current working directory.
- Raises:
Errors will raise if unlawful inputs are given.
- Returns:
The function values and the derivatives results will be saved in a tuple as the output.
undefined.Calculator module
- undefined.Calculator.arccos(udobject)[source]
calculate the arccos operation of input
- Args:
udobject (udfunction object,UDGraph object,ndarray,ndarray,int,float): User defined function/number
- Raises:
TypeError:raised if input is not compatiable with arccos operation
- Returns:
if input is udfunction object,update val and der by arccos operation. if input is UDGraph object,update notes and function by arccos operation. if input is int,float,ndarray object,update them in arccos operation by their own types.
- undefined.Calculator.arcsin(udobject)[source]
calculate the arcsin operation of input
- Args:
udobject (udfunction object,UDGraph object,ndarray,ndarray,int,float): User defined function/number
- Raises:
TypeError:raised if input is not compatiable with arcsin operation
- Returns:
if input is udfunction object,update val and der by arcsin operation. if input is UDGraph object,update notes and function by arcsin operation. if input is int,float,ndarray object,update them in arcsin operation by their own types.
- undefined.Calculator.arctan(udobject)[source]
calculate the arctan operation of input
- Args:
udobject (udfunction object,UDGraph object,ndarray,ndarray,int,float): User defined function/number
- Raises:
TypeError:raised if input is not compatiable with arctan operation
- Returns:
if input is udfunction object,update val and der by arctan operation. if input is UDGraph object,update notes and function by arctan operation. if input is int,float,ndarray object,update them in arctan operation by their own types.
- undefined.Calculator.cos(udobject)[source]
calculate the cosine operation of input
- Args:
udobject (udfunction object,UDGraph object,ndarray,ndarray,int,float): User defined function
Raises:
TypeError:raised if input is not compatiable with cosine operation
- Returns:
if input is udfunction object,update val and der by cosine operation. if input is UDGraph object,update notes and function by cosine operation. if input is int,float,ndarray object,update them in cosine operation by their own types.
- undefined.Calculator.cosh(udobject)[source]
calculate the cosh operation of input
- Args:
udobject (udfunction object,UDGraph object,ndarray,ndarray,int,float): User defined function/number
- Returns:
The result from the cosh operation.
- undefined.Calculator.coth(udobject)[source]
calculate the coth operation of input
- Args:
udobject (udfunction object,UDGraph object,ndarray,ndarray,int,float): User defined function/number
- Returns:
The result from the coth operation.
- undefined.Calculator.csch(udobject)[source]
calculate the csch operation of input
- Args:
udobject (udfunction object,UDGraph object,ndarray,ndarray,int,float): User defined function/number
- Returns:
The result from the csch operation.
- undefined.Calculator.exp(udobject)[source]
calculate the square exponential of input
- Args:
udobject (udfunction object,UDGraph object,ndarray,ndarray,int,float): User defined function/number
Raises:
TypeError:raised if input is not compatiable with exponential operation
- Returns:
if input is udfunction object,update val and der by exponential operation. if input is UDGraph object,update notes and function by exponential operation. if input is int,float,ndarray object,update them in exponential operation by their own types.
- undefined.Calculator.log(udobject, base=2.718281828459045)[source]
calculate the log of input. We can handle the any bases in this log. Users can pass in the base argument.
- Args:
udobject (udfunction object,UDGraph object,ndarray,ndarray,int,float): User defined function/number
- Raises:
TypeError:raised if input is not compatiable with log operation
- Returns:
if input is udfunction object,update val and der by log operation. if input is UDGraph object,update notes and function by log operation. if input is int,float,ndarray object,update them in log operation by their own types.
- undefined.Calculator.sech(udobject)[source]
calculate the sech operation of input
- Args:
udobject (udfunction object,UDGraph object,ndarray,ndarray,int,float): User defined function/number
- Returns:
The result from the sech operation.
- undefined.Calculator.sin(udobject)[source]
calculate the sin operation of input
- Args:
udobject (udfunction object,UDGraph object,ndarray,ndarray,int,float): User defined function/number
Raises:
TypeError:raised if input is not compatiable with sin operation
- Returns:
if input is udfunction object,update val and der by sin operation. if input is UDGraph object,update notes and function by sin operation. if input is int,float,ndarray object,update them in sin operation by their own types.
- undefined.Calculator.sinh(udobject)[source]
calculate the sinh operation of input
- Args:
udobject (udfunction object,UDGraph object,ndarray,ndarray,int,float): User defined function/number
- Returns:
The result from the sinh operation.
- undefined.Calculator.sqrt(udobject)[source]
calculate the square root operation of input
- Args:
udobject (udfunction object,UDGraph object,ndarray,ndarray,int,float): User defined function/number
Raises:
TypeError:raised if input is not compatiable with square root operation
- Returns:
if input is udfunction object,update val and der by square root operation. if input is UDGraph object,update notes and function by square root operation. if input is int,float,ndarray object,update them in square root operation by their own types.
- undefined.Calculator.standard_logistic(udobject)[source]
this is the function we calculate the standard logistic. It is different than the log() function
- Args:
udobject (udfunction object,UDGraph object,ndarray,ndarray,int,float): User defined function/number
- Returns:
return the standard logistic results.
- undefined.Calculator.tan(udobject)[source]
calculate the tangent operation of input
- Args:
udobject (udfunction object,UDGraph object,ndarray,ndarray,int,float): User defined function/number
Raises:
TypeError:raised if input is not compatiable with tangent operation
- Returns:
if input is udfunction object,update val and der by tangent operation. if input is UDGraph object,update notes and function by tangent operation. if input is int,float,ndarray object,update them in tangent operation by their own types.
undefined.GraphGenerator module
- class undefined.GraphGenerator.GraphGenerator(g, variables, seeds_dic=None)[source]
Bases:
object- function_dic = {<UDPrimitive.VAR: 0>: <bound method GeneratorHelper._var of <class 'undefined.GraphGenerator.GeneratorHelper'>>, <UDPrimitive.ADD: 1>: <bound method GeneratorHelper._add of <class 'undefined.GraphGenerator.GeneratorHelper'>>, <UDPrimitive.RADD: 2>: <bound method GeneratorHelper._radd of <class 'undefined.GraphGenerator.GeneratorHelper'>>, <UDPrimitive.MUL: 3>: <bound method GeneratorHelper._mul of <class 'undefined.GraphGenerator.GeneratorHelper'>>, <UDPrimitive.RMUL: 4>: <bound method GeneratorHelper._rmul of <class 'undefined.GraphGenerator.GeneratorHelper'>>, <UDPrimitive.NEG: 5>: <bound method GeneratorHelper._neg of <class 'undefined.GraphGenerator.GeneratorHelper'>>, <UDPrimitive.SUB: 6>: <bound method GeneratorHelper._sub of <class 'undefined.GraphGenerator.GeneratorHelper'>>, <UDPrimitive.RSUB: 7>: <bound method GeneratorHelper._rsub of <class 'undefined.GraphGenerator.GeneratorHelper'>>, <UDPrimitive.TRUEDIV: 8>: <bound method GeneratorHelper._truediv of <class 'undefined.GraphGenerator.GeneratorHelper'>>, <UDPrimitive.RTRUEDIV: 9>: <bound method GeneratorHelper._rtruediv of <class 'undefined.GraphGenerator.GeneratorHelper'>>, <UDPrimitive.FLOORDIV: 10>: <bound method GeneratorHelper._floordiv of <class 'undefined.GraphGenerator.GeneratorHelper'>>, <UDPrimitive.RFLOORDIV: 11>: <bound method GeneratorHelper._rfloordiv of <class 'undefined.GraphGenerator.GeneratorHelper'>>, <UDPrimitive.POW: 12>: <bound method GeneratorHelper._pow of <class 'undefined.GraphGenerator.GeneratorHelper'>>, <UDPrimitive.RPOW: 13>: <bound method GeneratorHelper._rpow of <class 'undefined.GraphGenerator.GeneratorHelper'>>, <UDPrimitive.COS: 14>: <bound method GeneratorHelper._cos of <class 'undefined.GraphGenerator.GeneratorHelper'>>, <UDPrimitive.SIN: 15>: <bound method GeneratorHelper._sin of <class 'undefined.GraphGenerator.GeneratorHelper'>>, <UDPrimitive.TAN: 16>: <bound method GeneratorHelper._tan of <class 'undefined.GraphGenerator.GeneratorHelper'>>, <UDPrimitive.SQRT: 17>: <bound method GeneratorHelper._sqrt of <class 'undefined.GraphGenerator.GeneratorHelper'>>, <UDPrimitive.EXP: 18>: <bound method GeneratorHelper._exp of <class 'undefined.GraphGenerator.GeneratorHelper'>>, <UDPrimitive.LOG: 19>: <bound method GeneratorHelper._log of <class 'undefined.GraphGenerator.GeneratorHelper'>>, <UDPrimitive.ACOS: 20>: <bound method GeneratorHelper._arccos of <class 'undefined.GraphGenerator.GeneratorHelper'>>, <UDPrimitive.ASIN: 21>: <bound method GeneratorHelper._arcsin of <class 'undefined.GraphGenerator.GeneratorHelper'>>, <UDPrimitive.ATAN: 22>: <bound method GeneratorHelper._arctan of <class 'undefined.GraphGenerator.GeneratorHelper'>>}
undefined.UDFunction module
- class undefined.UDFunction.UDFunction(val, der=1)[source]
Bases:
object- property der
This is a decorator return rouded input self.der
- Returns:
array: 3 decimal rounded input of self.der
- property val
This is a decorator return rouded input self.val
- Returns:
array: 2 decimal rounded input of self.value
undefined.Utils module
- class undefined.Utils.UDPrimitive(value)[source]
Bases:
enum.EnumAn enumeration.
- ACOS = 20
- ADD = 1
- ASIN = 21
- ATAN = 22
- COS = 14
- EXP = 18
- FLOORDIV = 10
- LOG = 19
- MUL = 3
- NEG = 5
- POW = 12
- RADD = 2
- RFLOORDIV = 11
- RMUL = 4
- RPOW = 13
- RSUB = 7
- RTRUEDIV = 9
- SIN = 15
- SQRT = 17
- SUB = 6
- TAN = 16
- TRUEDIV = 8
- VAR = 0
- undefined.Utils.check_arc(val)[source]
Used to check if unlawful inverse trig function is executed by users raise errors if happened. Cannot take inverse trig function that is not between -1 and 1
- Args:
val ([int or float])
- Raises:
raise error if number is not between -1 and 1
- undefined.Utils.check_division_by_zero(val)[source]
Used to check if unlawful division is executed by users raise errors if happened.
- Args:
val ([int or float])
- Raises:
ZeroDivisionError raised if dividing by 0.
- undefined.Utils.check_log(val, base)[source]
Used to check if unlawful log is executed by users raise errors if happened. Cannot take log for number that is less or equal to 0 log base also needs to be greater than 0.
- Args:
val ([int or float]) base ([int or float])
- Raises:
raise ValueError if any of the base or val is less than 0.
Module contents
- undefined.cos(udobject)[source]
calculate the cosine operation of input
- Args:
udobject (udfunction object,UDGraph object,ndarray,ndarray,int,float): User defined function
Raises:
TypeError:raised if input is not compatiable with cosine operation
- Returns:
if input is udfunction object,update val and der by cosine operation. if input is UDGraph object,update notes and function by cosine operation. if input is int,float,ndarray object,update them in cosine operation by their own types.
- undefined.exp(udobject)[source]
calculate the square exponential of input
- Args:
udobject (udfunction object,UDGraph object,ndarray,ndarray,int,float): User defined function/number
Raises:
TypeError:raised if input is not compatiable with exponential operation
- Returns:
if input is udfunction object,update val and der by exponential operation. if input is UDGraph object,update notes and function by exponential operation. if input is int,float,ndarray object,update them in exponential operation by their own types.
- undefined.log(udobject, base=2.718281828459045)[source]
calculate the log of input. We can handle the any bases in this log. Users can pass in the base argument.
- Args:
udobject (udfunction object,UDGraph object,ndarray,ndarray,int,float): User defined function/number
- Raises:
TypeError:raised if input is not compatiable with log operation
- Returns:
if input is udfunction object,update val and der by log operation. if input is UDGraph object,update notes and function by log operation. if input is int,float,ndarray object,update them in log operation by their own types.
- undefined.sin(udobject)[source]
calculate the sin operation of input
- Args:
udobject (udfunction object,UDGraph object,ndarray,ndarray,int,float): User defined function/number
Raises:
TypeError:raised if input is not compatiable with sin operation
- Returns:
if input is udfunction object,update val and der by sin operation. if input is UDGraph object,update notes and function by sin operation. if input is int,float,ndarray object,update them in sin operation by their own types.
- undefined.sqrt(udobject)[source]
calculate the square root operation of input
- Args:
udobject (udfunction object,UDGraph object,ndarray,ndarray,int,float): User defined function/number
Raises:
TypeError:raised if input is not compatiable with square root operation
- Returns:
if input is udfunction object,update val and der by square root operation. if input is UDGraph object,update notes and function by square root operation. if input is int,float,ndarray object,update them in square root operation by their own types.
- undefined.tan(udobject)[source]
calculate the tangent operation of input
- Args:
udobject (udfunction object,UDGraph object,ndarray,ndarray,int,float): User defined function/number
Raises:
TypeError:raised if input is not compatiable with tangent operation
- Returns:
if input is udfunction object,update val and der by tangent operation. if input is UDGraph object,update notes and function by tangent operation. if input is int,float,ndarray object,update them in tangent operation by their own types.
- undefined.trace(f, mode='forward', seeds=None, plot=False, **kwargs)[source]
This is the main function that the users will interact with.
- Args:
f ([LambdaType]): [This is the user defined function. Use list if there are multiple input functions] mode (str, optional): Defaults to ‘forward’. Determine with mode to use to calculate the derivatives. seeds ([type], optional): Defaults to None. Used to calculate the Jacobian matrix plot (bool, optional): Defaults to False. Need to use in combination with “reverse” mode. If True, it will save the computational graph to your current working directory.
- Raises:
Errors will raise if unlawful inputs are given.
- Returns:
The function values and the derivatives results will be saved in a tuple as the output.