Ejemplo n.º 1
0
 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
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 def _pow_(self,exp,*args,**kwargs):
     res = LazyApproximation._pow_(self,exp,*args,**kwargs)
     res._expected_degree = self._expected_degree * exp
     return res
Ejemplo n.º 4
0
 def _mul_(self,other,*args,**kwargs):
     res = LazyApproximation._mul_(self,other,*args,**kwargs)
     res._expected_degree = self._expected_degree + other._expected_degree
     return res
Ejemplo n.º 5
0
 def _lmul_(self,*args,**kwargs):
     res = LazyApproximation._lmul_(self,*args,**kwargs)
     res._expected_degree = self._expected_degree
     return res
Ejemplo n.º 6
0
 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
Ejemplo n.º 7
0
 def __init__(self, *args, **kwargs):
     LazyApproximation.__init__(self, *args, **kwargs)
     self._length = -1
     if not hasattr(self, 'expected_valuation'):
         self.expected_valuation = 0