edu.jas.ps
Class MultiVarPowerSeriesRing<C extends RingElem<C>>

java.lang.Object
  extended by edu.jas.ps.MultiVarPowerSeriesRing<C>
Type Parameters:
C - ring element type
All Implemented Interfaces:
AbelianGroupFactory<MultiVarPowerSeries<C>>, ElemFactory<MultiVarPowerSeries<C>>, MonoidFactory<MultiVarPowerSeries<C>>, RingFactory<MultiVarPowerSeries<C>>, java.io.Serializable

public class MultiVarPowerSeriesRing<C extends RingElem<C>>
extends java.lang.Object
implements RingFactory<MultiVarPowerSeries<C>>

Multivariate power series ring implementation. Uses lazy evaluated generating function for coefficients.

Author:
Heinz Kredel
See Also:
Serialized Form

Field Summary
 RingFactory<C> coFac
          Coefficient ring factory.
static int DEFAULT_TRUNCATE
          Default truncate.
 ExpVector EVZERO
          Zero ExpVector.
 int nvar
          The number of variables.
 MultiVarPowerSeries<C> ONE
          The constant power series 1 for this ring.
protected static java.util.Random random
          A default random sequence generator.
protected  java.lang.String[] vars
          The names of the variables.
 MultiVarPowerSeries<C> ZERO
          The constant power series 0 for this ring.
 
Constructor Summary
MultiVarPowerSeriesRing(GenPolynomialRing<C> fac)
          Constructor.
MultiVarPowerSeriesRing(RingFactory<C> coFac, int nv)
          Constructor.
MultiVarPowerSeriesRing(RingFactory<C> coFac, int nv, int truncate)
          Constructor.
MultiVarPowerSeriesRing(RingFactory<C> cofac, int nv, int truncate, java.lang.String[] names)
          Constructor.
MultiVarPowerSeriesRing(RingFactory<C> cofac, int nv, java.lang.String[] names)
          Constructor.
MultiVarPowerSeriesRing(RingFactory<C> coFac, java.lang.String[] names)
          Constructor.
 
Method Summary
 java.math.BigInteger characteristic()
          Characteristic of this ring.
 MultiVarPowerSeries<C> copy(MultiVarPowerSeries<C> c)
          Copy power series.
 boolean equals(java.lang.Object B)
          Comparison with any other object.
 MultiVarPowerSeries<C> fixPoint(MultiVarPowerSeriesMap<C> map)
          Fixed point construction.
 MultiVarPowerSeries<C> fromInteger(java.math.BigInteger a)
          Get a (constant) MultiVarPowerSeries<C> from a java.math.BigInteger.
 MultiVarPowerSeries<C> fromInteger(long a)
          Get a (constant) MultiVarPowerSeries<C> from a long value.
 MultiVarPowerSeries<C> fromPolynomial(GenPolynomial<C> a)
          Get a MultiVarPowerSeries<C> from a GenPolynomial<C>.
 java.util.List<MultiVarPowerSeries<C>> fromPolynomial(java.util.List<GenPolynomial<C>> A)
          Get a list of MultiVarPowerSeries<C> from a list of GenPolynomial<C>.
 MultiVarPowerSeries<C> fromPowerSeries(UnivPowerSeries<C> ps, int r)
          Get a MultiVarPowerSeries<C> from a univariate power series.
 java.util.List<MultiVarPowerSeries<C>> generators()
          Get a list of the generating elements.
 MultiVarPowerSeries<C> getCOS(int r)
          Get the power series of the cosinus function.
 MultiVarPowerSeries<C> getEXP(int r)
          Get the power series of the exponential function.
 MultiVarPowerSeries<C> getONE()
          Get the one element.
 MultiVarPowerSeries<C> getSIN(int r)
          Get the power series of the sinus function.
 MultiVarPowerSeries<C> getTAN(int r)
          Get the power series of the tangens function.
 java.lang.String[] getVars()
          Get a variable names.
 MultiVarPowerSeries<C> getZERO()
          Get the zero element.
 int hashCode()
          Hash code for this .
 boolean isAssociative()
          Query if this ring is associative.
 boolean isCommutative()
          Query if this ring is commuative.
 boolean isField()
          Query if this ring is a field.
 boolean isFinite()
          Is this structure finite or infinite.
 MultiVarPowerSeries<C> parse(java.io.Reader r)
          Parse a power series.
 MultiVarPowerSeries<C> parse(java.lang.String s)
          Parse a power series.
 GenPolynomialRing<C> polyRing()
          Get the corresponding GenPolynomialRing<C>.
 MultiVarPowerSeries<C> random()
          Generate a random power series with k = 5, d = 0.7.
 MultiVarPowerSeries<C> random(int k)
          Generate a random power series with d = 0.7.
 MultiVarPowerSeries<C> random(int k, float d)
          Generate a random power series.
 MultiVarPowerSeries<C> random(int k, float d, java.util.Random rnd)
          Generate a random power series.
 MultiVarPowerSeries<C> random(int k, java.util.Random rnd)
          Generate a random power series with d = 0.7.
 MultiVarPowerSeries<C> seriesOfTaylor(TaylorFunction<C> f, java.util.List<C> a)
          Taylor power series.
 int setTruncate(int t)
          Set truncate.
 MultiVarPowerSeries<C> solvePDE(MultiVarPowerSeries<C> f, C c, int r)
          Solve an partial differential equation. y_r' = f(y_r) with y_r(0) = c.
 java.lang.String toScript()
          Get a scripting compatible string representation.
 java.lang.String toString()
          To String.
 int truncate()
          Truncate.
 java.lang.String varsToString()
          Get a String representation of the variable names.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

