v0.2.0 #10
@ -126,6 +126,26 @@ class Function:
|
||||
"""
|
||||
Calculates the derivative of the function.
|
||||
|
||||
Returns:
|
||||
Function: A new Function object representing the derivative.
|
||||
"""
|
||||
warnings.warn(
|
||||
"The 'differential' function has been renamed. Please use 'derivitive' instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2
|
||||
)
|
||||
|
||||
self._check_initialized()
|
||||
if self._largest_exponent == 0:
|
||||
raise ValueError("Cannot differentiate a constant (Function of degree 0).")
|
||||
|
||||
return self.derivitive()
|
||||
|
||||
|
||||
def derivitive(self) -> 'Function':
|
||||
"""
|
||||
Calculates the derivative of the function.
|
||||
|
||||
Returns:
|
||||
Function: A new Function object representing the derivative.
|
||||
"""
|
||||
@ -139,6 +159,7 @@ class Function:
|
||||
diff_func.set_coeffs(derivative_coefficients.tolist())
|
||||
return diff_func
|
||||
|
||||
|
||||
def get_real_roots(self, options: GA_Options = GA_Options(), use_cuda: bool = False) -> np.ndarray:
|
||||
"""
|
||||
Uses a genetic algorithm to find the approximate real roots of the function (where y=0).
|
||||
|
Reference in New Issue
Block a user