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 _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 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 _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): r""" The derivative of `\operatorname{Shi}(z)` is `\sinh(z)/z`. EXAMPLES:: sage: x = var('x') sage: f = sinh_integral(x) sage: f.diff(x) sinh(x)/x sage: f = sinh_integral(ln(x)) sage: f.diff(x) sinh(log(x))/(x*log(x)) """ return sinh(z)/z
def _derivative_(self, z, diff_param=None): r""" The derivative of `\operatorname{Shi}(z)` is `\sinh(z)/z`. EXAMPLES:: sage: x = var('x') sage: f = sinh_integral(x) sage: f.diff(x) sinh(x)/x sage: f = sinh_integral(ln(x)) sage: f.diff(x) sinh(log(x))/(x*log(x)) """ return sinh(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)