random

protected static final java.util.Random random
A default random sequence generator.


DEFAULT_TRUNCATE

public static final int DEFAULT_TRUNCATE
Default truncate.

See Also:
Constant Field Values

EVZERO

public final ExpVector EVZERO
Zero ExpVector.


coFac

public final RingFactory<C extends RingElem<C>> coFac
Coefficient ring factory.


nvar

public final int nvar
The number of variables.


vars

protected java.lang.String[] vars
The names of the variables. This value can be modified.


ONE

public final MultiVarPowerSeries<C extends RingElem<C>> ONE
The constant power series 1 for this ring.


ZERO

public final MultiVarPowerSeries<C extends RingElem<C>> ZERO
The constant power series 0 for this ring.

Constructor Detail

MultiVarPowerSeriesRing

public MultiVarPowerSeriesRing(GenPolynomialRing<C> fac)
Constructor.

Parameters:
fac - polynomial ring factory.

MultiVarPowerSeriesRing

public MultiVarPowerSeriesRing(RingFactory<C> coFac,
                               int nv)
Constructor.

Parameters:
coFac - coefficient ring factory.

MultiVarPowerSeriesRing

public MultiVarPowerSeriesRing(RingFactory<C> coFac,
                               int nv,
                               int truncate)
Constructor.

Parameters:
coFac - coefficient ring factory.
truncate - index of truncation.

MultiVarPowerSeriesRing

public MultiVarPowerSeriesRing(RingFactory<C> coFac,
                               java.lang.String[] names)
Constructor.

Parameters:
coFac - coefficient ring factory.
names - of the variables.

MultiVarPowerSeriesRing

public MultiVarPowerSeriesRing(RingFactory<C> cofac,
                               int nv,
                               java.lang.String[] names)
Constructor.

Parameters:
cofac - coefficient ring factory.
nv - number of variables.
names - of the variables.

MultiVarPowerSeriesRing

public MultiVarPowerSeriesRing(RingFactory<C> cofac,
                               int nv,
                               int truncate,
                               java.lang.String[] names)
Constructor.

Parameters:
cofac - coefficient ring factory.
truncate - index of truncation.
names - of the variables.
Method Detail

fixPoint

public MultiVarPowerSeries<C> fixPoint(MultiVarPowerSeriesMap<C> map)
Fixed point construction.

Parameters:
map - a mapping of power series.
Returns:
fix point wrt map.

toString

public java.lang.String toString()
To String.

Overrides:
toString in class java.lang.Object
Returns:
string representation of this.

varsToString

