def __init__(self, parent, function, **kwargs): if isinstance(function, list): from printing import repr_polynomial self.repr = lambda: repr_polynomial(function, parent.variable_name()) kwargs['parenthesis_level'] = 0 LazyApproximation.__init__(self, parent, function, **kwargs) if self._length >= 0: self._expected_degree = self._length - 1 else: self._expected_degree = Infinity
def __init__(self, parent, function, starting_workprec=None, **kwargs): if isinstance(function, list): nrows = parent.nrows() ncols = parent.ncols() if len(function) > nrows*ncols: raise ValueError("list too long") coeffs = function + ([0] * (nrows*ncols-len(function))) coeffs = [ coeffs[i*ncols:(i+1)*ncols] for i in range(nrows) ] from printing import repr_matrix self.repr = lambda: repr_matrix(coeffs) LazyApproximation.__init__(self, parent, function, starting_workprec, **kwargs)
def _pow_(self,exp,*args,**kwargs): res = LazyApproximation._pow_(self,exp,*args,**kwargs) res._expected_degree = self._expected_degree * exp return res
def _mul_(self,other,*args,**kwargs): res = LazyApproximation._mul_(self,other,*args,**kwargs) res._expected_degree = self._expected_degree + other._expected_degree return res
def _lmul_(self,*args,**kwargs): res = LazyApproximation._lmul_(self,*args,**kwargs) res._expected_degree = self._expected_degree return res
def _sub_(self,other,*args,**kwargs): res = LazyApproximation._sub_(self,other,*args,**kwargs) res._expected_degree = max(self._expected_degree, other._expected_degree) return res
def __init__(self, *args, **kwargs): LazyApproximation.__init__(self, *args, **kwargs) self._length = -1 if not hasattr(self, 'expected_valuation'): self.expected_valuation = 0