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
5162 def initialize(ringstr="",truncate=nil,ring=nil,cofac=nil,name="z")
5163     if ring == nil
5164         if ringstr.size > 0
5165             sr = StringReader.new( ringstr );
5166             tok = RingFactoryTokenizer.new(sr);
5167             pfac = tok.nextPolynomialRing();
5168             #tok = GenPolynomialTokenizer.new(sr);
5169             #pset = tok.nextPolynomialSet();
5170             ring = pfac;
5171             vname = ring.vars;
5172             name = vname[0];
5173             cofac = ring.coFac;
5174         end
5175         if cofac.is_a? RingElem
5176             cofac = cofac.elem;
5177         end
5178         if truncate == nil
5179             @ring = UnivPowerSeriesRing.new(cofac,name);
5180         else
5181             @ring = UnivPowerSeriesRing.new(cofac,truncate,name);
5182         end
5183     else
5184        @ring = ring;
5185     end
5186 end

Public Instance Methods

cos() click to toggle source

Get the cosinus power series.

     # File examples/jas.rb
5242 def cos()
5243     return RingElem.new( @ring.getCOS() );
5244 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
5299 def create(ifunc,jfunc=nil,clazz=nil)
5300     if clazz == nil
5301         #puts "ifunc = " + ifunc.to_s + ".";
5302         #puts "jfunc = " + jfunc.to_s + ".";
5303         #puts "clazz = " + clazz.to_s + ".";
5304         cf = Ucoeff.new(ifunc,jfunc,@ring.coFac);
5305         #puts "cf    = " + cf.to_s + ".";
5306         ps = UnivPowerSeries.new( @ring, cf );
5307     else
5308         ps = UnivPowerSeries.new( @ring, clazz );
5309     end
5310     return RingElem.new( ps );
5311 end
exp() click to toggle source

Get the exponential power series.

     # File examples/jas.rb
5228 def exp()
5229     return RingElem.new( @ring.getEXP() );
5230 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
5318 def fixPoint(psmap)
5319     ps = @ring.fixPoint( psmap );
5320     return RingElem.new( ps );
5321 end
fromPoly(a) click to toggle source

Convert a GenPolynomial to a power series.

     # File examples/jas.rb
5339 def fromPoly(a)
5340     if a.is_a? RingElem
5341         a = a.elem;
5342     end
5343     return RingElem.new( @ring.fromPolynomial(a) );
5344 end
gcd(a,b) click to toggle source

Compute the greatest common divisor of a and b.

     # File examples/jas.rb
5326 def gcd(a,b)
5327     if a.is_a? RingElem
5328         a = a.elem;
5329     end
5330     if b.is_a? RingElem
5331         b = b.elem;
5332     end
5333     return RingElem.new( a.gcd(b) );
5334 end
gens() click to toggle source

Get the generators of the power series ring.

     # File examples/jas.rb
5198 def gens()
5199     ll = @ring.generators();
5200     nn = ll.map { |e| RingElem.new(e) };
5201     return nn;
5202 end
one() click to toggle source

Get the one of the power series ring.

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

Get a random power series.

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

Get the sinus power series.

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

Get the tangens power series.

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

Create a string representation.

     # File examples/jas.rb
5191 def to_s()
5192     return @ring.toScript();
5193 end
zero() click to toggle source

Get the zero of the power series ring.

     # File examples/jas.rb
5214 def zero()
5215     return RingElem.new( @ring.getZERO() );
5216 end