@@ -800,6 +800,94 @@ cdef class SymbolicRing(CommutativeRing):
800
800
return _the_element.subs(d, ** kwds)
801
801
802
802
def subring (self , *args , **kwds ):
803
+ r """
804
+ Create a subring of this symbolic ring.
805
+
806
+ INPUT:
807
+
808
+ Choose one of the following keywords to create a subring.
809
+
810
+ - ``accepting_variables`` ( default: ``None``) -- a tuple or other
811
+ iterable of variables. If specified, then a symbolic subring of
812
+ expressions in only these variables is created.
813
+
814
+ - ``rejecting_variables`` ( default: ``None``) -- a tuple or other
815
+ iterable of variables. If specified, then a symbolic subring of
816
+ expressions in variables distinct to these variables is
817
+ created.
818
+
819
+ - ``only_constants`` ( default: ``False``) -- a boolean. If set,
820
+ then a symbolic subring of constant expressions ( i. e. ,
821
+ expressions without a variable) is created.
822
+
823
+ OUTPUT:
824
+
825
+ A ring.
826
+
827
+ EXAMPLES:
828
+
829
+ Let us create a couple of symbolic variables first::
830
+
831
+ sage: V = var( 'a, b, r, s, x, y')
832
+
833
+ Now we create a symbolic subring only accepting expressions in
834
+ the variables `a` and `b`::
835
+
836
+ sage: A = SR. subring( accepting_variables=( a, b)) ; A
837
+ Symbolic Subring accepting the variables a, b
838
+
839
+ An element is
840
+ ::
841
+
842
+ sage: A. an_element( )
843
+ a
844
+
845
+ From our variables in `V` the following are valid in `A`::
846
+
847
+ sage: tuple( v for v in V if v in A)
848
+ ( a, b)
849
+
850
+ Next, we create a symbolic subring rejecting expressions with
851
+ given variables::
852
+
853
+ sage: R = SR. subring( rejecting_variables=( r, s)) ; R
854
+ Symbolic Subring rejecting the variables r, s
855
+
856
+ An element is
857
+ ::
858
+
859
+ sage: R. an_element( )
860
+ some_variable
861
+
862
+ From our variables in `V` the following are valid in `R`::
863
+
864
+ sage: tuple( v for v in V if v in R)
865
+ ( a, b, x, y)
866
+
867
+ We have a third kind of subring, namely the subring of
868
+ symbolic constants::
869
+
870
+ sage: C = SR. subring( only_constants=True) ; C
871
+ Symbolic Constants Subring
872
+
873
+ Note that this subring can be considered as a special accepting
874
+ subring; one without any variables.
875
+
876
+ An element is
877
+ ::
878
+
879
+ sage: C. an_element( )
880
+ I* pi* e
881
+
882
+ None of our variables in `V` is valid in `C`::
883
+
884
+ sage: tuple( v for v in V if v in C)
885
+ ( )
886
+
887
+ .. SEEALSO::
888
+
889
+ :doc:`subring`
890
+ """
803
891
if self is not SR:
804
892
raise NotImplementedError (' Cannot create subring of %s .' % (self ,))
805
893
from subring import SymbolicSubring
0 commit comments