Package edu.jas.ps
Class UnivPowerSeriesRing<C extends RingElem<C>>
- java.lang.Object
-
- edu.jas.ps.UnivPowerSeriesRing<C>
-
- Type Parameters:
C
- ring element type
- All Implemented Interfaces:
AbelianGroupFactory<UnivPowerSeries<C>>
,ElemFactory<UnivPowerSeries<C>>
,MonoidFactory<UnivPowerSeries<C>>
,RingFactory<UnivPowerSeries<C>>
,java.io.Serializable
public class UnivPowerSeriesRing<C extends RingElem<C>> extends java.lang.Object implements RingFactory<UnivPowerSeries<C>>
Univariate power series ring implementation. Uses lazy evaluated generating function for coefficients.- Author:
- Heinz Kredel
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description RingFactory<C>
coFac
Coefficient ring factory.static java.lang.String
DEFAULT_NAME
Default variable name.static int
DEFAULT_TRUNCATE
Default truncate.UnivPowerSeries<C>
ONE
The constant power series 1 for this ring.protected static java.util.Random
random
A default random sequence generator.UnivPowerSeries<C>
ZERO
The constant power series 0 for this ring.
-
Constructor Summary
Constructors Constructor Description UnivPowerSeriesRing(GenPolynomialRing<C> pfac)
Constructor.UnivPowerSeriesRing(RingFactory<C> coFac)
Constructor.UnivPowerSeriesRing(RingFactory<C> coFac, int truncate)
Constructor.UnivPowerSeriesRing(RingFactory<C> cofac, int truncate, java.lang.String name)
Constructor.UnivPowerSeriesRing(RingFactory<C> coFac, java.lang.String name)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.math.BigInteger
characteristic()
Characteristic of this ring.UnivPowerSeries<C>
copy(UnivPowerSeries<C> c)
Copy power series.boolean
equals(java.lang.Object B)
Comparison with any other object.UnivPowerSeries<C>
fixPoint(UnivPowerSeriesMap<C> map)
Fixed point construction.UnivPowerSeries<C>
fromInteger(long a)
Get a (constant) UnivPowerSeries<C> from a long value.UnivPowerSeries<C>
fromInteger(java.math.BigInteger a)
Get a (constant) UnivPowerSeries<C> from a java.math.BigInteger.UnivPowerSeries<C>
fromPolynomial(GenPolynomial<C> a)
Get a UnivPowerSeries<C> from a GenPolynomial<C>.UnivPowerSeries<C>
fromVector(GenVector<C> a)
Get a UnivPowerSeries<C> from a GenVector<C>.UnivPowerSeries<C>
generate(java.util.function.IntFunction<C> gener)
Generate a power series via lambda expression.java.util.List<UnivPowerSeries<C>>
generators()
Get a list of the generating elements.UnivPowerSeries<C>
getCOS()
Get the power series of the cosine function.UnivPowerSeries<C>
getEXP()
Get the power series of the exponential function.UnivPowerSeries<C>
getONE()
Get the one element.UnivPowerSeries<C>
getSIN()
Get the power series of the sinus function.UnivPowerSeries<C>
getTAN()
Get the power series of the tangens function.UnivPowerSeries<C>
getZERO()
Get the zero element.int
hashCode()
Hash code for this .boolean
isAssociative()
Query if this ring is associative.boolean
isCommutative()
Is commutative.boolean
isField()
Query if this ring is a field.boolean
isFinite()
Is this structure finite or infinite.UnivPowerSeries<C>
parse(java.io.Reader r)
Parse a power series.UnivPowerSeries<C>
parse(java.lang.String s)
Parse a power series.GenPolynomialRing<C>
polyRing()
Get the corresponding GenPolynomialRing<C>.UnivPowerSeries<C>
random()
Generate a random power series with k = 5, d = 0.7.UnivPowerSeries<C>
random(int k)
Generate a random power series with d = 0.7.UnivPowerSeries<C>
random(int k, float d)
Generate a random power series.UnivPowerSeries<C>
random(int k, float d, java.util.Random rnd)
Generate a random power series.UnivPowerSeries<C>
random(int k, java.util.Random rnd)
Generate a random power series with d = 0.7.UnivPowerSeries<C>
seriesOfTaylor(TaylorFunction<C> f, C a)
Taylor power series.UnivPowerSeries<C>
solveODE(UnivPowerSeries<C> f, C c)
Solve an ordinary differential equation. y' = f(y) with y(0) = c.java.lang.String
toScript()
Get a scripting compatible string representation.java.lang.String
toString()
To String.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface edu.jas.structure.ElemFactory
valueOf
-
-
-
-
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
-
DEFAULT_NAME
public static final java.lang.String DEFAULT_NAME
Default variable name.- See Also:
- Constant Field Values
-
coFac
public final RingFactory<C extends RingElem<C>> coFac
Coefficient ring factory.
-
ONE
public final UnivPowerSeries<C extends RingElem<C>> ONE
The constant power series 1 for this ring.
-
ZERO
public final UnivPowerSeries<C extends RingElem<C>> ZERO
The constant power series 0 for this ring.
-
-
Constructor Detail
-
UnivPowerSeriesRing
public UnivPowerSeriesRing(RingFactory<C> coFac)
Constructor.- Parameters:
coFac
- coefficient ring factory.
-
UnivPowerSeriesRing
public UnivPowerSeriesRing(RingFactory<C> coFac, int truncate)
Constructor.- Parameters:
coFac
- coefficient ring factory.truncate
- index of truncation.
-
UnivPowerSeriesRing
public UnivPowerSeriesRing(RingFactory<C> coFac, java.lang.String name)
Constructor.- Parameters:
coFac
- coefficient ring factory.name
- of the variable.
-
UnivPowerSeriesRing
public UnivPowerSeriesRing(GenPolynomialRing<C> pfac)
Constructor.- Parameters:
pfac
- polynomial ring factory.
-
UnivPowerSeriesRing
public UnivPowerSeriesRing(RingFactory<C> cofac, int truncate, java.lang.String name)
Constructor.- Parameters:
cofac
- coefficient ring factory.truncate
- index of truncation.name
- of the variable.
-
-
Method Detail
-
fixPoint
public UnivPowerSeries<C> fixPoint(UnivPowerSeriesMap<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 classjava.lang.Object
- Returns:
- string representation of this.
-
toScript
public java.lang.String toScript()
Get a scripting compatible string representation.- Specified by:
toScript
in interfaceElemFactory<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 classjava.lang.Object
- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
Hash code for this .- Overrides:
hashCode
in classjava.lang.Object
- See Also:
Object.hashCode()
-
getZERO
public UnivPowerSeries<C> getZERO()
Get the zero element.- Specified by:
getZERO
in interfaceAbelianGroupFactory<C extends RingElem<C>>
- Returns:
- 0 as UnivPowerSeries
.
-
getONE
public UnivPowerSeries<C> getONE()
Get the one element.- Specified by:
getONE
in interfaceMonoidFactory<C extends RingElem<C>>
- Returns:
- 1 as UnivPowerSeries
.
-
generators
public java.util.List<UnivPowerSeries<C>> generators()
Get a list of the generating elements.- Specified by:
generators
in interfaceElemFactory<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 interfaceElemFactory<C extends RingElem<C>>
- Returns:
- true if this structure is finite, else false.
- See Also:
ElemFactory.isFinite()
-
getEXP
public UnivPowerSeries<C> getEXP()
Get the power series of the exponential function.- Returns:
- exp(x) as UnivPowerSeries
.
-
getSIN
public UnivPowerSeries<C> getSIN()
Get the power series of the sinus function.- Returns:
- sin(x) as UnivPowerSeries
.
-
getCOS
public UnivPowerSeries<C> getCOS()
Get the power series of the cosine function.- Returns:
- cos(x) as UnivPowerSeries
.
-
getTAN
public UnivPowerSeries<C> getTAN()
Get the power series of the tangens function.- Returns:
- tan(x) as UnivPowerSeries
.
-
solveODE
public UnivPowerSeries<C> solveODE(UnivPowerSeries<C> f, C c)
Solve an ordinary differential equation. y' = f(y) with y(0) = c.- Parameters:
f
- a UnivPowerSeries. c
- integration constant.- Returns:
- f.integrate(c).
-
isCommutative
public boolean isCommutative()
Is commutative.- Specified by:
isCommutative
in interfaceMonoidFactory<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 interfaceMonoidFactory<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 interfaceRingFactory<C extends RingElem<C>>
- Returns:
- false.
-
characteristic
public java.math.BigInteger characteristic()
Characteristic of this ring.- Specified by:
characteristic
in interfaceRingFactory<C extends RingElem<C>>
- Returns:
- characteristic of this ring.
-
fromInteger
public UnivPowerSeries<C> fromInteger(long a)
Get a (constant) UnivPowerSeries<C> from a long value.- Specified by:
fromInteger
in interfaceElemFactory<C extends RingElem<C>>
- Parameters:
a
- long.- Returns:
- a UnivPowerSeries<C>.
-
fromInteger
public UnivPowerSeries<C> fromInteger(java.math.BigInteger a)
Get a (constant) UnivPowerSeries<C> from a java.math.BigInteger.- Specified by:
fromInteger
in interfaceElemFactory<C extends RingElem<C>>
- Parameters:
a
- BigInteger.- Returns:
- a UnivPowerSeries<C>.
-
polyRing
public GenPolynomialRing<C> polyRing()
Get the corresponding GenPolynomialRing<C>.- Returns:
- GenPolynomialRing<C>.
-
fromPolynomial
public UnivPowerSeries<C> fromPolynomial(GenPolynomial<C> a)
Get a UnivPowerSeries<C> from a GenPolynomial<C>.- Parameters:
a
- GenPolynomial<C>.- Returns:
- a UnivPowerSeries<C>.
-
fromVector
public UnivPowerSeries<C> fromVector(GenVector<C> a)
Get a UnivPowerSeries<C> from a GenVector<C>.- Parameters:
a
- GenVector<C>.- Returns:
- a UnivPowerSeries<C>.
-
random
public UnivPowerSeries<C> random()
Generate a random power series with k = 5, d = 0.7.- Returns:
- a random power series.
-
random
public UnivPowerSeries<C> random(int k)
Generate a random power series with d = 0.7.- Specified by:
random
in interfaceElemFactory<C extends RingElem<C>>
- Parameters:
k
- bitsize of random coefficients.- Returns:
- a random power series.
-
random
public UnivPowerSeries<C> random(int k, java.util.Random rnd)
Generate a random power series with d = 0.7.- Specified by:
random
in interfaceElemFactory<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 UnivPowerSeries<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 UnivPowerSeries<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.
-
generate
public UnivPowerSeries<C> generate(java.util.function.IntFunction<C> gener)
Generate a power series via lambda expression.- Parameters:
gener
- lambda expression.- Returns:
- a generated power series.
-
copy
public UnivPowerSeries<C> copy(UnivPowerSeries<C> c)
Copy power series.- Specified by:
copy
in interfaceElemFactory<C extends RingElem<C>>
- Parameters:
c
- a power series.- Returns:
- a copy of c.
-
parse
public UnivPowerSeries<C> parse(java.lang.String s)
Parse a power series. Note: not implemented.- Specified by:
parse
in interfaceElemFactory<C extends RingElem<C>>
- Parameters:
s
- String.- Returns:
- power series from s.
-
parse
public UnivPowerSeries<C> parse(java.io.Reader r)
Parse a power series. Note: not implemented.- Specified by:
parse
in interfaceElemFactory<C extends RingElem<C>>
- Parameters:
r
- Reader.- Returns:
- next power series from r.
-
seriesOfTaylor
public UnivPowerSeries<C> seriesOfTaylor(TaylorFunction<C> f, C a)
Taylor power series.- Parameters:
f
- function.a
- expansion point.- Returns:
- Taylor series of f.
-
-