Package xal.extension.jels.tools.math
Class InverseRealPolynomial
java.lang.Object
xal.tools.math.fnc.poly.RealUnivariatePolynomial
xal.extension.jels.tools.math.InverseRealPolynomial
- All Implemented Interfaces:
IRealFunction
,ISmoothRealFunction
- Direct Known Subclasses:
MeanFieldPolynomial
Represents a model function of the form: ( x1 + x2(x0/x-1) + x3/2(x0/x-1)^2 + ... + xn/(n-1)!(x0/x-1)^(n-1) ) / x1 where x0,x1,...,xn are parameters.
This is an encapsulation of a TTF function as is used in TraceWin. The class is extended from UnivariateRealPolynomial just so it can be easily switched with it.
- Author:
- Ivo List, Juan F. Esteban Müller <juanf.estebanmuller@esss.se>
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty polynomial object, the zero polynomial.InverseRealPolynomial
(double[] arrCoef) Creates and initializes a polynomial to the specified coefficients. -
Method Summary
Modifier and TypeMethodDescriptiondouble
derivativeAt
(double dblVal) Evaluate derivative of the model function for the specified value of the indeterminate.double
evaluateAt
(double dblVal) Evaluate the model function for the specified value: (x1 + x2(x0/x-1) + x3/2(x0/x-1)^2 + ... + xn/(n-1)!double
getCoef
(int iOrder) Get the specified coefficient value.double[]
getCoefs()
Return the entire array of coefficients.int
Return the degree of the polynomial.plus
(InverseRealPolynomial polyAddend) void
setCoefArray
(double[] arrCoef) Set the entire coefficient array.times
(InverseRealPolynomial polyFac) toString()
Construct and return a textual representation of the contents of this model function as aString
object.Methods inherited from class xal.tools.math.fnc.poly.RealUnivariatePolynomial
derivativeAt, main, plus, times
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface xal.tools.math.fnc.IRealFunction
getDomain
-
Constructor Details
-
InverseRealPolynomial
public InverseRealPolynomial()Creates an empty polynomial object, the zero polynomial. -
InverseRealPolynomial
public InverseRealPolynomial(double[] arrCoef) Creates and initializes a polynomial to the specified coefficients.- Parameters:
arrCoef
-
-
-
Method Details
-
setCoefArray
public void setCoefArray(double[] arrCoef) Set the entire coefficient array. The coefficient array is arranged in order of ascending indeterminate order.- Overrides:
setCoefArray
in classRealUnivariatePolynomial
- Parameters:
arrCoef
- double array of coefficients.
-
getDegree
public int getDegree()Description copied from class:RealUnivariatePolynomial
Return the degree of the polynomial. That is, the highest indeterminant order for all the nonzero coefficients.- Overrides:
getDegree
in classRealUnivariatePolynomial
- Returns:
- the degree of the polynomial. That is, the highest indeterminant order for all the nonzero coefficients.
-
getCoef
public double getCoef(int iOrder) Get the specified coefficient value. If the value ofiOrder
is larger than the size of the coefficient array then the coefficient is assumed to have value zero.- Overrides:
getCoef
in classRealUnivariatePolynomial
- Parameters:
iOrder
- index of coefficient- Returns:
- coefficient
-
getCoefs
public double[] getCoefs()Return the entire array of coefficients.- Overrides:
getCoefs
in classRealUnivariatePolynomial
- Returns:
- the entire coefficient array
-
evaluateAt
public double evaluateAt(double dblVal) Evaluate the model function for the specified value: (x1 + x2(x0/x-1) + x3/2(x0/x-1)^2 + ... + xn/(n-1)!(x0/x-1)^(n-1)) / x1 where x0,x1,...,xn are coefficients.- Specified by:
evaluateAt
in interfaceIRealFunction
- Overrides:
evaluateAt
in classRealUnivariatePolynomial
- Parameters:
dblVal
- indeterminate value to evaluate the model function at- Returns:
-
derivativeAt
public double derivativeAt(double dblVal) Evaluate derivative of the model function for the specified value of the indeterminate. If the coefficient vector has not been specified, it return 0. (-x2(x0 x^-2) - x3(x0/x-1)(x0 x^-2) - ... - xn/(n-2)!(x0/x-1)^(n-2)(x0 x^-2)) / x1 where x0,x1,...,xn are coefficients.- Specified by:
derivativeAt
in interfaceISmoothRealFunction
- Overrides:
derivativeAt
in classRealUnivariatePolynomial
- Parameters:
dblVal
- indeterminate value to evaluate the model function derivative- Returns:
- the derivative f'(x) of the function f
-
plus
-
times
-
toString
Construct and return a textual representation of the contents of this model function as aString
object.- Overrides:
toString
in classRealUnivariatePolynomial
- Returns:
- a String representation of the model function contents
- See Also:
-