class JAS::SeriesRing

Represents a JAS power series ring: UnivPowerSeriesRing.

Methods for univariate power series arithmetic.

Attributes

ring[R]

the Java polynomial ring

Public Class Methods

new(ringstr="",truncate=nil,ring=nil,cofac=nil,name="z") click to toggle source

Ring constructor.

     # File examples/jas.rb
4974 def initialize(ringstr="",truncate=nil,ring=nil,cofac=nil,name="z")
4975     if ring == nil
4976         if ringstr.size > 0
4977             sr = StringReader.new( ringstr );
4978             tok = RingFactoryTokenizer.new(sr);
4979             pfac = tok.nextPolynomialRing();
4980             #tok = GenPolynomialTokenizer.new(sr);
4981             #pset = tok.nextPolynomialSet();
4982             ring = pfac;
4983             vname = ring.vars;
4984             name = vname[0];
4985             cofac = ring.coFac;
4986         end
4987         if cofac.is_a? RingElem
4988             cofac = cofac.elem;
4989         end
4990         if truncate == nil
4991             @ring = UnivPowerSeriesRing.new(cofac,name);
4992         else
4993             @ring = UnivPowerSeriesRing.new(cofac,truncate,name);
4994         end
4995     else
4996        @ring = ring;
4997     end
4998 end

Public Instance Methods

cos() click to toggle source

Get the cosinus power series.

     # File examples/jas.rb
5054 def cos()
5055     return RingElem.new( @ring.getCOS() );
5056 end
create(ifunc,jfunc=nil,clazz=nil) click to toggle source

Create a power series with given generating function.

ifunc(int i) must return a value which is used in RingFactory.fromInteger(). jfunc(int i) must return a value of type ring.coFac. clazz must implement the Coefficients abstract class.

     # File examples/jas.rb
5111 def create(ifunc,jfunc=nil,clazz=nil)
5112     if clazz == nil
5113         #puts "ifunc = " + ifunc.to_s + ".";
5114         #puts "jfunc = " + jfunc.to_s + ".";
5115         #puts "clazz = " + clazz.to_s + ".";
5116         cf = Ucoeff.new(ifunc,jfunc,@ring.coFac);
5117         #puts "cf    = " + cf.to_s + ".";
5118         ps = UnivPowerSeries.new( @ring, cf );
5119     else
5120         ps = UnivPowerSeries.new( @ring, clazz );
5121     end
5122     return RingElem.new( ps );
5123 end
exp() click to toggle source

Get the exponential power series.

     # File examples/jas.rb
5040 def exp()
5041     return RingElem.new( @ring.getEXP() );
5042 end
fixPoint(psmap) click to toggle source

Create a power series as fixed point of the given mapping.

psmap must implement the UnivPowerSeriesMap interface.

     # File examples/jas.rb
5130 def fixPoint(psmap)
5131     ps = @ring.fixPoint( psmap );
5132     return RingElem.new( ps );
5133 end
fromPoly(a) click to toggle source

Convert a GenPolynomial to a power series.

     # File examples/jas.rb
5151 def fromPoly(a)
5152     if a.is_a? RingElem
5153         a = a.elem;
5154     end
5155     return RingElem.new( @ring.fromPolynomial(a) );
5156 end
gcd(a,b) click to toggle source

Compute the greatest common divisor of a and b.

     # File examples/jas.rb
5138 def gcd(a,b)
5139     if a.is_a? RingElem
5140         a = a.elem;
5141     end
5142     if b.is_a? RingElem
5143         b = b.elem;
5144     end
5145     return RingElem.new( a.gcd(b) );
5146 end
gens() click to toggle source

Get the generators of the power series ring.

     # File examples/jas.rb
5010 def gens()
5011     ll = @ring.generators();
5012     nn = ll.map { |e| RingElem.new(e) };
5013     return nn;
5014 end
one() click to toggle source

Get the one of the power series ring.

     # File examples/jas.rb
5019 def one()
5020     return RingElem.new( @ring.getONE() );
5021 end
random(n) click to toggle source

Get a random power series.

     # File examples/jas.rb
5033 def random(n)
5034     return RingElem.new( @ring.random(n) );
5035 end
sin() click to toggle source

Get the sinus power series.

     # File examples/jas.rb
5047 def sin()
5048     return RingElem.new( @ring.getSIN() );
5049 end
tan() click to toggle source

Get the tangens power series.

     # File examples/jas.rb
5061 def tan()
5062     return RingElem.new( @ring.getTAN() );
5063 end
to_s() click to toggle source

Create a string representation.

     # File examples/jas.rb
5003 def to_s()
5004     return @ring.toScript();
5005 end
zero() click to toggle source

Get the zero of the power series ring.

     # File examples/jas.rb
5026 def zero()
5027     return RingElem.new( @ring.getZERO() );
5028 end