OutOfDomainError(function_name, value, between_integers=False)
Source¶
Bases: NumdaplotError
Raised when a math function or an operator receives a value it is not defined for.
For example, the square root of a negative number, the logarithm of 0, or an integer divided by 0 with //.
Changed in version 0.2.0
The message names the Table column holding the value.
Version history (1)
Added in version 0.1.0
Parameters:
-
function_name(str)Name of the math function.
-
value(float)The first value outside the domain of the function.
-
between_integers(bool, default:False)True when decimals would accept the value, False by default.
Attributes:
-
function_nameName of the math function.
-
valueThe first value outside the domain of the function.
-
between_integersTrue when decimals would accept the value.
-
column_name(str | None)Name of the Table column holding the value, or
Nonefor the values of an Array.
Examples:
import numdaplot as ndp
array = ndp.Array.from_list([4, -9])
try:
array.apply(ndp.SquareRoot())
except ndp.OutOfDomainError as error:
print(error)
# SquareRoot is not defined for -9.