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 5138 def initialize(ringstr="",truncate=nil,ring=nil,cofac=nil,name="z") 5139 if ring == nil 5140 if ringstr.size > 0 5141 sr = StringReader.new( ringstr ); 5142 tok = RingFactoryTokenizer.new(sr); 5143 pfac = tok.nextPolynomialRing(); 5144 #tok = GenPolynomialTokenizer.new(sr); 5145 #pset = tok.nextPolynomialSet(); 5146 ring = pfac; 5147 vname = ring.vars; 5148 name = vname[0]; 5149 cofac = ring.coFac; 5150 end 5151 if cofac.is_a? RingElem 5152 cofac = cofac.elem; 5153 end 5154 if truncate == nil 5155 @ring = UnivPowerSeriesRing.new(cofac,name); 5156 else 5157 @ring = UnivPowerSeriesRing.new(cofac,truncate,name); 5158 end 5159 else 5160 @ring = ring; 5161 end 5162 end
Public Instance Methods
Get the cosinus power series.
# File examples/jas.rb 5218 def cos() 5219 return RingElem.new( @ring.getCOS() ); 5220 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 5275 def create(ifunc,jfunc=nil,clazz=nil) 5276 if clazz == nil 5277 #puts "ifunc = " + ifunc.to_s + "."; 5278 #puts "jfunc = " + jfunc.to_s + "."; 5279 #puts "clazz = " + clazz.to_s + "."; 5280 cf = Ucoeff.new(ifunc,jfunc,@ring.coFac); 5281 #puts "cf = " + cf.to_s + "."; 5282 ps = UnivPowerSeries.new( @ring, cf ); 5283 else 5284 ps = UnivPowerSeries.new( @ring, clazz ); 5285 end 5286 return RingElem.new( ps ); 5287 end
Get the exponential power series.
# File examples/jas.rb 5204 def exp() 5205 return RingElem.new( @ring.getEXP() ); 5206 end
Create a power series as fixed point of the given mapping.
psmap must implement the UnivPowerSeriesMap interface.
# File examples/jas.rb 5294 def fixPoint(psmap) 5295 ps = @ring.fixPoint( psmap ); 5296 return RingElem.new( ps ); 5297 end
Convert a GenPolynomial to a power series.
# File examples/jas.rb 5315 def fromPoly(a) 5316 if a.is_a? RingElem 5317 a = a.elem; 5318 end 5319 return RingElem.new( @ring.fromPolynomial(a) ); 5320 end
Compute the greatest common divisor of a and b.
# File examples/jas.rb 5302 def gcd(a,b) 5303 if a.is_a? RingElem 5304 a = a.elem; 5305 end 5306 if b.is_a? RingElem 5307 b = b.elem; 5308 end 5309 return RingElem.new( a.gcd(b) ); 5310 end
Get the generators of the power series ring.
# File examples/jas.rb 5174 def gens() 5175 ll = @ring.generators(); 5176 nn = ll.map { |e| RingElem.new(e) }; 5177 return nn; 5178 end
Get the one of the power series ring.
# File examples/jas.rb 5183 def one() 5184 return RingElem.new( @ring.getONE() ); 5185 end
Get a random power series.
# File examples/jas.rb 5197 def random(n) 5198 return RingElem.new( @ring.random(n) ); 5199 end
Get the sinus power series.
# File examples/jas.rb 5211 def sin() 5212 return RingElem.new( @ring.getSIN() ); 5213 end
Get the tangens power series.
# File examples/jas.rb 5225 def tan() 5226 return RingElem.new( @ring.getTAN() ); 5227 end
Create a string representation.
# File examples/jas.rb 5167 def to_s() 5168 return @ring.toScript(); 5169 end
Get the zero of the power series ring.
# File examples/jas.rb 5190 def zero() 5191 return RingElem.new( @ring.getZERO() ); 5192 end