Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
""" Substitution Maps
This object wraps Pynac ``exmap`` objects. These encode substitutions of symbolic expressions. The main use of this module is to hook into Pynac's ``subs()`` methods and pass a wrapper for the substitution map back to Python. """
#***************************************************************************** # Copyright (C) 2013 Volker Braun <vbraun.name@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # http://www.gnu.org/licenses/ #*****************************************************************************
from sage.libs.pynac.pynac cimport * from sage.symbolic.expression cimport Expression, new_Expression_from_GEx
cdef class SubstitutionMap(SageObject):
cpdef Expression apply_to(self, Expression expr, unsigned options): """ Apply the substitution to a symbolic expression
EXAMPLES::
sage: from sage.symbolic.substitution_map import make_map sage: subs = make_map({x:x+1}) sage: subs.apply_to(x^2, 0) (x + 1)^2 """
def _repr_(self): """ Return the string representation
EXAMPLES::
sage: from sage.symbolic.substitution_map import make_map sage: make_map({x:x+1}) SubsMap """
cdef SubstitutionMap new_SubstitutionMap_from_GExMap(const GExMap& smap): """ Wrap a Pynac object into a Python object
INPUT:
- ``smap`` -- a Pynac ``exmap``.
OUTPUT:
A new Python :class:`SubstitutionMap`
EXAMPLES::
sage: from sage.symbolic.substitution_map import make_map sage: make_map({x:x+1}) SubsMap """ cdef SubstitutionMap result
cpdef SubstitutionMap make_map(subs_dict): """ Construct a new substitution map
OUTPUT:
A new :class:`SubstitutionMap` for doctesting
EXAMPLES::
sage: from sage.symbolic.substitution_map import make_map sage: make_map({x:x+1}) SubsMap """ cdef GExMap smap (<Expression>v)._gobj))
|