Spaces:
Sleeping
Sleeping
File size: 1,193 Bytes
6a86ad5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
""" Common Exceptions for `holonomic` module. """
class BaseHolonomicError(Exception):
def new(self, *args):
raise NotImplementedError("abstract base class")
class NotPowerSeriesError(BaseHolonomicError):
def __init__(self, holonomic, x0):
self.holonomic = holonomic
self.x0 = x0
def __str__(self):
s = 'A Power Series does not exists for '
s += str(self.holonomic)
s += ' about %s.' %self.x0
return s
class NotHolonomicError(BaseHolonomicError):
def __init__(self, m):
self.m = m
def __str__(self):
return self.m
class SingularityError(BaseHolonomicError):
def __init__(self, holonomic, x0):
self.holonomic = holonomic
self.x0 = x0
def __str__(self):
s = str(self.holonomic)
s += ' has a singularity at %s.' %self.x0
return s
class NotHyperSeriesError(BaseHolonomicError):
def __init__(self, holonomic, x0):
self.holonomic = holonomic
self.x0 = x0
def __str__(self):
s = 'Power series expansion of '
s += str(self.holonomic)
s += ' about %s is not hypergeometric' %self.x0
return s
|