org.apache.commons.math3.analysis.polynomials
Class FourierSeries

java.lang.Object
  extended by org.apache.commons.math3.analysis.polynomials.FourierSeries
All Implemented Interfaces:
Serializable, DifferentiableIntegrableUnivariateFunction, UnivariateDifferentiableFunction, IntegrableUnivariateFunction, UnivariateFunction

public final class FourierSeries
extends Object
implements DifferentiableIntegrableUnivariateFunction, Serializable

This class represents a finite Fourier Series

Since:
1.2
Version:
$Id: FourierSeries.java 16755 2016-10-07 15:47:40Z bignon $
Author:
Rami Houdroge
See Also:
FourierDecompositionEngine, Serialized Form
Concurrency :
immutable

Constructor Summary
FourierSeries(double omega, double a0, double[] a, double[] b)
          Constructor for the FourierSeries.
 
Method Summary
 UnivariateFunction derivative()
          Compute and return derivative of polynomial
 UnivariateFunction derivative(int n)
          Compute and return nth derivative of polynomial
 double derivativeValue(int n, double x)
          Return value at x of nth order derivative
protected static double evaluate(FourierSeries poly, double x)
          Compute value at x of trigonometric polynomial P :
P(x) = a0 + a(k) * cos(kx) + b(k) * sin(kx)
 double getAngularFrequency()
           
 double getConstant()
           
 double[] getCosArray()
           
 int getOrder()
           
 double getPeriod()
           
 double[] getSinArray()
           
 FourierSeries negate()
          Negate polynomial
 FourierSeries polynomialDerivative()
          Returns the first order derivative as a TrigonometricPolynomialFunction.
protected static FourierSeries polynomialDerivative(FourierSeries poly)
          Returns the derivative as a TrigonometricPolynomialFunction.
 FourierSeries polynomialDerivative(int order)
          Returns the nth order derivative as a TrigonometricPolynomialFunction.
 FourierSeries polynomialPrimitive()
          Get primitive of FourierSeries.
protected static FourierSeries polynomialPrimitive(FourierSeries poly)
          Get primitive of FourierSeries.
 UnivariateFunction primitive()
          Get primitive of TrigonometricPolynomialFunction
 double primitiveValue(double x)
          Return value at x of the function primitive
 FourierSeries scalarAdd(double scalar)
          Add a scalar
 FourierSeries scalarDivide(double scalar)
          Divide by a scalar
 FourierSeries scalarMultiply(double scalar)
          Multiply by a scalar
 FourierSeries scalarSubtract(double scalar)
          Subtract a scalar
 String toString()
          Get String representation of polynomial
 DerivativeStructure value(DerivativeStructure t)
          Simple mathematical function.
 double value(double x)
          Return value at x of polynomial.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FourierSeries

public FourierSeries(double omega,
                     double a0,
                     double[] a,
                     double[] b)
Constructor for the FourierSeries. This constructor creates the following trigonometric polynomial :
P(X) = a0 + a(k) * cos(k * omega * X) + b(k) * sin(k * omega * X)
where omega = 2 * pi / period

Parameters:
omega - angular frequency
a0 - a0 coefficient
a - cosine coefficients array
b - sine coefficients array
Throws:
MathIllegalArgumentException - if arrays a and b are of different lengths
Method Detail

scalarAdd

public FourierSeries scalarAdd(double scalar)
Add a scalar

Parameters:
scalar - to add
Returns:
new TrigonometricPolynomialFunction

scalarMultiply

public FourierSeries scalarMultiply(double scalar)
Multiply by a scalar

Parameters:
scalar - to multiply polynomial by
Returns:
polynomial multiplied by scalar

scalarSubtract

public FourierSeries scalarSubtract(double scalar)
Subtract a scalar

Parameters:
scalar - to subtract
Returns:
new TrigonometricPolynomialFunction

scalarDivide

public FourierSeries scalarDivide(double scalar)
Divide by a scalar

Parameters:
scalar - to divide polynomial by
Returns:
polynomial divide by scalar

negate

public FourierSeries negate()
Negate polynomial

Returns:
negated polynomial

polynomialDerivative

public FourierSeries polynomialDerivative()
Returns the first order derivative as a TrigonometricPolynomialFunction.

Returns:
the derivative polynomial.

polynomialDerivative

public FourierSeries polynomialDerivative(int order)
Returns the nth order derivative as a TrigonometricPolynomialFunction.

Parameters:
order - order of derivative (must be > 0)
Returns:
the derivative polynomial.

polynomialDerivative

protected static FourierSeries polynomialDerivative(FourierSeries poly)
Returns the derivative as a TrigonometricPolynomialFunction.

Parameters:
poly - polynomial to derivate
Returns:
the derivative polynomial.

polynomialPrimitive

public FourierSeries polynomialPrimitive()
Get primitive of FourierSeries. a0 constant is considered equal to 0.

Returns:
the primitive as a FourierSeries

polynomialPrimitive

protected static FourierSeries polynomialPrimitive(FourierSeries poly)
Get primitive of FourierSeries. a0 constant is considered equal to 0.

Parameters:
poly - polynomial for primitive computation
Returns:
the primitive as a FourierSeries

value

public double value(double x)
Return value at x of polynomial.

Specified by:
value in interface UnivariateFunction
Parameters:
x - desired abscissa
Returns:
value of polynomial function

derivativeValue

public double derivativeValue(int n,
                              double x)
Return value at x of nth order derivative

Parameters:
n - order of derivative
x - desired abscissa
Returns:
value of derivative

primitiveValue

public double primitiveValue(double x)
Return value at x of the function primitive

Parameters:
x - desired abscissa
Returns:
value of derivative

evaluate

protected static double evaluate(FourierSeries poly,
                                 double x)
Compute value at x of trigonometric polynomial P :
P(x) = a0 + a(k) * cos(kx) + b(k) * sin(kx)

Parameters:
poly - polynomial to evaluate
x - abscissa of desired value
Returns:
value of poly at x

primitive

public UnivariateFunction primitive()
Get primitive of TrigonometricPolynomialFunction

Specified by:
primitive in interface IntegrableUnivariateFunction
Returns:
the primitive as a UnivariateFunction

derivative

public UnivariateFunction derivative()
Compute and return derivative of polynomial

Returns:
derivative of polynomial function

derivative

public UnivariateFunction derivative(int n)
Compute and return nth derivative of polynomial

Parameters:
n - order of derivative
Returns:
nth derivative of polynomial function

getAngularFrequency

public double getAngularFrequency()
Returns:
the angularFrequency

getPeriod

public double getPeriod()
Returns:
the period

getConstant

public double getConstant()
Returns:
the constant

getCosArray

public double[] getCosArray()
Returns:
the cosArray

getSinArray

public double[] getSinArray()
Returns:
the sinArray

getOrder

public int getOrder()
Returns:
the order of the Fourier Decomposition

toString

public String toString()
Get String representation of polynomial

Overrides:
toString in class Object
Returns:
string

value

public DerivativeStructure value(DerivativeStructure t)
Simple mathematical function.

UnivariateDifferentiableFunction classes compute both the value and the first derivative of the function.

Specified by:
value in interface UnivariateDifferentiableFunction
Parameters:
t - function input value
Returns:
function result


Copyright © 2016 CNES. All Rights Reserved.