def __init__(self, vector_field_module, degree, name=None, latex_name=None): r""" Construct a differential form. TESTS: Construction via ``parent.element_class``, and not via a direct call to ``DiffForm`, to fit with the category framework:: sage: M = Manifold(2, 'M') sage: U = M.open_subset('U') ; V = M.open_subset('V') sage: M.declare_union(U,V) # M is the union of U and V sage: c_xy.<x,y> = U.chart() ; c_uv.<u,v> = V.chart() sage: xy_to_uv = c_xy.transition_map(c_uv, (x+y, x-y), ....: intersection_name='W', restrictions1= x>0, ....: restrictions2= u+v>0) sage: uv_to_xy = xy_to_uv.inverse() sage: W = U.intersection(V) sage: e_xy = c_xy.frame() ; e_uv = c_uv.frame() sage: A = M.diff_form_module(2) sage: XM = M.vector_field_module() sage: a = A.element_class(XM, 2, name='a'); a 2-form a on the 2-dimensional differentiable manifold M sage: a[e_xy,0,1] = x+y sage: a.add_comp_by_continuation(e_uv, W, c_uv) sage: TestSuite(a).run(skip='_test_pickling') Construction with ``DifferentiableManifold.diff_form``:: sage: a1 = M.diff_form(2, name='a'); a1 2-form a on the 2-dimensional differentiable manifold M sage: type(a1) == type(a) True sage: a1.parent() is a.parent() True .. TODO:: Fix ``_test_pickling`` (in the superclass :class:`TensorField`). """ TensorField.__init__( self, vector_field_module, (0, degree), name=name, latex_name=latex_name, antisym=range(degree), parent=vector_field_module.dual_exterior_power(degree)) self._init_derived() # initialization of derived quantities
def __init__(self, tensor, embedding, screen=None): r""" TESTS:: sage: M = Manifold(4, 'M', structure="Lorentzian") sage: X.<t,x,y,z> = M.chart() sage: S = Manifold(3, 'S', ambient=M, structure='degenerate_metric') sage: X_S.<u,v,w> = S.chart() sage: Phi = S.diff_map(M, {(X_S, X): [u, u, v, w]}, ....: name='Phi', latex_name=r'\Phi'); sage: Phi_inv = M.diff_map(S, {(X, X_S): [x,y, z]}, name='Phi_inv', ....: latex_name=r'\Phi^{-1}'); sage: S.set_immersion(Phi, inverse=Phi_inv); S.declare_embedding() sage: g = M.metric() sage: g[0,0], g[1,1], g[2,2], g[3,3] = -1,1,1,1 sage: v = M.vector_field(); v[1] = 1 sage: S.set_transverse(rigging=v) sage: xi = M.vector_field(); xi[0] = 1; xi[1] = 1 sage: U = M.vector_field(); U[2] = 1; V = M.vector_field(); V[3] = 1 sage: Sc = S.screen('Sc', (U,V), xi); sage: T1 = M.tensor_field(1,1).along(Phi); T1[0,0] = 1 sage: from sage.manifolds.differentiable.degenerate_submanifold import TangentTensor sage: T2 = TangentTensor(T1, Phi); T2 Tensor field of type (1,1) along the degenerate hypersurface S embedded in 4-dimensional differentiable manifold M with values on the 4-dimensional Lorentzian manifold M """ if not isinstance(tensor, TensorField): raise TypeError("the second argument must be a tensor field") self._tensor = tensor self._tensor.set_name(tensor._name, latex_name=tensor._latex_name) self._embedding = embedding try: tensor = tensor.along(embedding) except ValueError: pass if isinstance(tensor, TensorFieldParal): TensorFieldParal.__init__(self, tensor._vmodule, tensor._tensor_type, name=tensor._name, latex_name=tensor._latex_name, sym=tensor._sym, antisym=tensor._antisym) else: TensorField.__init__(self, tensor._vmodule, tensor._tensor_type, name=tensor._name, latex_name=tensor._latex_name, sym=tensor._sym, antisym=tensor._antisym) f = tensor._domain._ambient.default_frame().along(embedding) self[f, :] = tensor[f, :] frame = self._domain.adapted_frame(screen) self.display(frame) for i in self._domain._ambient.index_generator(tensor.tensor_rank()): for j in range(len(i)): if i[j]==self._domain._ambient._dim-self._domain._sindex-1: self[frame, i] = 0
def __init__(self, vector_field_module, degree, name=None, latex_name=None): r""" Construct a differential form. TESTS: Construction via ``parent.element_class``, and not via a direct call to ``DiffForm`, to fit with the category framework:: sage: M = Manifold(2, 'M') sage: U = M.open_subset('U') ; V = M.open_subset('V') sage: M.declare_union(U,V) # M is the union of U and V sage: c_xy.<x,y> = U.chart() ; c_uv.<u,v> = V.chart() sage: xy_to_uv = c_xy.transition_map(c_uv, (x+y, x-y), ....: intersection_name='W', restrictions1= x>0, ....: restrictions2= u+v>0) sage: uv_to_xy = xy_to_uv.inverse() sage: W = U.intersection(V) sage: e_xy = c_xy.frame() ; e_uv = c_uv.frame() sage: A = M.diff_form_module(2) sage: XM = M.vector_field_module() sage: a = A.element_class(XM, 2, name='a'); a 2-form a on the 2-dimensional differentiable manifold M sage: a[e_xy,0,1] = x+y sage: a.add_comp_by_continuation(e_uv, W, c_uv) sage: TestSuite(a).run(skip='_test_pickling') Construction with ``DifferentiableManifold.diff_form``:: sage: a1 = M.diff_form(2, name='a'); a1 2-form a on the 2-dimensional differentiable manifold M sage: type(a1) == type(a) True sage: a1.parent() is a.parent() True .. TODO:: Fix ``_test_pickling`` (in the superclass :class:`TensorField`). """ TensorField.__init__(self, vector_field_module, (0,degree), name=name, latex_name=latex_name, antisym=range(degree), parent=vector_field_module.dual_exterior_power(degree)) self._init_derived() # initialization of derived quantities
def __init__(self, vector_field_module, name=None, latex_name=None): r""" Construct a vector field with values on a non-parallelizable manifold. TESTS: Construction via ``parent.element_class``, and not via a direct call to ``VectorField``, to fit with the category framework:: sage: M = Manifold(2, 'M') # the 2-dimensional sphere S^2 sage: U = M.open_subset('U') # complement of the North pole sage: c_xy.<x,y> = U.chart() # stereographic coordinates from the North pole sage: V = M.open_subset('V') # complement of the South pole sage: c_uv.<u,v> = V.chart() # stereographic coordinates from the South pole sage: M.declare_union(U,V) # S^2 is the union of U and V sage: XM = M.vector_field_module() sage: a = XM.element_class(XM, name='a'); a Vector field a on the 2-dimensional differentiable manifold M sage: a[c_xy.frame(),:] = [x, y] sage: a[c_uv.frame(),:] = [-u, -v] sage: TestSuite(a).run(skip='_test_pickling') Construction with ``DifferentiableManifold.vector_field``:: sage: a1 = M.vector_field(name='a'); a1 Vector field a on the 2-dimensional differentiable manifold M sage: type(a1) == type(a) True .. TODO:: Fix ``_test_pickling`` (in the superclass :class:`TensorField`). """ TensorField.__init__(self, vector_field_module, (1, 0), name=name, latex_name=latex_name) # Initialization of derived quantities: TensorField._init_derived(self) # Initialization of list of quantities depending on self: self._init_dependencies()
def __init__(self, vector_field_module, name=None, latex_name=None): r""" Construct a vector field with values on a non-parallelizable manifold. TESTS: Construction via ``parent.element_class``, and not via a direct call to ``VectorField``, to fit with the category framework:: sage: M = Manifold(2, 'M') # the 2-dimensional sphere S^2 sage: U = M.open_subset('U') # complement of the North pole sage: c_xy.<x,y> = U.chart() # stereographic coordinates from the North pole sage: V = M.open_subset('V') # complement of the South pole sage: c_uv.<u,v> = V.chart() # stereographic coordinates from the South pole sage: M.declare_union(U,V) # S^2 is the union of U and V sage: XM = M.vector_field_module() sage: a = XM.element_class(XM, name='a'); a Vector field a on the 2-dimensional differentiable manifold M sage: a[c_xy.frame(),:] = [x, y] sage: a[c_uv.frame(),:] = [-u, -v] sage: TestSuite(a).run(skip='_test_pickling') Construction with ``DifferentiableManifold.vector_field``:: sage: a1 = M.vector_field(name='a'); a1 Vector field a on the 2-dimensional differentiable manifold M sage: type(a1) == type(a) True .. TODO:: Fix ``_test_pickling`` (in the superclass :class:`TensorField`). """ TensorField.__init__(self, vector_field_module, (1,0), name=name, latex_name=latex_name) # Initialization of derived quantities: TensorField._init_derived(self) # Initialization of list of quantities depending on self: self._init_dependencies()
def __init__(self, vector_field_module, name=None, latex_name=None, is_identity=False): r""" Construct a field of tangent-space automorphisms on a non-parallelizable manifold. TESTS: Construction via ``parent.element_class``, and not via a direct call to ``AutomorphismField``, to fit with the category framework:: sage: M = Manifold(2, 'M') sage: U = M.open_subset('U') ; V = M.open_subset('V') sage: M.declare_union(U,V) # M is the union of U and V sage: c_xy.<x,y> = U.chart() ; c_uv.<u,v> = V.chart() sage: transf = c_xy.transition_map(c_uv, (x+y, x-y), intersection_name='W', ....: restrictions1= x>0, restrictions2= u+v>0) sage: inv = transf.inverse() sage: XM = M.vector_field_module() sage: GL = XM.general_linear_group() sage: a = GL.element_class(XM, name='a'); a Field of tangent-space automorphisms a on the 2-dimensional differentiable manifold M sage: a[c_xy.frame(), :] = [[1+x^2, 0], [0, 1+y^2]] sage: a.add_comp_by_continuation(c_uv.frame(), U.intersection(V), c_uv) sage: TestSuite(a).run(skip='_test_pickling') Construction of the identity field:: sage: b = GL.element_class(XM, is_identity=True); b Field of tangent-space identity maps on the 2-dimensional differentiable manifold M sage: TestSuite(b).run(skip='_test_pickling') Construction with ``DifferentiableManifold.automorphism_field``:: sage: a1 = M.automorphism_field(name='a'); a1 Field of tangent-space automorphisms a on the 2-dimensional differentiable manifold M sage: type(a1) == type(a) True .. TODO:: Fix ``_test_pickling`` (in the superclass :class:`TensorField`). """ if is_identity: if name is None: name = 'Id' if latex_name is None and name == 'Id': latex_name = r'\mathrm{Id}' TensorField.__init__(self, vector_field_module, (1,1), name=name, latex_name=latex_name, parent=vector_field_module.general_linear_group()) self._is_identity = is_identity self._init_derived() # initialization of derived quantities # Specific initializations for the field of identity maps: if self._is_identity: self._inverse = self for dom in self._domain._subsets: if dom.is_manifestly_parallelizable(): fmodule = dom.vector_field_module() self._restrictions[dom] = fmodule.identity_map(name=name, latex_name=latex_name)