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
5300 def initialize(ringstr="",truncate=nil,ring=nil,cofac=nil,name="z")
5301     if ring == nil
5302         if ringstr.size > 0
5303             sr = StringReader.new( ringstr );
5304             tok = RingFactoryTokenizer.new(sr);
5305             pfac = tok.nextPolynomialRing();
5306             #tok = GenPolynomialTokenizer.new(sr);
5307             #pset = tok.nextPolynomialSet();
5308             ring = pfac;
5309             vname = ring.vars;
5310             name = vname[0];
5311             cofac = ring.coFac;
5312         end
5313         if cofac.is_a? RingElem
5314             cofac = cofac.elem;
5315         end
5316         if truncate == nil
5317             @ring = UnivPowerSeriesRing.new(cofac,name);
5318         else
5319             @ring = UnivPowerSeriesRing.new(cofac,truncate,name);
5320         end
5321     else
5322        @ring = ring;
5323     end
5324 end

Public Instance Methods

cos() click to toggle source

Get the cosinus power series.

     # File examples/jas.rb
5380 def cos()
5381     return RingElem.new( @ring.getCOS() );
5382 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
5437 def create(ifunc,jfunc=nil,clazz=nil)
5438     if clazz == nil
5439         #puts "ifunc = " + ifunc.to_s + ".";
5440         #puts "jfunc = " + jfunc.to_s + ".";
5441         #puts "clazz = " + clazz.to_s + ".";
5442         cf = Ucoeff.new(ifunc,jfunc,@ring.coFac);
5443         #puts "cf    = " + cf.to_s + ".";
5444         ps = UnivPowerSeries.new( @ring, cf );
5445     else
5446         ps = UnivPowerSeries.new( @ring, clazz );
5447     end
5448     return RingElem.new( ps );
5449 end
exp() click to toggle source

Get the exponential power series.

     # File examples/jas.rb
5366 def exp()
5367     return RingElem.new( @ring.getEXP() );
5368 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
5456 def fixPoint(psmap)
5457     ps = @ring.fixPoint( psmap );
5458     return RingElem.new( ps );
5459 end
fromPoly(a) click to toggle source

Convert a GenPolynomial to a power series.

     # File examples/jas.rb
5477 def fromPoly(a)
5478     if a.is_a? RingElem
5479         a = a.elem;
5480     end
5481     return RingElem.new( @ring.fromPolynomial(a) );
5482 end
gcd(a,b) click to toggle source

Compute the greatest common divisor of a and b.

     # File examples/jas.rb
5464 def gcd(a,b)
5465     if a.is_a? RingElem
5466         a = a.elem;
5467     end
5468     if b.is_a? RingElem
5469         b = b.elem;
5470     end
5471     return RingElem.new( a.gcd(b) );
5472 end
gens() click to toggle source

Get the generators of the power series ring.

     # File examples/jas.rb
5336 def gens()
5337     ll = @ring.generators();
5338     nn = ll.map { |e| RingElem.new(e) };
5339     return nn;
5340 end
one() click to toggle source

Get the one of the power series ring.

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

Get a random power series.

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

Get the sinus power series.

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

Get the tangens power series.

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

Create a string representation.

     # File examples/jas.rb
5329 def to_s()
5330     return @ring.toScript();
5331 end
zero() click to toggle source

Get the zero of the power series ring.

     # File examples/jas.rb
5352 def zero()
5353     return RingElem.new( @ring.getZERO() );
5354 end