Class HarmonicOscillator.Parametric
- java.lang.Object
-
- org.apache.commons.math3.analysis.function.HarmonicOscillator.Parametric
-
- All Implemented Interfaces:
ParametricUnivariateFunction
- Enclosing class:
- HarmonicOscillator
public static class HarmonicOscillator.Parametric extends java.lang.Object implements ParametricUnivariateFunction
Parametric function where the input array contains the parameters of the harmonic oscillator function, ordered as follows:- Amplitude
- Angular frequency
- Phase
-
-
Constructor Summary
Constructors Constructor Description Parametric()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]gradient(double x, double... param)Computes the value of the gradient atx.private voidvalidateParameters(double[] param)Validates parameters to ensure they are appropriate for the evaluation of thevalue(double,double[])andgradient(double,double[])methods.doublevalue(double x, double... param)Computes the value of the harmonic oscillator atx.
-
-
-
Method Detail
-
value
public double value(double x, double... param) throws NullArgumentException, DimensionMismatchExceptionComputes the value of the harmonic oscillator atx.- Specified by:
valuein interfaceParametricUnivariateFunction- Parameters:
x- Value for which the function must be computed.param- Values of norm, mean and standard deviation.- Returns:
- the value of the function.
- Throws:
NullArgumentException- ifparamisnull.DimensionMismatchException- if the size ofparamis not 3.
-
gradient
public double[] gradient(double x, double... param) throws NullArgumentException, DimensionMismatchExceptionComputes the value of the gradient atx. 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).- Specified by:
gradientin interfaceParametricUnivariateFunction- Parameters:
x- Value at which the gradient must be computed.param- Values of amplitude, angular frequency and phase.- Returns:
- the gradient vector at
x. - Throws:
NullArgumentException- ifparamisnull.DimensionMismatchException- if the size ofparamis not 3.
-
validateParameters
private void validateParameters(double[] param) throws NullArgumentException, DimensionMismatchExceptionValidates parameters to ensure they are appropriate for the evaluation of thevalue(double,double[])andgradient(double,double[])methods.- Parameters:
param- Values of norm, mean and standard deviation.- Throws:
NullArgumentException- ifparamisnull.DimensionMismatchException- if the size ofparamis not 3.
-
-