RationalCurve Class

Represents a curve that is a quotient of two polynomials (rational function).

Definition

Namespace: Numerics.NET.Curves.Nonlinear
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.0.0
C#
public class RationalCurve : NonlinearCurve
Inheritance
Object  →  Curve  →  NonlinearCurve  →  RationalCurve

Remarks

Use the RationalCurve class to represent a rational function that can be used in non-linear least squares fitting. Rational functions are ratios of polynomials and can approximate a wide variety of functions with relatively few parameters.

Equation:

y = (a₀ + a₁x + a₂x² + ... + aₙx^n) / (1 + b₁x + b₂x² + ... + b_dx^d)

Parameters:

A rational curve has n+d+1 parameters, where n is the degree of the numerator polynomial, and d is the degree of the denominator polynomial. The first n+1 parameters are the coefficients of the numerator polynomial (a₀, a₁, ..., aₙ), starting with the constant term. The remaining d parameters are the coefficients of the denominator polynomial (b₁, b₂, ..., b_d), starting with the linear term. The denominator always has an implicit constant term of 1.

Degree Selection Guidelines:

  • Start with low degrees (e.g., (1,1) or (2,1)) and increase only if needed
  • Higher degrees provide more flexibility but risk overfitting
  • Use cross-validation or information criteria (AIC, BIC) to select optimal degrees
  • Numerator degree typically equals or exceeds denominator degree for most applications

Applications:

  • Approximating complex mathematical functions
  • Transfer function modeling in control systems
  • Padé approximants
  • Modeling asymptotic behavior with oblique asymptotes
  • Rational interpolation

Numerical Considerations:

  • Poles:
  • Overfitting:
  • Initial values:
  • Scaling:

Asymptotic Behavior:

As x → ±∞, the behavior depends on the degree relationship:

  • If n < d: y → 0 (horizontal asymptote at y = 0)
  • If n = d: y → aₙ/b_d (horizontal asymptote at ratio of leading coefficients)
  • If n > d: y → ±∞ (oblique or higher-order asymptote)

.

For details on how to fit a curve of this type, see the NonlinearCurveFitter class.

Constructors

RationalCurve Constructs a new RationalCurve with the specified degrees in the numerator and the denominator.

Properties

DegreeOfDenominator Gets the degree of the polynomial of the denominator of the curve.
DegreeOfNumerator Gets the degree of the polynomial of the numerator of the curve.
Parameters Gets the collection of parameters that determine the shape of this Curve.
(Inherited from Curve)

Methods

Clone Constructs an exact copy of this instance.
(Inherited from Curve)
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FillNumericalPartialDerivatives Fills a dense vector with the partial derivatives of the curve with respect to each of the curve parameters computed using numerical differentiation.
(Inherited from NonlinearCurve)
FillPartialDerivatives Fills a dense vector with the partial derivatives of the curve with respect to each of the curve parameters.
(Overrides NonlinearCurve.FillPartialDerivatives(Double, DenseVector<Double>))
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
FindRoots Gets the set of X-coordinates where the curve crosses the X-axis.
(Overrides Curve.FindRoots())
GetCurveFitter Returns a CurveFitter object that can be used to fit the curve to data.
(Inherited from NonlinearCurve)
GetDerivative Returns a Curve that represents the derivative of this Curve.
(Inherited from Curve)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetInitialFitParameters Returns a vector containing initial values for the parameters for a curve fit through on the specified data.
(Inherited from NonlinearCurve)
GetPartialDerivatives Returns a vector with the partial derivatives of the curve with respect to each of the curve parameters.
(Inherited from NonlinearCurve)
GetTypeGets the Type of the current instance.
(Inherited from Object)
Integral Gets the definite integral of the curve between the specified X-coordinates.
(Inherited from Curve)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
OnParameterChanged Called after a Curve parameter has been changed.
(Inherited from Curve)
OnParameterChanging Called before the value of a curve parameter is changed.
(Inherited from Curve)
SetParameter Sets a curve parameter to the specified value.
(Inherited from Curve)
SlopeAt(Double[]) Gets the slopes of the curve at the specified X-coordinates.
(Inherited from Curve)
SlopeAt(Double) Gets the slope of the curve at the specified X-coordinate.
(Overrides Curve.SlopeAt(Double))
SlopeAt(ReadOnlySpan<Double>) Gets the slopes of the curve at the specified X-coordinates.
(Inherited from Curve)
SlopeAt(Vector<Double>) Gets the slopes of the curve at the specified X-coordinates.
(Inherited from Curve)
SlopeAt(ReadOnlySpan<Double>, Span<Double>) Gets the slopes of the curve at the specified X-coordinates.
(Inherited from Curve)
Solve Finds the x value where the curve reaches the specified y value.
(Inherited from Curve)
TangentAt Gets the tangent line to the curve at the specified X-coordinate.
(Inherited from Curve)
ToStringReturns a string that represents the current object.
(Inherited from Object)
ValueAt(Double[]) Gets the Y-values of the curve at the specified X-coordinates.
(Inherited from Curve)
ValueAt(Double) Gets the Y-value of the curve at the specified X-coordinate.
(Overrides Curve.ValueAt(Double))
ValueAt(ReadOnlySpan<Double>) Gets the Y-values of the curve at the specified X-coordinates.
(Inherited from Curve)
ValueAt(Vector<Double>) Gets the Y-values of the curve at the specified X-coordinates.
(Inherited from Curve)
ValueAt(ReadOnlySpan<Double>, Span<Double>) Gets the Y-values of the curve at the specified X-coordinates.
(Inherited from Curve)

See Also