Class JAS::WordRing
In: examples/jas.rb
Parent: Ring

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.

Methods

element   ideal   new   one   random   random   to_s   zero  

Public Class methods

Word polynomial ring constructor.

[Source]

      # File examples/jas.rb, line 3905
3905:     def initialize(ringstr="",ring=nil)
3906:         if ring == nil
3907:            raise "parse of word polynomial rings not implemented"
3908:            sr = StringReader.new( ringstr );
3909:            tok = GenPolynomialTokenizer.new(sr);
3910:            @pset = tok.nextWordPolynomialSet();
3911:            @ring = @pset.ring;
3912:         else
3913:            @ring = ring;
3914:         end
3915:         if not @ring.isAssociative()
3916:            puts "warning: ring is not associative";
3917:         end
3918:     end

Public Instance methods

Create an element from a string or object.

[Source]

      # File examples/jas.rb, line 3973
3973:     def element(poly)
3974:         if not poly.is_a? String 
3975:            begin
3976:               if @ring == poly.ring 
3977:                  return RingElem.new(poly);
3978:               end
3979:            rescue Exception => e
3980:               # pass
3981:            end
3982:            poly = str(poly);
3983:         end
3984:         ii = WordIdeal.new(self, "( " + poly + " )");
3985:         list = ii.pset.list;
3986:         if list.size > 0
3987:             return RingElem.new( list[0] );
3988:         end
3989:     end

Create a word ideal.

[Source]

      # File examples/jas.rb, line 3930
3930:     def ideal(ringstr="",list=nil)
3931:         return WordIdeal.new(self,ringstr,list);
3932:     end

Get the one of the word polynomial ring.

[Source]

      # File examples/jas.rb, line 3937
3937:     def one()
3938:         return RingElem.new( @ring.getONE() );
3939:     end

Get a random word polynomial.

[Source]

      # File examples/jas.rb, line 3951
3951:     def random(n=5)
3952:         r = @ring.random(n);
3953:         if @ring.coFac.isField()
3954:             r = r.monic();
3955:         end
3956:         return RingElem.new( r );
3957:     end

Get a random word polynomial.

[Source]

      # File examples/jas.rb, line 3962
3962:     def random(k=5,l=7,d=3)
3963:         r = @ring.random(k,l,d);
3964:         if @ring.coFac.isField()
3965:             r = r.monic();
3966:         end
3967:         return RingElem.new( r );
3968:     end

Create a string representation.

[Source]

      # File examples/jas.rb, line 3923
3923:     def to_s()
3924:         return @ring.toScript(); #.to_s;
3925:     end

Get the zero of the word polynomial ring.

[Source]

      # File examples/jas.rb, line 3944
3944:     def zero()
3945:         return RingElem.new( @ring.getZERO() );
3946:     end

[Validate]