v0.2.0 #10

Merged
jono merged 11 commits from v0.2.0-dev into main 2025-06-17 18:36:26 +00:00
Showing only changes of commit a761efe28e - Show all commits

View File

@ -126,6 +126,26 @@ class Function:
""" """
Calculates the derivative of the 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: Returns:
Function: A new Function object representing the derivative. Function: A new Function object representing the derivative.
""" """
@ -139,6 +159,7 @@ class Function:
diff_func.set_coeffs(derivative_coefficients.tolist()) diff_func.set_coeffs(derivative_coefficients.tolist())
return diff_func return diff_func
def get_real_roots(self, options: GA_Options = GA_Options(), use_cuda: bool = False) -> np.ndarray: 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). Uses a genetic algorithm to find the approximate real roots of the function (where y=0).