コード例 #1
0
ファイル: chart.py プロジェクト: BrentBaccala/sage
    def __init__(self, domain, coordinates='', names=None, calc_method=None):
        r"""
        Construct a chart on a real differentiable manifold.

        TESTS::

            sage: forget()  # for doctests only
            sage: M = Manifold(2, 'M')
            sage: X.<x,y> = M.chart()
            sage: X
            Chart (M, (x, y))
            sage: type(X)
            <class 'sage.manifolds.differentiable.chart.RealDiffChart'>
            sage: assumptions()  # assumptions set in X._init_coordinates
            [x is real, y is real]
            sage: TestSuite(X).run()

        """
        RealChart.__init__(self,
                           domain,
                           coordinates=coordinates,
                           names=names,
                           calc_method=calc_method)
        # Construction of the coordinate frame associated to the chart:
        self._frame = CoordFrame(self)
        self._coframe = self._frame._coframe
コード例 #2
0
ファイル: chart.py プロジェクト: ipozdnyakov/sage
    def __init__(self, domain, coordinates='', names=None):
        r"""
        Construct a chart on a real differentiable manifold.

        TESTS::

            sage: forget()  # for doctests only
            sage: M = Manifold(2, 'M')
            sage: X.<x,y> = M.chart()
            sage: X
            Chart (M, (x, y))
            sage: type(X)
            <class 'sage.manifolds.differentiable.chart.RealDiffChart'>
            sage: assumptions()  # assumptions set in X._init_coordinates
            [x is real, y is real]
            sage: TestSuite(X).run()

        """
        RealChart.__init__(self, domain, coordinates=coordinates, names=names)
コード例 #3
0
ファイル: chart.py プロジェクト: yunboliu27/sage
    def restrict(self, subset, restrictions=None):
        r"""
        Return the restriction of the chart to some subset.

        If the current chart is `(U, \varphi)`, a *restriction* (or
        *subchart*) is a chart `(V, \psi)` such that `V \subset U`
        and `\psi = \varphi |_V`.

        If such subchart has not been defined yet, it is constructed here.

        The coordinates of the subchart bare the same names as the
        coordinates of the original chart.

        INPUT:

        - ``subset`` -- open subset `V` of the chart domain `U`
        - ``restrictions`` -- (default: ``None``) list of coordinate
          restrictions defining the subset `V`

        A restriction can be any symbolic equality or inequality involving
        the coordinates, such as ``x > y`` or ``x^2 + y^2 != 0``. The items
        of the list ``restrictions`` are combined with the ``and`` operator;
        if some restrictions are to be combined with the ``or`` operator
        instead, they have to be passed as a tuple in some single item
        of the list ``restrictions``. For example::

          restrictions = [x > y, (x != 0, y != 0), z^2 < x]

        means ``(x > y) and ((x != 0) or (y != 0)) and (z^2 < x)``.
        If the list ``restrictions`` contains only one item, this
        item can be passed as such, i.e. writing ``x > y`` instead
        of the single element list ``[x > y]``.

        OUTPUT:

        - a :class:`RealDiffChart` `(V, \psi)`

        EXAMPLES:

        Cartesian coordinates on the unit open disc in `\RR^2` as a subchart
        of the global Cartesian coordinates::

            sage: M = Manifold(2, 'R^2')
            sage: c_cart.<x,y> = M.chart() # Cartesian coordinates on R^2
            sage: D = M.open_subset('D') # the unit open disc
            sage: c_cart_D = c_cart.restrict(D, x^2+y^2<1)
            sage: p = M.point((1/2, 0))
            sage: p in D
            True
            sage: q = M.point((1, 2))
            sage: q in D
            False

        Cartesian coordinates on the annulus `1 < \sqrt{x^2+y^2} < 2`::

            sage: A = M.open_subset('A')
            sage: c_cart_A = c_cart.restrict(A, [x^2+y^2>1, x^2+y^2<4])
            sage: p in A, q in A
            (False, False)
            sage: a = M.point((3/2,0))
            sage: a in A
            True

        """
        if subset == self._domain:
            return self
        if subset not in self._dom_restrict:
            resu = RealChart.restrict(self, subset, restrictions=restrictions)
            # Update of superframes and subframes:
            resu._frame._superframes.update(self._frame._superframes)
            for sframe in self._frame._superframes:
                sframe._subframes.add(resu._frame)
                sframe._restrictions[subset] = resu._frame
            # The subchart frame is not a "top frame" in the supersets
            # (including self._domain):
            for dom in self._domain._supersets:
                if resu._frame in dom._top_frames:
                    # it was added by the Chart constructor invoked in
                    # Chart.restrict above
                    dom._top_frames.remove(resu._frame)
        return self._dom_restrict[subset]