public java.lang.String varsToString()
Get a String representation of the variable names.

Returns:
names seperated by commas.

getVars

public java.lang.String[] getVars()
Get a variable names.

Returns:
names.

toScript

public java.lang.String toScript()
Get a scripting compatible string representation.

Specified by:
toScript in interface ElemFactory<MultiVarPowerSeries<C extends RingElem<C>>>
Returns:
script compatible representation for this ElemFactory.
See Also:
ElemFactory.toScript()

equals

public boolean equals(java.lang.Object B)
Comparison with any other object.

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Hash code for this .

Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

getZERO

public MultiVarPowerSeries<C> getZERO()
Get the zero element.

Specified by:
getZERO in interface AbelianGroupFactory<MultiVarPowerSeries<C extends RingElem<C>>>
Returns:
0 as MultiVarPowerSeries.

getONE

public MultiVarPowerSeries<C> getONE()
Get the one element.

Specified by:
getONE in interface MonoidFactory<MultiVarPowerSeries<C extends RingElem<C>>>
Returns:
1 as MultiVarPowerSeries.

generators

public java.util.List<MultiVarPowerSeries<C>> generators()
Get a list of the generating elements.

Specified by:
generators in interface ElemFactory<MultiVarPowerSeries<C extends RingElem<C>>>
Returns:
list of generators for the algebraic structure.
See Also:
ElemFactory.generators()

isFinite

public boolean isFinite()
Is this structure finite or infinite.

Specified by:
isFinite in interface ElemFactory<MultiVarPowerSeries<C extends RingElem<C>>>
Returns:
true if this structure is finite, else false.
See Also:
ElemFactory.isFinite()

truncate

public int truncate()
Truncate.

Returns:
truncate index of power series.

setTruncate

public int setTruncate(int t)
Set truncate.

Parameters:
t - new truncate index.
Returns:
old truncate index of power series.

getEXP

public MultiVarPowerSeries<C> getEXP(int r)
Get the power series of the exponential function.

Parameters:
r - variable for the direction.
Returns:
exp(x_r) as MultiVarPowerSeries.

getSIN

public MultiVarPowerSeries<C> getSIN(int r)
Get the power series of the sinus function.

Parameters:
r - variable for the direction.
Returns:
sin(x_r) as MultiVarPowerSeries.

getCOS

public MultiVarPowerSeries<C> getCOS(int r)
Get the power series of the cosinus function.

Parameters:
r - variable for the direction.
Returns:
cos(x_r) as MultiVarPowerSeries.

getTAN

public MultiVarPowerSeries<C> getTAN(int r)
Get the power series of the tangens function.

Parameters:
r - variable for the direction.
Returns:
tan(x_r) as MultiVarPowerSeries.

solvePDE

public MultiVarPowerSeries<C> solvePDE(MultiVarPowerSeries<C> f,
                                       C c,
                                       int r)
Solve an partial differential equation. y_r' = f(y_r) with y_r(0) = c.

Parameters:
f - a MultiVarPowerSeries.
c - integration constant.
r - variable for the direction.
Returns:
f.integrate(c).

isCommutative

public boolean isCommutative()
Query if this ring is commuative.

Specified by:
isCommutative in interface MonoidFactory<MultiVarPowerSeries<C extends RingElem<C>>>
Returns:
true, if this ring is commutative, else false.

isAssociative

public boolean isAssociative()
Query if this ring is associative.

Specified by:
isAssociative in interface MonoidFactory<MultiVarPowerSeries<C extends RingElem<C>>>
Returns:
true if this ring is associative, else false.

isField

public boolean isField()
Query if this ring is a field.

Specified by:
isField in interface RingFactory<MultiVarPowerSeries<C extends RingElem<C>>>
Returns:
false.

characteristic

public java.math.BigInteger characteristic()
Characteristic of this ring.

Specified by:
characteristic in interface RingFactory<MultiVarPowerSeries<C extends RingElem<C>>>
Returns:
characteristic of this ring.

fromInteger

public MultiVarPowerSeries<C> fromInteger(long a)
Get a (constant) MultiVarPowerSeries<C> from a long value.

