Class JAS::SeriesRing
In: examples/jas.rb
Parent: Object

Represents a JAS power series ring: UnivPowerSeriesRing.

Methods for univariate power series arithmetic.

Methods

cos   create   exp   fixPoint   fromPoly   gcd   gens   new   one   random   sin   tan   to_s   zero  

Classes and Modules

Class JAS::SeriesRing::Ucoeff

Attributes

ring  [R] 

Public Class methods

Ring constructor.

[Source]

      # File examples/jas.rb, line 3214
3214:     def initialize(ringstr="",truncate=nil,ring=nil,cofac=nil,name="z")
3215:         if ring == nil
3216:             if ringstr.size > 0
3217:                 sr = StringReader.new( ringstr );
3218:                 tok = GenPolynomialTokenizer.new(sr);
3219:                 pset = tok.nextPolynomialSet();
3220:                 ring = pset.ring;
3221:                 vname = ring.vars;
3222:                 name = vname[0];
3223:                 cofac = ring.coFac;
3224:             end
3225:             if cofac.is_a? RingElem
3226:                 cofac = cofac.elem;
3227:             end
3228:             if truncate == nil
3229:                 @ring = UnivPowerSeriesRing.new(cofac,name);
3230:             else
3231:                 @ring = UnivPowerSeriesRing.new(cofac,truncate,name);
3232:             end
3233:         else
3234:            @ring = ring;
3235:         end
3236:     end

Public Instance methods

Get the cosinus power series.

[Source]

      # File examples/jas.rb, line 3292
3292:     def cos()
3293:         return RingElem.new( @ring.getCOS() );
3294:     end

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.

[Source]

      # File examples/jas.rb, line 3338
3338:     def create(ifunc,jfunc=nil,clazz=nil)
3339:         if clazz == nil
3340:             #puts "ifunc = " + ifunc.to_s + ".";
3341:             #puts "jfunc = " + jfunc.to_s + ".";
3342:             #puts "clazz = " + clazz.to_s + ".";
3343:             cf = Ucoeff.new(ifunc,jfunc,@ring.coFac);
3344:             #puts "cf    = " + cf.to_s + ".";
3345:             ps = UnivPowerSeries.new( @ring, cf );
3346:         else
3347:             ps = UnivPowerSeries.new( @ring, clazz );
3348:         end
3349:         return RingElem.new( ps );
3350:     end

Get the exponential power series.

[Source]

      # File examples/jas.rb, line 3278
3278:     def exp()
3279:         return RingElem.new( @ring.getEXP() );
3280:     end

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

psmap must implement the UnivPowerSeriesMap interface.

[Source]

      # File examples/jas.rb, line 3357
3357:     def fixPoint(psmap)
3358:         ps = @ring.fixPoint( psmap );
3359:         return RingElem.new( ps );
3360:     end

Convert a GenPolynomial to a power series.

[Source]

      # File examples/jas.rb, line 3378
3378:     def fromPoly(a)
3379:         if a.is_a? RingElem
3380:             a = a.elem;
3381:         end
3382:         return RingElem.new( @ring.fromPolynomial(a) );
3383:     end

Compute the greatest common divisor of a and b.

[Source]

      # File examples/jas.rb, line 3365
3365:     def gcd(a,b)
3366:         if a.is_a? RingElem
3367:             a = a.elem;
3368:         end
3369:         if b.is_a? RingElem
3370:             b = b.elem;
3371:         end
3372:         return RingElem.new( a.gcd(b) );
3373:     end

Get the generators of the power series ring.

[Source]

      # File examples/jas.rb, line 3248
3248:     def gens()
3249:         ll = @ring.generators();
3250:         nn = ll.map { |e| RingElem.new(e) };
3251:         return nn;
3252:     end

Get the one of the power series ring.

[Source]

      # File examples/jas.rb, line 3257
3257:     def one()
3258:         return RingElem.new( @ring.getONE() );
3259:     end

Get a random power series.

[Source]

      # File examples/jas.rb, line 3271
3271:     def random(n)
3272:         return RingElem.new( @ring.random(n) );
3273:     end

Get the sinus power series.

[Source]

      # File examples/jas.rb, line 3285
3285:     def sin()
3286:         return RingElem.new( @ring.getSIN() );
3287:     end

Get the tangens power series.

[Source]

      # File examples/jas.rb, line 3299
3299:     def tan()
3300:         return RingElem.new( @ring.getTAN() );
3301:     end

Create a string representation.

[Source]

      # File examples/jas.rb, line 3241
3241:     def to_s()
3242:         return @ring.toScript();
3243:     end

Get the zero of the power series ring.

[Source]

      # File examples/jas.rb, line 3264
3264:     def zero()
3265:         return RingElem.new( @ring.getZERO() );
3266:     end

[Validate]