コード例 #4
0
ファイル: chart.py プロジェクト: mcognetta/sage
    def restrict(self, subset, restrictions=None):
        r"""
        Return the restriction of the chart to some subset.

        If the current chart is `(U, \varphi)`, a *restriction* (or
        *subchart*) is a chart `(V, \psi)` such that `V \subset U`
        and `\psi = \varphi |_V`.

        If such subchart has not been defined yet, it is constructed here.

        The coordinates of the subchart bare the same names as the
        coordinates of the original chart.

        INPUT:

        - ``subset`` -- open subset `V` of the chart domain `U`
        - ``restrictions`` -- (default: ``None``) list of coordinate
          restrictions defining the subset `V`

        A restriction can be any symbolic equality or inequality involving
        the coordinates, such as ``x > y`` or ``x^2 + y^2 != 0``. The items
        of the list ``restrictions`` are combined with the ``and`` operator;
        if some restrictions are to be combined with the ``or`` operator
        instead, they have to be passed as a tuple in some single item
        of the list ``restrictions``. For example::

          restrictions = [x > y, (x != 0, y != 0), z^2 < x]

        means ``(x > y) and ((x != 0) or (y != 0)) and (z^2 < x)``.
        If the list ``restrictions`` contains only one item, this
        item can be passed as such, i.e. writing ``x > y`` instead
        of the single element list ``[x > y]``.

        OUTPUT:

        - a :class:`RealDiffChart` `(V, \psi)`

        EXAMPLES:

        Cartesian coordinates on the unit open disc in `\RR^2` as a subchart
        of the global Cartesian coordinates::

            sage: M = Manifold(2, 'R^2')
            sage: c_cart.<x,y> = M.chart() # Cartesian coordinates on R^2
            sage: D = M.open_subset('D') # the unit open disc
            sage: c_cart_D = c_cart.restrict(D, x^2+y^2<1)
            sage: p = M.point((1/2, 0))
            sage: p in D
            True
            sage: q = M.point((1, 2))
            sage: q in D
            False

        Cartesian coordinates on the annulus `1 < \sqrt{x^2+y^2} < 2`::

            sage: A = M.open_subset('A')
            sage: c_cart_A = c_cart.restrict(A, [x^2+y^2>1, x^2+y^2<4])
            sage: p in A, q in A
            (False, False)
            sage: a = M.point((3/2,0))
            sage: a in A
            True

        """
        if subset == self._domain:
            return self
        if subset not in self._dom_restrict:
            resu = RealChart.restrict(self, subset, restrictions=restrictions)
            # Update of superframes and subframes:
            resu._frame._superframes.update(self._frame._superframes)
            for sframe in self._frame._superframes:
                sframe._subframes.add(resu._frame)
                sframe._restrictions[subset] = resu._frame
            # The subchart frame is not a "top frame" in the supersets
            # (including self._domain):
            for dom in self._domain._supersets:
                if resu._frame in dom._top_frames:
                    # it was added by the Chart constructor invoked in
                    # Chart.restrict above
                    dom._top_frames.remove(resu._frame)
        return self._dom_restrict[subset]