Specified by:
fromInteger in interface ElemFactory<MultiVarPowerSeries<C extends RingElem<C>>>
Parameters:
a - long.
Returns:
a MultiVarPowerSeries<C>.

fromInteger

public MultiVarPowerSeries<C> fromInteger(java.math.BigInteger a)
Get a (constant) MultiVarPowerSeries<C> from a java.math.BigInteger.

Specified by:
fromInteger in interface ElemFactory<MultiVarPowerSeries<C extends RingElem<C>>>
Parameters:
a - BigInteger.
Returns:
a MultiVarPowerSeries<C>.

polyRing

public GenPolynomialRing<C> polyRing()
Get the corresponding GenPolynomialRing<C>.

Returns:
GenPolynomialRing<C>.

fromPolynomial

public MultiVarPowerSeries<C> fromPolynomial(GenPolynomial<C> a)
Get a MultiVarPowerSeries<C> from a GenPolynomial<C>.

Parameters:
a - GenPolynomial<C>.
Returns:
a MultiVarPowerSeries<C>.

fromPolynomial

public java.util.List<MultiVarPowerSeries<C>> fromPolynomial(java.util.List<GenPolynomial<C>> A)
Get a list of MultiVarPowerSeries<C> from a list of GenPolynomial<C>.

Parameters:
A - list of GenPolynomial<C>.
Returns:
a list of MultiVarPowerSeries<C>.

fromPowerSeries

public MultiVarPowerSeries<C> fromPowerSeries(UnivPowerSeries<C> ps,
                                              int r)
Get a MultiVarPowerSeries<C> from a univariate power series.

Parameters:
ps - UnivPowerSeries<C>.
r - variable for the direction.
Returns:
a MultiVarPowerSeries<C>.

random

public MultiVarPowerSeries<C> random()
Generate a random power series with k = 5, d = 0.7.

Returns:
a random power series.

random

public MultiVarPowerSeries<C> random(int k)
Generate a random power series with d = 0.7.

Specified by:
random in interface ElemFactory<MultiVarPowerSeries<C extends RingElem<C>>>
Parameters:
k - bit-size of random coefficients.
Returns:
a random power series.

random

public MultiVarPowerSeries<C> random(int k,
                                     java.util.Random rnd)
Generate a random power series with d = 0.7.

Specified by:
random in interface ElemFactory<MultiVarPowerSeries<C extends RingElem<C>>>
Parameters:
k - bit-size of random coefficients.
rnd - is a source for random bits.
Returns:
a random power series.

random

public MultiVarPowerSeries<C> random(int k,
                                     float d)
Generate a random power series.

Parameters:
k - bit-size of random coefficients.
d - density of non-zero coefficients.
Returns:
a random power series.

random

public MultiVarPowerSeries<C> random(int k,
                                     float d,
                                     java.util.Random rnd)
Generate a random power series.

Parameters:
k - bit-size of random coefficients.
d - density of non-zero coefficients.
rnd - is a source for random bits.
Returns:
a random power series.

copy

public MultiVarPowerSeries<C> copy(MultiVarPowerSeries<C> c)
Copy power series.

Specified by:
copy in interface ElemFactory<MultiVarPowerSeries<C extends RingElem<C>>>
Parameters:
c - a power series.
Returns:
a copy of c.

parse

public MultiVarPowerSeries<C> parse(java.lang.String s)
Parse a power series. Note: not implemented.

Specified by:
parse in interface ElemFactory<MultiVarPowerSeries<C extends RingElem<C>>>
Parameters:
s - String.
Returns:
power series from s.

parse

public MultiVarPowerSeries<C> parse(java.io.Reader r)
Parse a power series. Note: not implemented.

Specified by:
parse in interface ElemFactory<MultiVarPowerSeries<C extends RingElem<C>>>
Parameters:
r - Reader.
Returns:
next power series from r.

seriesOfTaylor

public MultiVarPowerSeries<C> seriesOfTaylor(TaylorFunction<C> f,
                                             java.util.List<C> a)
Taylor power series.

Parameters:
f - function.
a - expansion point.
Returns:
Taylor series of f.