def Catenoid(c=1, name="Catenoid"): r""" Return a catenoid surface, with parametric representation .. MATH:: \begin{aligned} x(u, v) & = c \cosh(v/c) \cos(u); \\ y(u, v) & = c \cosh(v/c) \sin(u); \\ z(u, v) & = v. \end{aligned} INPUT: - ``c`` -- surface parameter. - ``name`` -- string. Name of the surface. For more information, see :wikipedia:`Catenoid`. EXAMPLES:: sage: cat = surfaces.Catenoid(); cat Parametrized surface ('Catenoid') with equation (cos(u)*cosh(v), cosh(v)*sin(u), v) sage: cat.plot() Graphics3d Object """ u, v = var('u, v') catenoid_eq = [c * cosh(v / c) * cos(u), c * cosh(v / c) * sin(u), v] coords = ((u, 0, 2 * pi), (v, -1, 1)) return ParametrizedSurface3D(catenoid_eq, coords, name)
def Catenoid(c=1, name="Catenoid"): r""" Returns a catenoid surface, with parametric representation .. MATH:: \begin{aligned} x(u, v) & = c \cosh(v/c) \cos(u); \\ y(u, v) & = c \cosh(v/c) \sin(u); \\ z(u, v) & = v. \end{aligned} INPUT: - ``c`` -- surface parameter. - ``name`` -- string. Name of the surface. EXAMPLES:: sage: cat = surfaces.Catenoid(); cat Parametrized surface ('Catenoid') with equation (cos(u)*cosh(v), cosh(v)*sin(u), v) sage: cat.plot() Graphics3d Object """ u, v = var("u, v") catenoid_eq = [c * cosh(v / c) * cos(u), c * cosh(v / c) * sin(u), v] coords = ((u, 0, 2 * pi), (v, -1, 1)) return ParametrizedSurface3D(catenoid_eq, coords, name)
def show(self, show_hyperboloid=True, **graphics_options): r""" Plot ``self``. EXAMPLES:: sage: from sage.geometry.hyperbolic_space.hyperbolic_geodesic import * sage: g = HyperbolicPlane().HM().random_geodesic() sage: g.show() Graphics3d Object """ x = SR.var('x') opts = self.graphics_options() opts.update(graphics_options) v1, u2 = [vector(k.coordinates()) for k in self.endpoints()] # Lorentzian Gram Shmidt. The original vectors will be # u1, u2 and the orthogonal ones will be v1, v2. Except # v1 = u1, and I don't want to declare another variable, # hence the odd naming convention above. # We need the Lorentz dot product of v1 and u2. v1_ldot_u2 = u2[0] * v1[0] + u2[1] * v1[1] - u2[2] * v1[2] v2 = u2 + v1_ldot_u2 * v1 v2_norm = sqrt(v2[0]**2 + v2[1]**2 - v2[2]**2) v2 = v2 / v2_norm v2_ldot_u2 = u2[0] * v2[0] + u2[1] * v2[1] - u2[2] * v2[2] # Now v1 and v2 are Lorentz orthogonal, and |v1| = -1, |v2|=1 # That is, v1 is unit timelike and v2 is unit spacelike. # This means that cosh(x)*v1 + sinh(x)*v2 is unit timelike. hyperbola = cosh(x) * v1 + sinh(x) * v2 endtime = arcsinh(v2_ldot_u2) from sage.plot.plot3d.all import parametric_plot3d pic = parametric_plot3d(hyperbola, (x, 0, endtime), **graphics_options) if show_hyperboloid: pic += self._model.get_background_graphic() return pic
def show(self, show_hyperboloid=True, **graphics_options): r""" Plot ``self``. EXAMPLES:: sage: from sage.geometry.hyperbolic_space.hyperbolic_geodesic import * sage: g = HyperbolicPlane().HM().random_geodesic() sage: g.show() Graphics3d Object """ x = SR.var('x') opts = self.graphics_options() opts.update(graphics_options) v1, u2 = [vector(k.coordinates()) for k in self.endpoints()] # Lorentzian Gram Shmidt. The original vectors will be # u1, u2 and the orthogonal ones will be v1, v2. Except # v1 = u1, and I don't want to declare another variable, # hence the odd naming convention above. # We need the Lorentz dot product of v1 and u2. v1_ldot_u2 = u2[0]*v1[0] + u2[1]*v1[1] - u2[2]*v1[2] v2 = u2 + v1_ldot_u2 * v1 v2_norm = sqrt(v2[0]**2 + v2[1]**2 - v2[2]**2) v2 = v2 / v2_norm v2_ldot_u2 = u2[0]*v2[0] + u2[1]*v2[1] - u2[2]*v2[2] # Now v1 and v2 are Lorentz orthogonal, and |v1| = -1, |v2|=1 # That is, v1 is unit timelike and v2 is unit spacelike. # This means that cosh(x)*v1 + sinh(x)*v2 is unit timelike. hyperbola = cosh(x)*v1 + sinh(x)*v2 endtime = arcsinh(v2_ldot_u2) from sage.plot.plot3d.all import parametric_plot3d pic = parametric_plot3d(hyperbola, (x, 0, endtime), **graphics_options) if show_hyperboloid: pic += self._model.get_background_graphic() return pic
def _eval_(self, n, x): """ EXAMPLES:: sage: y=var('y') sage: bessel_I(y,x) bessel_I(y, x) sage: bessel_I(0.0, 1.0) 1.26606587775201 sage: bessel_I(1/2, 1) sqrt(2)*sinh(1)/sqrt(pi) sage: bessel_I(-1/2, pi) sqrt(2)*cosh(pi)/pi """ if (not isinstance(n, Expression) and not isinstance(x, Expression) and (is_inexact(n) or is_inexact(x))): coercion_model = get_coercion_model() n, x = coercion_model.canonical_coercion(n, x) return self._evalf_(n, x, parent(n)) # special identities if n == Integer(1) / Integer(2): return sqrt(2 / (pi * x)) * sinh(x) elif n == -Integer(1) / Integer(2): return sqrt(2 / (pi * x)) * cosh(x) return None # leaves the expression unevaluated
def _eval_(self, a, z): """ EXAMPLES:: sage: struve_L(-2,0) struve_L(-2, 0) sage: struve_L(-1,0) 0 sage: struve_L(pi,0) 0 sage: struve_L(-1/2,x) sqrt(2)*sqrt(1/(pi*x))*sinh(x) sage: struve_L(1/2,1) sqrt(2)*(cosh(1) - 1)/sqrt(pi) sage: struve_L(2,x) struve_L(2, x) sage: struve_L(-3/2,x) -bessel_I(3/2, x) """ from sage.symbolic.ring import SR if z.is_zero() \ and (SR(a).is_numeric() or SR(a).is_constant()) \ and a.real() >= -1: return ZZ(0) if a == -Integer(1)/2: from sage.functions.hyperbolic import sinh return sqrt(2/(pi*z)) * sinh(z) if a == Integer(1)/2: from sage.functions.hyperbolic import cosh return sqrt(2/(pi*z)) * (cosh(z)-1) if a < 0 and not SR(a).is_integer() and SR(2*a).is_integer(): from sage.rings.rational_field import QQ n = (a*(-2) - 1)/2 return Integer(-1)**n * bessel_I(n+QQ(1)/2, z)
def RQ(delta): # this is the quotient R(F_0,z)/R(F_0,z(F)) for a generic z # at distance delta from j. See Lemma 4.2 in [HS2018]. cd = cosh(delta).n(prec=prec) sd = sinh(delta).n(prec=prec) return prod( [cd + (cost * phi[0] + sint * phi[1]) * sd for phi in phis])
def get_bound_poly(F, prec=53, norm_type='norm', emb=None): """ The hyperbolic distance from `j` which must contain the smallest poly. This defines the maximum possible distance from `j` to the `z_0` covariant in the hyperbolic 3-space for which the associated `F` could have smaller coefficients. INPUT: - ``F`` -- binary form of degree at least 3 with no multiple roots - ``prec``-- positive integer. precision to use in CC - ``norm_type`` -- string, either norm or height - ``emb`` -- embedding into CC OUTPUT: a positive real number EXAMPLES:: sage: from sage.rings.polynomial.binary_form_reduce import get_bound_poly sage: R.<x,y> = QQ[] sage: F = -2*x^3 + 2*x^2*y + 3*x*y^2 + 127*y^3 sage: get_bound_poly(F) 28.0049336543295 sage: get_bound_poly(F, norm_type='height') 111.890642019092 """ def coshdelta(z): #The cosh of the hyperbolic distance from z = t+uj to j return (z.norm() + 1) / (2 * z.imag()) if F.base_ring() != ComplexField(prec=prec): if emb is None: compF = F.change_ring(ComplexField(prec=prec)) else: compF = F.change_ring(emb) else: compF = F n = F.degree() assert (n > 2), "degree 2 polynomial" z0F, thetaF = covariant_z0(compF, prec=prec, emb=emb) cosh_delta = coshdelta(z0F) if norm_type == 'norm': #euclidean norm squared normF = (sum([abs(i)**2 for i in compF.coefficients()])) target = (2**(n - 1)) * normF / thetaF elif norm_type == 'height': hF = e**max([c.global_height(prec=prec) for c in F.coefficients()]) #height target = (2**(n - 1)) * (n + 1) * (hF**2) / thetaF else: raise ValueError('type must be norm or height') return cosh(epsinv(F, target, prec=prec))
def _0f1(b, z): F12 = cosh(2 * sqrt(z)) F32 = sinh(2 * sqrt(z)) / (2 * sqrt(z)) if 2 * b == 1: return F12 if 2 * b == 3: return F32 if 2 * b > 3: return ((b - 2) * (b - 1) / z * (_0f1(b - 2, z) - _0f1(b - 1, z))) if 2 * b < 1: return (_0f1(b + 1, z) + z / (b * (b + 1)) * _0f1(b + 2, z)) raise ValueError
def _derivative_(self, z, diff_param=None): """ The derivative of `\operatorname{Chi}(z)` is `\cosh(z)/z`. EXAMPLES:: sage: x = var('x') sage: f = cosh_integral(x) sage: f.diff(x) cosh(x)/x sage: f = cosh_integral(ln(x)) sage: f.diff(x) cosh(log(x))/(x*log(x)) """ return cosh(z)/z
def _derivative_(self, z, diff_param=None): """ The derivative of `\operatorname{Chi}(z)` is `\cosh(z)/z`. EXAMPLES:: sage: x = var('x') sage: f = cosh_integral(x) sage: f.diff(x) cosh(x)/x sage: f = cosh_integral(ln(x)) sage: f.diff(x) cosh(log(x))/(x*log(x)) """ return cosh(z) / z
def _eval_(self, n, x): """ EXAMPLES:: sage: y=var('y') sage: bessel_I(y,x) bessel_I(y, x) sage: bessel_I(0.0, 1.0) 1.26606587775201 sage: bessel_I(1/2, 1) sqrt(2)*sinh(1)/sqrt(pi) sage: bessel_I(-1/2, pi) sqrt(2)*cosh(pi)/pi """ # special identities if n == Integer(1) / Integer(2): return sqrt(2 / (pi * x)) * sinh(x) elif n == -Integer(1) / Integer(2): return sqrt(2 / (pi * x)) * cosh(x)
def get_bound_dynamical(F, f, m=1, dynatomic=True, prec=53, emb=None): """ The hyperbolic distance from `j` which must contain the smallest map. This defines the maximum possible distance from `j` to the `z_0` covariant of the associated binary form `F` in the hyperbolic 3-space for which the map `f`` could have smaller coefficients. INPUT: - ``F`` -- binary form of degree at least 3 with no multiple roots associated to ``f`` - ``f`` -- a dynamical system on `P^1` - ``m`` - positive integer. the period used to create ``F`` - ``dynatomic`` -- boolean. whether ``F`` is the periodic points or the formal periodic points of period ``m`` for ``f`` - ``prec``-- positive integer. precision to use in CC - ``emb`` -- embedding into CC OUTPUT: a positive real number EXAMPLES:: sage: from sage.dynamics.arithmetic_dynamics.endPN_minimal_model import get_bound_dynamical sage: P.<x,y> = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem([50*x^2 + 795*x*y + 2120*y^2, 265*x^2 + 106*y^2]) sage: get_bound_dynamical(f.dynatomic_polynomial(1), f) 35.5546923182219 """ def coshdelta(z): #The cosh of the hyperbolic distance from z = t+uj to j return (z.norm() + 1) / (2 * z.imag()) if F.base_ring() != ComplexField(prec=prec): if emb is None: compF = F.change_ring(ComplexField(prec=prec)) else: compF = F.change_ring(emb) else: compF = F n = F.degree() z0F, thetaF = covariant_z0(compF, prec=prec, emb=emb) cosh_delta = coshdelta(z0F) d = f.degree() hF = e**f.global_height(prec=prec) #get precomputed constants C,k if m == 1: C = 4 * d + 2 k = 2 else: Ck_values = {(False, 2, 2): (322, 6), (False, 2, 3): (385034, 14),\ (False, 2, 4): (4088003923454, 30), (False, 3, 2): (18044, 8),\ (False, 4, 2): (1761410, 10), (False, 5, 2): (269283820, 12),\ (True, 2, 2): (43, 4), (True, 2, 3): (106459, 12),\ (True, 2, 4): (39216735905, 24), (True, 3, 2): (1604, 6),\ (True, 4, 2): (114675, 8), (True, 5, 2): (14158456, 10)} try: C, k = Ck_values[(dynatomic, d, m)] except KeyError: raise ValueError("constants not computed for this (m,d) pair") if n == 2 and d == 2: #bound with epsilonF = 1 bound = 2 * ((2 * C * (hF**k)) / (thetaF)) else: bound = cosh(epsinv(F, (2**(n - 1)) * C * (hF**k) / thetaF, prec=prec)) return bound
def get_bound_dynamical(F, f, m=1, dynatomic=True, prec=53, emb=None): """ The hyperbolic distance from `j` which must contain the smallest map. This defines the maximum possible distance from `j` to the `z_0` covariant of the assocaited binary form `F` in the hyperbolic 3-space for which the map `f`` could have smaller coefficients. INPUT: - ``F`` -- binary form of degree at least 3 with no multiple roots associated to ``f`` - ``f`` -- a dynamical system on `P^1` - ``m`` - positive integer. the period used to create ``F`` - ``dyantomic`` -- boolean. whether ``F`` is the periodic points or the formal periodic points of period ``m`` for ``f`` - ``prec``-- positive integer. precision to use in CC - ``emb`` -- embedding into CC OUTPUT: a positive real number EXAMPLES:: sage: from sage.dynamics.arithmetic_dynamics.endPN_minimal_model import get_bound_dynamical sage: P.<x,y> = ProjectiveSpace(QQ,1) sage: f = DynamicalSystem([50*x^2 + 795*x*y + 2120*y^2, 265*x^2 + 106*y^2]) sage: get_bound_dynamical(f.dynatomic_polynomial(1), f) 35.5546923182219 """ def coshdelta(z): #The cosh of the hyperbolic distance from z = t+uj to j return (z.norm() + 1)/(2*z.imag()) if F.base_ring() != ComplexField(prec=prec): if emb is None: compF = F.change_ring(ComplexField(prec=prec)) else: compF = F.change_ring(emb) else: compF = F n = F.degree() z0F, thetaF = covariant_z0(compF, prec=prec, emb=emb) cosh_delta = coshdelta(z0F) d = f.degree() hF = e**f.global_height(prec=prec) #get precomputed constants C,k if m == 1: C = 4*d+2;k=2 else: Ck_values = {(False, 2, 2): (322, 6), (False, 2, 3): (385034, 14),\ (False, 2, 4): (4088003923454, 30), (False, 3, 2): (18044, 8),\ (False, 4, 2): (1761410, 10), (False, 5, 2): (269283820, 12),\ (True, 2, 2): (43, 4), (True, 2, 3): (106459, 12),\ (True, 2, 4): (39216735905, 24), (True, 3, 2): (1604, 6),\ (True, 4, 2): (114675, 8), (True, 5, 2): (14158456, 10)} try: C,k = Ck_values[(dynatomic,d,m)] except KeyError: raise ValueError("constants not computed for this (m,d) pair") if n == 2 and d == 2: #bound with epsilonF = 1 bound = 2*((2*C*(hF**k))/(thetaF)) else: bound = cosh(epsinv(F, (2**(n-1))*C*(hF**k)/thetaF, prec=prec)) return bound