SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.functionfit.PolInterp Class Reference

Represents a polynomial that interpolates through a set of points. More...

Inheritance diagram for umontreal.ssj.functionfit.PolInterp:
umontreal.ssj.functions.Polynomial umontreal.ssj.functions.MathFunction umontreal.ssj.functions.MathFunctionWithFirstDerivative umontreal.ssj.functions.MathFunctionWithDerivative umontreal.ssj.functions.MathFunctionWithIntegral umontreal.ssj.functions.MathFunction umontreal.ssj.functions.MathFunction umontreal.ssj.functions.MathFunction

Public Member Functions

 PolInterp (double[] x, double[] y)
 Constructs a new polynomial interpolating through the given points (x[0], y[0]), ..., (x[n], y[n]).
double[] getX ()
 Returns the \(x\) coordinates of the interpolated points.
double[] getY ()
 Returns the \(y\) coordinates of the interpolated points.
String toString ()
 Calls toString(double[], double[]) with the associated points.
Public Member Functions inherited from umontreal.ssj.functions.Polynomial
 Polynomial (double... coeff)
 Constructs a new polynomial with coefficients coeff.
int getDegree ()
 Returns the degree of this polynomial.
double[] getCoefficients ()
 Returns an array containing the coefficients of the polynomial.
double getCoefficient (int i)
 Returns the \(i\)th coefficient of the polynomial.
void setCoefficients (double... coeff)
 Sets the array of coefficients of this polynomial to coeff.
double evaluate (double x)
 Returns the value of the function evaluated at \(x\).
double derivative (double x)
 Computes (or estimates) the first derivative of the function at point x.
double derivative (double x, int n)
 Computes (or estimates) the \(n\)th derivative of the function at point x.
Polynomial derivativePolynomial (int n)
 Returns a polynomial corresponding to the \(n\)th derivative of this polynomial.
double integral (double a, double b)
 Computes (or estimates) the integral of the function over the interval \([a, b]\).
Polynomial integralPolynomial (double c)
 Returns a polynomial representing the integral of this polynomial.

Static Public Member Functions

static double[] getCoefficients (double[] x, double[] y)
 Computes and returns the coefficients the polynomial interpolating through the given points (x[0], y[0]), ..., (x[n], y[n]).
static String toString (double[] x, double[] y)
 Makes a string representation of a set of points.

Detailed Description

Represents a polynomial that interpolates through a set of points.

More specifically, let \((x_0,y_0), …, (x_n, y_n)\) be a set of points and

\(p(x)\) the constructed polynomial of degree \(n\). Then, for \(i=0,…,n\), \(p(x_i)=y_i\).

             <div class="SSJ-bigskip"></div>

Definition at line 44 of file PolInterp.java.

Constructor & Destructor Documentation

◆ PolInterp()

umontreal.ssj.functionfit.PolInterp.PolInterp ( double[] x,
double[] y )

Constructs a new polynomial interpolating through the given points (x[0], y[0]), ..., (x[n], y[n]).

This constructs a polynomial of degree n from n+1 points.

Parameters
xthe \(x\) coordinates of the points.
ythe \(y\) coordinates of the points.
Exceptions
NullPointerExceptionif `x` or `y` are `null`.
IllegalArgumentExceptionif the lengths of `x` and `y` are different, or if less than two points are specified.

Definition at line 62 of file PolInterp.java.

Member Function Documentation

◆ getCoefficients()

double[] umontreal.ssj.functionfit.PolInterp.getCoefficients ( double[] x,
double[] y )
static

Computes and returns the coefficients the polynomial interpolating through the given points (x[0], y[0]), ..., (x[n], y[n]).

This polynomial has degree n and there are n+1 coefficients.

Parameters
xthe \(x\) coordinates of the points.
ythe \(y\) coordinates of the points.
Returns
the coefficients the interpolating polynomial.

Definition at line 77 of file PolInterp.java.

◆ getX()

double[] umontreal.ssj.functionfit.PolInterp.getX ( )

Returns the \(x\) coordinates of the interpolated points.

Returns
the \(x\) coordinates of the interpolated points.

Definition at line 101 of file PolInterp.java.

◆ getY()

double[] umontreal.ssj.functionfit.PolInterp.getY ( )

Returns the \(y\) coordinates of the interpolated points.

Returns
the \(y\) coordinates of the interpolated points.

Definition at line 110 of file PolInterp.java.

◆ toString() [1/2]

String umontreal.ssj.functionfit.PolInterp.toString ( )

Calls toString(double[], double[]) with the associated points.

Returns
a string containing the points.

Reimplemented from umontreal.ssj.functions.Polynomial.

Definition at line 140 of file PolInterp.java.

◆ toString() [2/2]

String umontreal.ssj.functionfit.PolInterp.toString ( double[] x,
double[] y )
static

Makes a string representation of a set of points.

Parameters
xthe \(x\) coordinates of the points.
ythe \(y\) coordinates of the points.
Returns
the string representing the points.

Definition at line 121 of file PolInterp.java.


The documentation for this class was generated from the following file: