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 5938 def initialize(ringstr="",ring=nil) 5939 if ring == nil 5940 #raise "parse of word polynomial rings not implemented" 5941 sr = StringReader.new( ringstr ); 5942 tok = RingFactoryTokenizer.new(sr); 5943 pfac = tok.nextPolynomialRing(); 5944 wfac = GenWordPolynomialRing.new(pfac); 5945 #@list = tok.nextWordPolynomialList(wfac); 5946 @ring = wfac; 5947 else 5948 if ring.is_a? Ring 5949 @ring = ring.ring 5950 else 5951 @ring = ring; 5952 end 5953 end 5954 end
Public Instance Methods
element(poly)
click to toggle source
Create an element from a string or object.
# File examples/jas.rb 6009 def element(poly) 6010 if not poly.is_a? String 6011 begin 6012 if @ring == poly.ring 6013 return RingElem.new(poly); 6014 end 6015 rescue => e 6016 # pass 6017 end 6018 poly = str(poly); 6019 end 6020 ii = WordPolyIdeal.new(self, "( " + poly + " )"); # should work 6021 list = ii.list; 6022 if list.size > 0 6023 return RingElem.new( list[0] ); 6024 end 6025 end
ideal(ringstr="",list=nil)
click to toggle source
Create a word ideal.
# File examples/jas.rb 5966 def ideal(ringstr="",list=nil) 5967 return WordPolyIdeal.new(self, ringstr, list); 5968 end
one()
click to toggle source
Get the one of the word polynomial ring.
# File examples/jas.rb 5973 def one() 5974 return RingElem.new( @ring.getONE() ); 5975 end
random(n=5)
click to toggle source
Get a random word polynomial.
# File examples/jas.rb 5987 def random(n=5) 5988 r = @ring.random(n); 5989 if @ring.coFac.isField() 5990 r = r.monic(); 5991 end 5992 return RingElem.new( r ); 5993 end
to_s()
click to toggle source
Create a string representation.
# File examples/jas.rb 5959 def to_s() 5960 return @ring.toScript(); #.to_s; 5961 end
zero()
click to toggle source
Get the zero of the word polynomial ring.
# File examples/jas.rb 5980 def zero() 5981 return RingElem.new( @ring.getZERO() ); 5982 end