Did I find the right examples for you? yes no      Crawl my project      Python Jobs

# ArithmeticError

All Samples(369)  |  Call(290)  |  Derive(79)  |  Import(0)
Base class for arithmetic errors.

s = s + t   # add next term
if abs(t)<precision: return s
raise ArithmeticError('no convergence')

def mysin(x,precision=1e-6,max_steps=40):
r = x**(2*k+1)            # estimate residue
if r<precision: return s  # stopping condition
raise ArithmeticError('no convergence')

def mycos(x,precision=1e-6,max_steps=40):
r = x**(2*k)              # estimate residue
if r<precision: return s  # stopping condition
raise ArithmeticError('no convergence')

class Matrix(object):
B = Matrix([[B for c in xrange(m)] for r in xrange(n)])
if B.nrows!=n or B.ncols!=m:
raise ArithmeticError('incompatible dimensions')
C = Matrix(n,m)
for r in xrange(n):
B = Matrix(n,m,fill=B)
if B.nrows!=n or B.ncols!=m:
raise ArithmeticError('Incompatible dimensions')
C = Matrix(n,m)
for r in xrange(n):

if self.ambient_vector_space() != other.ambient_vector_space():
raise ArithmeticError("self and other must be embedded in the same ambient space.")

if self.base_ring() != other.base_ring():
if self.is_subspace(other):
return sage.rings.infinity.infinity
raise ArithmeticError("self must be contained in the vector space spanned by other.")

try:

if self.ambient_vector_space() != other.ambient_vector_space():
raise ArithmeticError("self and other must be embedded in the same ambient space.")

if self.base_ring() != other.base_ring():
if check:
if not V.is_submodule(self):
raise ArithmeticError("Argument gens (= %s) does not generate a submodule of self."%gens)
return V

if check:
if not V.is_submodule(self):
raise ArithmeticError("The given basis does not generate a submodule of self.")
return V

Pnew = pushout(self.__abstract_basis.universe(), P)
except TypeError :
raise ArithmeticError( "No coordinates for %s." % (x,) )

if isinstance(Pnew, EquivariantMonoidPowerSeriesAmbient_abstract) \
x = Pnew(x)
except TypeError :
raise ArithmeticError( "No coordinates for %s." % (x,) )
else :
A = self.base_ring()
x._cleanup_coefficients()
if set( x.non_zero_components() ) - set( self._non_zero_characters() ) != set() :
raise ArithmeticError( "%s is not contained in this space." % (x,) )

if in_base_ring :
except TypeError, msg :
if "Runtime error in 'Solution': No solution exists" in msg :
raise ArithmeticError( "%s is not contained in this space." % (x,) )

if not force_ambigous and \
coords = fe_matrix.solve_right(x_fe_vector)
except ValueError, msg :
raise ArithmeticError( "%s is not contained in this space, %s" % (x, msg) )
coords = coords.column(0)

weight = int(weight)
if weight <= 1:
raise ArithmeticError("weight must be at least 2")
if not arithgroup.is_CongruenceSubgroup(group):
raise TypeError("group must be a congruence subgroup")
weight = int(weight)
raise ArithmeticError("sign must be an int in [-1,0,1]")
if level <= 0:
raise ArithmeticError("level must be positive")
sign = int(sign)
raise ArithmeticError("sign must be an int in [-1,0,1]")
if level <= 0:
raise ArithmeticError("level must be positive")

raise TypeError("Second argument must be a modular form.")
if self.parent().ambient() != other.parent().ambient():
raise ArithmeticError("Modular forms must be in the same ambient space.")

def __call__(self, x, prec=None):
K = parent.base_ring()
if chi.parent().modulus() != N or psi.parent().modulus() != N:
raise ArithmeticError("Incompatible moduli")
if chi.parent().base_ring() != K or psi.parent().base_ring() != K:
raise ArithmeticError("Incompatible base rings")
t = int(t)
#if not isinstance(t, int): raise TypeError, "weight must be an int"
if parent.weight() == 2 and chi.is_trivial() \
and psi.is_trivial() and t==1:
raise ArithmeticError("If chi and psi are trivial and k=2, then t must be >1.")

"""
if not self.is_cuspidal():
raise ArithmeticError("space must be cuspidal")
if self.sign() == 0:
return self.dimension() // 2
return 0
if check_simple and not S.is_simple():
raise ArithmeticError("S must be simple")
A = self.ambient_hecke_module()
B = A.submodule_generated_by_images(S)

if not self.is_cuspidal():
raise ArithmeticError("space must be cuspidal")

if self.sign() == 0:
self._q_expansion_dict = {}
if not self.is_cuspidal():
raise ArithmeticError("self must be cuspidal.")

if not self.is_simple():
if self.sign() == 0:
return self.plus_submodule(compute_dual=True).q_eigenform(prec, names)
raise ArithmeticError("self must be simple.")

if not set(x._reduce_polynomial().monomials()).issubset(set(self._non_zero_monomials())) :
raise ArithmeticError( "%s is not contained in this space." % (x,) )

mon_matrix = self._monomial_homomorphism().matrix().transpose()
except TypeError, msg :
if "Runtime error in 'Solution': No solution exists" in msg :
raise ArithmeticError( "%s is not contained in this space." % (x,) )

try :
coords = mon_matrix.solve_right(x_mon_vector)
except ValueError :
raise ArithmeticError( "%s is not contained in this space." % (x,) )
except TypeError :
if in_base_ring :
raise ArithmeticError( "%s is not contained in this space." % (x,) )
else :
return coords.list()
coords = mon_matrix.solve_right(x_mon_vector)
except ValueError :
raise ArithmeticError( "%s is not contained in the image of this space." % (x,) )

try :

raise ValueError("p must be odd")
if self.conductor() % p == 0 or self.ap(p) % p == 0:
raise ArithmeticError("p must be a good ordinary prime")
return p

raise ValueError("p must be odd")   # todo
if self.conductor() % (p**2) == 0:
raise ArithmeticError("p must be a semi-stable prime")

if self.conductor() % p == 0:
raise ValueError("p must be odd")   # todo
if self.conductor() % (p**2) == 0:
raise ArithmeticError("p must be a semi-stable prime")

prec = int(prec)
raise ValueError("p must be odd")   # todo
if self.conductor() % p == 0:
raise ArithmeticError("must have good reduction at p")
if self.ap(p) % p == 0:
raise ArithmeticError("must be ordinary at p")

raise TypeError("dual_free_module must be a free module")
if dual_free_module.rank () != submodule.rank():
raise ArithmeticError("dual_free_module must have the same rank as submodule")
self.dual_free_module.set_cache(dual_free_module)

raise TypeError("other (=%s) must be a Hecke module."%other)
if self.ambient() != other.ambient():
raise ArithmeticError("Sum only defined for submodules of a common ambient space.")
if other.is_ambient():
return other
"""
if V.degree() != self.ambient_hecke_module().rank():
raise ArithmeticError("The degree of V must equal the rank of the ambient space.")
if V.rank() != self.rank():
raise ArithmeticError("The rank of V must equal the rank of self.")
"""
if self.ambient_hecke_module() != other.ambient_hecke_module():
raise ArithmeticError("Intersection only defined for subspaces of"\
+ " a common ambient modular symbols space.")
if other.is_ambient():