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 BasicFunction
BasicFunction.Differentiable<N,F>, BasicFunction.Integratable<N, F>, BasicFunction.PlainUnary<T, R> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final doubleprivate final doubleprivate final DoubleUnaryOperatorstatic final PeriodicFunctionhttps://en.wikipedia.org/wiki/Sawtooth_wavestatic final PeriodicFunctionhttps://en.wikipedia.org/wiki/Sine_wavestatic final PeriodicFunctionhttps://en.wikipedia.org/wiki/Square_wavestatic final PeriodicFunctionhttps://en.wikipedia.org/wiki/Triangle_wave -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetSampleDomain(int nbSamples) doubleinvoke(double arg) static PeriodicFunctionof(double origin, DoubleUnaryOperator shape) static PeriodicFunctionof(DoubleUnaryOperator shape) Origin at zero, and period 2π [0, 2π).static DoubleUnaryOperatorof(DoubleUnaryOperator shape, double period) static PeriodicFunctionofCentered(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 Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DoubleUnaryOperator
andThen, composeMethods inherited from interface PrimitiveFunction.Unary
invokeMethods inherited from interface 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:
invokein 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.
-