Top Description Inners Fields Constructors Methods
org.apache.commons.math3.analysis.function

public Class HarmonicOscillator

extends Object
implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction
Class Inheritance
All Implemented Interfaces
org.apache.commons.math3.analysis.DifferentiableUnivariateFunction, org.apache.commons.math3.analysis.UnivariateFunction, org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction
Imports
org.apache.commons.math3.analysis.DifferentiableUnivariateFunction, .FunctionUtils, .ParametricUnivariateFunction, .UnivariateFunction, org.apache.commons.math3.analysis.differentiation.DerivativeStructure, .UnivariateDifferentiableFunction, org.apache.commons.math3.exception.DimensionMismatchException, .NullArgumentException, org.apache.commons.math3.util.FastMath

Deprecated

as a consequence of DifferentiableUnivariateFunction being deprecated. See corresponding docs for further information.

simple harmonic oscillator function.
Since
3.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
HarmonicOscillator.Parametric

Parametric function where the input array contains the parameters of the harmonic oscillator function, ordered as follows:

  • Amplitude
  • Angular frequency
  • Phase

Field Summary

Modifier and TypeField and Description
private final double
amplitude

Amplitude.

private final double
omega

Angular frequency.

private final double
phase

Phase.

Constructor Summary

AccessConstructor and Description
public
HarmonicOscillator(double
Amplitude.
amplitude
,
double
Angular frequency.
omega
,
double
Phase.
phase
)

Harmonic oscillator function.

Method Summary

Modifier and TypeMethod and Description
public UnivariateFunction
derivative()

Implements org.apache.commons.math3.analysis.DifferentiableUnivariateFunction.derivative.

Deprecated as of 3.1, replaced by value(DerivativeStructure)

Returns the derivative of the function

public double
value(double
Point at which the function value should be computed.
x
)

Implements org.apache.commons.math3.analysis.UnivariateFunction.value.

Compute the value of the function.

private static double

Returns:

the value of the harmonic oscillator function at x.
value
(double
omega * x + phase.
xTimesOmegaPlusPhase
,
double
Amplitude.
amplitude
)

public DerivativeStructure
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

amplitudeback to summary
private final double amplitude

Amplitude.

omegaback to summary
private final double omega

Angular frequency.

phaseback to summary
private final double phase

Phase.

Constructor Detail

HarmonicOscillatorback to summary
public HarmonicOscillator(double amplitude, double omega, double phase)

Harmonic oscillator function.

Parameters
amplitude:double

Amplitude.

omega:double

Angular frequency.

phase:double

Phase.

Method Detail

derivativeback to summary
public UnivariateFunction derivative()

Implements org.apache.commons.math3.analysis.DifferentiableUnivariateFunction.derivative.

Doc from org.apache.commons.math3.analysis.DifferentiableUnivariateFunction.derivative.

Deprecated

as of 3.1, replaced by value(DerivativeStructure)

Returns the derivative of the function

Returns:UnivariateFunction

the derivative function

Annotations
@Deprecated
valueback to summary
public double value(double x)

Implements org.apache.commons.math3.analysis.UnivariateFunction.value.

Doc from org.apache.commons.math3.analysis.UnivariateFunction.value.

Compute the value of the function.

Parameters
x:double

Point at which the function value should be computed.

Returns:double

the value of the function.

valueback to summary
private static double value(double xTimesOmegaPlusPhase, double amplitude)
Parameters
xTimesOmegaPlusPhase:double

omega * x + phase.

amplitude:double

Amplitude.

Returns:double

the value of the harmonic oscillator function at x.

valueback to summary
public DerivativeStructure value(final DerivativeStructure t) throws DimensionMismatchException

Implements org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction.value.

Doc from org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction.value.

Simple mathematical function.

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

Parameters
t:DerivativeStructure

function input value

Returns:DerivativeStructure

function result

Exceptions
DimensionMismatchException:
if t is inconsistent with the function's free parameters or order
Since
3.1
org.apache.commons.math3.analysis.function back to summary

public Class HarmonicOscillator.Parametric

extends Object
implements ParametricUnivariateFunction
Class Inheritance
  • java.lang.Object
  • org.apache.commons.math3.analysis.function.HarmonicOscillator.Parametric
All Implemented Interfaces
org.apache.commons.math3.analysis.ParametricUnivariateFunction

Parametric function where the input array contains the parameters of the harmonic oscillator function, ordered as follows:

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public double[]

Returns:

the gradient vector at x.
gradient
(double
Value at which the gradient must be computed.
x
,
double...
Values of amplitude, angular frequency and phase.
param
)

Implements org.apache.commons.math3.analysis.ParametricUnivariateFunction.gradient.

Computes the value of the gradient at x.

private void
validateParameters(double[]
Values of norm, mean and standard deviation.
param
)

Validates parameters to ensure they are appropriate for the evaluation of the value(double, double[]) and gradient(double, double[]) methods.

public double

Returns:

the value of the function.
value
(double
Value for which the function must be computed.
x
,
double...
Values of norm, mean and standard deviation.
param
)

Implements org.apache.commons.math3.analysis.ParametricUnivariateFunction.value.

Computes the value of the harmonic oscillator at x.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Parametricback to summary
public Parametric()

Method Detail

gradientback to summary
public double[] gradient(double x, double... param) throws NullArgumentException, DimensionMismatchException

Implements org.apache.commons.math3.analysis.ParametricUnivariateFunction.gradient.

Computes the value of the gradient at x. The components of the gradient vector are the partial derivatives of the function with respect to each of the parameters (amplitude, angular frequency and phase).

Parameters
x:double

Value at which the gradient must be computed.

param:double[]

Values of amplitude, angular frequency and phase.

Returns:double[]

the gradient vector at x.

Exceptions
NullArgumentException:
if param is null.
DimensionMismatchException:
if the size of param is not 3.
validateParametersback to summary
private void validateParameters(double[] param) throws NullArgumentException, DimensionMismatchException

Validates parameters to ensure they are appropriate for the evaluation of the value(double, double[]) and gradient(double, double[]) methods.

Parameters
param:double[]

Values of norm, mean and standard deviation.

Exceptions
NullArgumentException:
if param is null.
DimensionMismatchException:
if the size of param is not 3.
valueback to summary
public double value(double x, double... param) throws NullArgumentException, DimensionMismatchException

Implements org.apache.commons.math3.analysis.ParametricUnivariateFunction.value.

Computes the value of the harmonic oscillator at x.

Parameters
x:double

Value for which the function must be computed.

param:double[]

Values of norm, mean and standard deviation.

Returns:double

the value of the function.

Exceptions
NullArgumentException:
if param is null.
DimensionMismatchException:
if the size of param is not 3.