|
SSJ
3.3.1
Stochastic Simulation in Java
|
Represents a B-spline with control points at \((X_i, Y_i)\). More...
Public Member Functions | |
| BSpline (final double[] x, final double[] y, final int degree) | |
Constructs a new uniform B-spline of degree degree with control points at (x[i], y[i]). More... | |
| BSpline (final double[] x, final double[] y, final double[] knots) | |
Constructs a new uniform B-spline with control points at (x[i], y[i]), and knot vector given by the array knots. More... | |
| double [] | getX () |
| Returns the \(X_i\) coordinates for this spline. More... | |
| double [] | getY () |
| Returns the \(Y_i\) coordinates for this spline. More... | |
| double | getMaxKnot () |
| Returns the knot maximal value. More... | |
| double | getMinKnot () |
| Returns the knot minimal value. More... | |
| double [] | getKnots () |
| Returns an array containing the knot vector \((t_0, t_{m-1})\). More... | |
| BSpline | derivativeBSpline () |
| Returns the derivative B-spline object of the current variable. More... | |
| BSpline | derivativeBSpline (int i) |
| Returns the \(i\)th derivative B-spline object of the current variable; \(i\) must be less than the degree of the original B-spline. More... | |
| double | evaluate (final double u) |
| Returns the value of the function evaluated at \(x\). More... | |
| double | integral (double a, double b) |
| Computes (or estimates) the integral of the function over the interval \([a, b]\). More... | |
| double | derivative (double u) |
Computes (or estimates) the first derivative of the function at point x. More... | |
| double | derivative (double u, int n) |
Computes (or estimates) the \(n\)th derivative of the function at point x. More... | |
| double | evalX (double u) |
| double | evalY (double u) |
Static Public Member Functions | |
| static BSpline | createInterpBSpline (double[] x, double[] y, int degree) |
Returns a B-spline curve of degree degree interpolating the \((x_i, y_i)\) points [42] . More... | |
| static BSpline | createApproxBSpline (double[] x, double[] y, int degree, int hp1) |
Returns a B-spline curve of degree degree smoothing \((x_i, y_i)\), for \(i=0,…,n\) points. More... | |
Represents a B-spline with control points at \((X_i, Y_i)\).
Let \(\mathbf{P_i}=(X_i, Y_i)\), for \(i=0,…,n-1\), be a control point and let \(t_j\), for \(j=0,…,m-1\) be a knot. A B-spline [42] of degree \(p=m-n-1\) is a parametric curve defined as
\[ \mathbf{P(t)} = \sum_{i=0}^{n-1} N_{i, p}(t) \mathbf{P_i},\mbox{ for }t_p\le t\le t_{m-p-1}. \]
Here,
\begin{align*} N_{i, p}(t) & = \frac{t-t_i}{t_{i+p} - t_i}N_{i, p-1}(t) + \frac{t_{i+p+1} - t}{t_{i+p+1} - t_{i+1}}N_{i+1, p-1}(t) \\ N_{i, 0}(t) & = \left\{ \begin{array}{ll} 1 & \mbox{ for }t_i\le t\le t_{i+1}, \\ 0 \mbox{ elsewhere}. \end{array} \right. \end{align*}
This class provides methods to evaluate \(\mathbf{P(t)}=(X(t), Y(t))\) at any value of \(t\), for a B-spline of any degree \(p\ge1\). Note that the evaluate(double) method of this class can be slow, since it uses a root finder to determine the value of \(t^*\) for which \(X(t^*)=x\) before it computes \(Y(t^*)\).
| BSpline | ( | final double [] | x, |
| final double [] | y, | ||
| final int | degree | ||
| ) |
Constructs a new uniform B-spline of degree degree with control points at (x[i], y[i]).
The knots of the resulting B-spline are set uniformly from x[0] to x[n-1].
| x | the values of \(X\). |
| y | the values of \(Y\). |
| degree | the degree of the B-spline. |
| BSpline | ( | final double [] | x, |
| final double [] | y, | ||
| final double [] | knots | ||
| ) |
Constructs a new uniform B-spline with control points at (x[i], y[i]), and knot vector given by the array knots.
| x | the values of \(X\). |
| y | the values of \(Y\). |
| knots | the knots of the B-spline. |
|
static |
Returns a B-spline curve of degree degree smoothing \((x_i, y_i)\), for \(i=0,…,n\) points.
The precision depends on the parameter \(hp1\): \(1 \le\mathtt{degree} \le hp1<n\), which represents the number of control points used by the new B-spline curve, minimizing the quadratic error
\[ L = \sum_{i=0}^n\left( \frac{Y_i - S_i(X_i)}{W_i}\right)^2. \]
This method uses the uniformly spaced method for interpolating points with a B-spline curve and a uniformed clamped knot vector, as described in http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/.
| x | the values of \(X\). |
| y | the values of \(Y\). |
| degree | the degree of the B-spline. |
| hp1 | the desired number of control points. |
|
static |
Returns a B-spline curve of degree degree interpolating the \((x_i, y_i)\) points [42] .
This method uses the uniformly spaced method for interpolating points with a B-spline curve, and a uniformed clamped knot vector, as described in http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/.
| x | the values of \(X\). |
| y | the values of \(Y\). |
| degree | the degree of the B-spline. |
| double derivative | ( | double | x | ) |
Computes (or estimates) the first derivative of the function at point x.
| x | the point to evaluate the derivative to. |
Implements MathFunctionWithFirstDerivative.
| double derivative | ( | double | x, |
| int | n | ||
| ) |
Computes (or estimates) the \(n\)th derivative of the function at point x.
For \(n=0\), this returns the result of umontreal.ssj.functions.MathFunction.evaluate(double).
| x | the point to evaluate the derivate to. |
| n | the order of the derivative. |
| IllegalArgumentException | if n is negative or 0. |
Implements MathFunctionWithDerivative.
| BSpline derivativeBSpline | ( | ) |
Returns the derivative B-spline object of the current variable.
Using this function and the returned object, instead of the derivative method, is strongly recommended if one wants to compute many derivative values.
| BSpline derivativeBSpline | ( | int | i | ) |
Returns the \(i\)th derivative B-spline object of the current variable; \(i\) must be less than the degree of the original B-spline.
Using this function and the returned object, instead of the derivative method, is strongly recommended if one wants to compute many derivative values.
| i | the degree of the derivative. |
| double evaluate | ( | final double | x | ) |
Returns the value of the function evaluated at \(x\).
| x | value at which the function is evaluated |
x Implements MathFunction.
| double [] getKnots | ( | ) |
Returns an array containing the knot vector \((t_0, t_{m-1})\).
| double getMaxKnot | ( | ) |
Returns the knot maximal value.
| double getMinKnot | ( | ) |
Returns the knot minimal value.
| double [] getX | ( | ) |
Returns the \(X_i\) coordinates for this spline.
| double [] getY | ( | ) |
Returns the \(Y_i\) coordinates for this spline.
| double integral | ( | double | a, |
| double | b | ||
| ) |
Computes (or estimates) the integral of the function over the interval \([a, b]\).
| a | the starting point of the interval. |
| b | the ending point of the interval. |
Implements MathFunctionWithIntegral.
1.8.14