class JAS::WordRing
Represents a JAS non-commutative polynomial ring: GenWordPolynomialRing.
Has a method to create non-commutative ideals. Note: watch your step: check that jruby does not reorder multiplication.
Public Class Methods
new(ringstr="",ring=nil)
click to toggle source
Word polynomial ring constructor.
# File examples/jas.rb 5914 def initialize(ringstr="",ring=nil) 5915 if ring == nil 5916 #raise "parse of word polynomial rings not implemented" 5917 sr = StringReader.new( ringstr ); 5918 tok = RingFactoryTokenizer.new(sr); 5919 pfac = tok.nextPolynomialRing(); 5920 wfac = GenWordPolynomialRing.new(pfac); 5921 #@list = tok.nextWordPolynomialList(wfac); 5922 @ring = wfac; 5923 else 5924 if ring.is_a? Ring 5925 @ring = ring.ring 5926 else 5927 @ring = ring; 5928 end 5929 end 5930 end
Public Instance Methods
element(poly)
click to toggle source
Create an element from a string or object.
# File examples/jas.rb 5985 def element(poly) 5986 if not poly.is_a? String 5987 begin 5988 if @ring == poly.ring 5989 return RingElem.new(poly); 5990 end 5991 rescue => e 5992 # pass 5993 end 5994 poly = str(poly); 5995 end 5996 ii = WordPolyIdeal.new(self, "( " + poly + " )"); # should work 5997 list = ii.list; 5998 if list.size > 0 5999 return RingElem.new( list[0] ); 6000 end 6001 end
ideal(ringstr="",list=nil)
click to toggle source
Create a word ideal.
# File examples/jas.rb 5942 def ideal(ringstr="",list=nil) 5943 return WordPolyIdeal.new(self, ringstr, list); 5944 end
one()
click to toggle source
Get the one of the word polynomial ring.
# File examples/jas.rb 5949 def one() 5950 return RingElem.new( @ring.getONE() ); 5951 end
random(n=5)
click to toggle source
Get a random word polynomial.
# File examples/jas.rb 5963 def random(n=5) 5964 r = @ring.random(n); 5965 if @ring.coFac.isField() 5966 r = r.monic(); 5967 end 5968 return RingElem.new( r ); 5969 end
to_s()
click to toggle source
Create a string representation.
# File examples/jas.rb 5935 def to_s() 5936 return @ring.toScript(); #.to_s; 5937 end
zero()
click to toggle source
Get the zero of the word polynomial ring.
# File examples/jas.rb 5956 def zero() 5957 return RingElem.new( @ring.getZERO() ); 5958 end