Package org.ojalgo.function.series
Class PeriodicFunction
java.lang.Object
org.ojalgo.function.series.PeriodicFunction
- All Implemented Interfaces:
DoubleUnaryOperator
,Function<Double,
,Double> UnaryOperator<Double>
,BasicFunction
,PrimitiveFunction.Unary
,UnaryFunction<Double>
A periodic function is a function that repeats its values in regular intervals or periods. The most
important examples are the trigonometric functions, which repeat over intervals of length 2π radians.
This class allows you to create a periodic function from any other function. The base function only needs to be defined over the interval specified in this class, The resulting function will repeat the base function in regular periods. The default period is 2π, but it's possible to specify any other period. The default origin is zero, but it's possible to specify any other origin.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.ojalgo.function.BasicFunction
BasicFunction.Differentiable<N extends Comparable<N>,
F extends BasicFunction>, BasicFunction.Integratable<N extends Comparable<N>, F extends BasicFunction>, BasicFunction.PlainUnary<T, R> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final double
private final double
private final DoubleUnaryOperator
static final PeriodicFunction
https://en.wikipedia.org/wiki/Sawtooth_wavestatic final PeriodicFunction
https://en.wikipedia.org/wiki/Sine_wavestatic final PeriodicFunction
https://en.wikipedia.org/wiki/Square_wavestatic final PeriodicFunction
https://en.wikipedia.org/wiki/Triangle_wave -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetSampleDomain
(int nbSamples) double
invoke
(double arg) static PeriodicFunction
of
(double origin, DoubleUnaryOperator shape) static PeriodicFunction
of
(DoubleUnaryOperator shape) Origin at zero, and period 2π [0, 2π).static DoubleUnaryOperator
of
(DoubleUnaryOperator shape, double period) static PeriodicFunction
ofCentered
(DoubleUnaryOperator shape) Origin at -π, and period 2π [-π, π).withInterval
(double origin, double period) interval = [origin, origin+period)withOrigin
(double origin) interval = [origin, origin+period)withPeriod
(double period) interval = [origin, origin+period)withShape
(DoubleUnaryOperator shape) The shape is the function that is repeated in regular intervals.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.function.DoubleUnaryOperator
andThen, compose
Methods inherited from interface org.ojalgo.function.PrimitiveFunction.Unary
invoke
Methods inherited from interface org.ojalgo.function.UnaryFunction
andThen, apply, applyAsDouble, compose, invoke, invoke, invoke, invoke, invoke
-
Field Details
-
SAWTOOTH
https://en.wikipedia.org/wiki/Sawtooth_waveDomain: (-∞, ∞) by repeating/shifting the definition interval [0, 2π).
Range: [-1, 1]. -
SINE
https://en.wikipedia.org/wiki/Sine_waveDomain: (-∞, ∞) by repeating/shifting the definition interval [0, 2π).
Range: [-1, 1]. -
SQUARE
https://en.wikipedia.org/wiki/Square_waveDomain: (-∞, ∞) by repeating/shifting the definition interval [0, 2π).
Range: [-1, 1]. -
TRIANGLE
https://en.wikipedia.org/wiki/Triangle_waveDomain: (-∞, ∞) by repeating/shifting the definition interval [0, 2π).
Range: [-1, 1]. -
myOrigin
private final double myOrigin -
myPeriod
private final double myPeriod -
myShape
-
-
Constructor Details
-
PeriodicFunction
PeriodicFunction(double origin, DoubleUnaryOperator shape, double period)
-
-
Method Details
-
of
-
of
Origin at zero, and period 2π [0, 2π). -
of
-
ofCentered
Origin at -π, and period 2π [-π, π). -
getSampleDomain
-
invoke
public double invoke(double arg) - Specified by:
invoke
in interfaceUnaryFunction<Double>
-
withInterval
interval = [origin, origin+period) -
withOrigin
interval = [origin, origin+period) -
withPeriod
interval = [origin, origin+period) -
withShape
The shape is the function that is repeated in regular intervals.
-