Navigation Menu

Skip to content

Commit

Permalink
Update poly.py
Browse files Browse the repository at this point in the history
  • Loading branch information
psesh committed Oct 21, 2021
1 parent c04c75e commit c2646fb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions equadratures/poly.py
Expand Up @@ -175,6 +175,23 @@ def __add__(self, *args):
polynew._model_evaluations += other._model_evaluations
return polynew

def __sub__(self, *args):
""" Subtracts polynomials.
Returns
-------
poly
An instance of the Poly class.
"""
polynew = deepcopy(self)
for other in args:
polynew.coefficients -= other.coefficients
if np.all( polynew._quadrature_points - other._quadrature_points ) == 0:
polynew._model_evaluations -= other._model_evaluations
return polynew

def plot_polyfit_1D(self, ax=None, uncertainty=True, output_variances=None, number_of_points=200, show=True):
""" Plots a 1D only polynomial fit to the data. See :meth:`~equadratures.plot.plot_polyfit_1D` for full description. """
return plot.plot_polyfit_1D(self,ax,uncertainty,output_variances,number_of_points,show)
Expand Down

0 comments on commit c2646fb

Please sign in to comment.