diff --git a/rocketpy/mathutils/function.py b/rocketpy/mathutils/function.py index 2dab353de..8bdad9d2b 100644 --- a/rocketpy/mathutils/function.py +++ b/rocketpy/mathutils/function.py @@ -1840,7 +1840,9 @@ def __add__(self, other): return Function(lambda x: (self.get_value(x) + other(x))) # If other is Float except... except AttributeError: - if isinstance(other, (float, int, complex, np.ndarray)): + if isinstance( + other, (float, int, complex, np.ndarray, np.integer, np.floating) + ): # Check if Function object source is array or callable if isinstance(self.source, np.ndarray): # Operate on grid values @@ -1970,7 +1972,9 @@ def __mul__(self, other): return Function(lambda x: (self.get_value(x) * other(x))) # If other is Float except... except AttributeError: - if isinstance(other, (float, int, complex, np.ndarray)): + if isinstance( + other, (float, int, complex, np.ndarray, np.integer, np.floating) + ): # Check if Function object source is array or callable if isinstance(self.source, np.ndarray): # Operate on grid values @@ -2059,7 +2063,9 @@ def __truediv__(self, other): return Function(lambda x: (self.get_value_opt(x) / other(x))) # If other is Float except... except AttributeError: - if isinstance(other, (float, int, complex, np.ndarray)): + if isinstance( + other, (float, int, complex, np.ndarray, np.integer, np.floating) + ): # Check if Function object source is array or callable if isinstance(self.source, np.ndarray): # Operate on grid values @@ -2098,7 +2104,9 @@ def __rtruediv__(self, other): A Function object which gives the result of other(x)/self(x). """ # Check if Function object source is array and other is float - if isinstance(other, (float, int, complex, np.ndarray)): + if isinstance( + other, (float, int, complex, np.ndarray, np.integer, np.floating) + ): if isinstance(self.source, np.ndarray): # Operate on grid values ys = other / self.y_array @@ -2166,7 +2174,9 @@ def __pow__(self, other): return Function(lambda x: (self.get_value_opt(x) ** other(x))) # If other is Float except... except AttributeError: - if isinstance(other, (float, int, complex, np.ndarray)): + if isinstance( + other, (float, int, complex, np.ndarray, np.integer, np.floating) + ): # Check if Function object source is array or callable if isinstance(self.source, np.ndarray): # Operate on grid values @@ -2205,7 +2215,9 @@ def __rpow__(self, other): A Function object which gives the result of other(x)**self(x). """ # Check if Function object source is array and other is float - if isinstance(other, (float, int, complex, np.ndarray)): + if isinstance( + other, (float, int, complex, np.ndarray, np.integer, np.floating) + ): if isinstance(self.source, np.ndarray): # Operate on grid values ys = other**self.y_array