class JAS::SeriesRing
Represents a JAS power series ring: UnivPowerSeriesRing.
Methods for univariate power series arithmetic.
Attributes
the Java polynomial ring
Public Class Methods
Ring constructor.
# File examples/jas.rb 4921 def initialize(ringstr="",truncate=nil,ring=nil,cofac=nil,name="z") 4922 if ring == nil 4923 if ringstr.size > 0 4924 sr = StringReader.new( ringstr ); 4925 tok = RingFactoryTokenizer.new(sr); 4926 pfac = tok.nextPolynomialRing(); 4927 #tok = GenPolynomialTokenizer.new(sr); 4928 #pset = tok.nextPolynomialSet(); 4929 ring = pfac; 4930 vname = ring.vars; 4931 name = vname[0]; 4932 cofac = ring.coFac; 4933 end 4934 if cofac.is_a? RingElem 4935 cofac = cofac.elem; 4936 end 4937 if truncate == nil 4938 @ring = UnivPowerSeriesRing.new(cofac,name); 4939 else 4940 @ring = UnivPowerSeriesRing.new(cofac,truncate,name); 4941 end 4942 else 4943 @ring = ring; 4944 end 4945 end
Public Instance Methods
Get the cosinus power series.
# File examples/jas.rb 5001 def cos() 5002 return RingElem.new( @ring.getCOS() ); 5003 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.
# File examples/jas.rb 5058 def create(ifunc,jfunc=nil,clazz=nil) 5059 if clazz == nil 5060 #puts "ifunc = " + ifunc.to_s + "."; 5061 #puts "jfunc = " + jfunc.to_s + "."; 5062 #puts "clazz = " + clazz.to_s + "."; 5063 cf = Ucoeff.new(ifunc,jfunc,@ring.coFac); 5064 #puts "cf = " + cf.to_s + "."; 5065 ps = UnivPowerSeries.new( @ring, cf ); 5066 else 5067 ps = UnivPowerSeries.new( @ring, clazz ); 5068 end 5069 return RingElem.new( ps ); 5070 end
Get the exponential power series.
# File examples/jas.rb 4987 def exp() 4988 return RingElem.new( @ring.getEXP() ); 4989 end
Create a power series as fixed point of the given mapping.
psmap must implement the UnivPowerSeriesMap interface.
# File examples/jas.rb 5077 def fixPoint(psmap) 5078 ps = @ring.fixPoint( psmap ); 5079 return RingElem.new( ps ); 5080 end
Convert a GenPolynomial to a power series.
# File examples/jas.rb 5098 def fromPoly(a) 5099 if a.is_a? RingElem 5100 a = a.elem; 5101 end 5102 return RingElem.new( @ring.fromPolynomial(a) ); 5103 end
Compute the greatest common divisor of a and b.
# File examples/jas.rb 5085 def gcd(a,b) 5086 if a.is_a? RingElem 5087 a = a.elem; 5088 end 5089 if b.is_a? RingElem 5090 b = b.elem; 5091 end 5092 return RingElem.new( a.gcd(b) ); 5093 end
Get the generators of the power series ring.
# File examples/jas.rb 4957 def gens() 4958 ll = @ring.generators(); 4959 nn = ll.map { |e| RingElem.new(e) }; 4960 return nn; 4961 end
Get the one of the power series ring.
# File examples/jas.rb 4966 def one() 4967 return RingElem.new( @ring.getONE() ); 4968 end
Get a random power series.
# File examples/jas.rb 4980 def random(n) 4981 return RingElem.new( @ring.random(n) ); 4982 end
Get the sinus power series.
# File examples/jas.rb 4994 def sin() 4995 return RingElem.new( @ring.getSIN() ); 4996 end
Get the tangens power series.
# File examples/jas.rb 5008 def tan() 5009 return RingElem.new( @ring.getTAN() ); 5010 end
Create a string representation.
# File examples/jas.rb 4950 def to_s() 4951 return @ring.toScript(); 4952 end
Get the zero of the power series ring.
# File examples/jas.rb 4973 def zero() 4974 return RingElem.new( @ring.getZERO() ); 4975 end