Interface SimpleBasisPolynomials

All Superinterfaces:
BasisFunctionsCalculatable, BasisFunctionsMultipliable, ConfederateMatrixCalculatable
All Known Subinterfaces:
BasisPolynomials
All Known Implementing Classes:
Chebyshev, HermiteE, Laguerre, Legendre, LegendreShifted, Monomials, RecurrenceAB, RecurrenceABWithMultiplicationCached

public interface SimpleBasisPolynomials extends BasisFunctionsCalculatable
A basis (possibly non--normalized) with three term recurrence. This interface is typically a part of BasisPolynomials functionality, however when we have a basis with only recurrence coefficients available this interface can be used directly to convert to/from it using convertFunctionTo_PBASIS_from_Basis and convertFunctionTo_Basis_from_PBASIS.
  • Method Details

    • getNext

      double[] getNext(int n, double[] Qnm1, double[] Qnm2, BasisFunctionsCalculatable PBASIS)
      Calculates n-th basis polynomial of this basis in PBASIS basis.
      Parameters:
      n - Q index.
      Qnm1 - Input \( Q_{n-1} \).
      Qnm2 - Input \( Q_{n-2} \).
      PBASIS - The basis in which to calculte.
      Returns:
      \( Q_{n} \) polynomial of this basis in PBASIS basis, array dimension n+1.
    • getBasisFunctionsOnPolynomialArgument

      double[][] getBasisFunctionsOnPolynomialArgument(int numQl, double[] pol, BasisFunctionsCalculatable PBASIS)
      This method calculates \( Q_l(pol(x))\), where pol(x) is a given polynomial and \( Q_l \) is basis finction of this (not PBASIS!) basis. This method may not be stable for a large dimensions of pol.length. Equivalent to numQl applications of getNext(int, double[], double[], com.polytechnik.utils.BasisFunctionsCalculatable) to pol array. The method can be used to calculate e.g. \( T_n(P_k(x)) \) or \( T_n(P_k(L_m(x^j))) \). For example
      
      new Legendre().getBasisFunctionsOnPolynomialArgument(4,new double []{0,0,0,0,1},new Chebyshev())
      ={
      { 1.0 },
      { 0.0, 0.0, 0.0, 0.0, 1.0 },
      { 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.75 },
      { 0.0, 0.0, 0.0, 0.0, 0.375, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.625 }
      }
      
      means
      \( P_0(T_4(x))=T_0 \)
      \( P_1(T_4(x))=T_4(x) \)
      \( P_2(T_4(x))=0.25*T_0+0.75*T_8(x) \)
      \( P_3(T_4(x))=0.375*T_4(x)+0.625*T_{12}(x) \).
      Parameters:
      numQl - The number of basis functions to calculate.
      pol - The polynomial to use in \( Q_l(pol(x))\), it is given in the PBASIS basis.
      PBASIS - the basis in which pol is given and the result is returned.
      Returns:
      An array of numQl dimension, elements: \( Q_0(pol(x)) \), \( Q_1(pol(x)) \), ... \( Q_{numQl-1}(pol(x)) \) in the basis PBASIS.
    • getBasisFunctionsOnPolynomialArgument

      default double[][] getBasisFunctionsOnPolynomialArgument(int numQl, double[] pol)
      The same as getBasisFunctionsOnPolynomialArgument with both pol and result in this basis.
    • getBasisFunctionsMultipliedByPolynomial

      default double[][] getBasisFunctionsMultipliedByPolynomial(int numQl, double[] pol, BasisFunctionsCalculatable PBASIS)
      A helper method to calculate a product of this basis functions by a polynomial in given basis. The method can be used to calculate e.g. \( P_k(x) T_j(x) \) or \( P_k(x) T_j(x) L_i(x) \). For example
      
      new Legendre().getBasisFunctionsMultipliedByPolynomial(4,new double []{0,0,0,0,1},new Chebyshev())
      ={
      { 0.0, 0.0, 0.0, 0.0, 1.0 },
      { 0.0, 0.0, 0.0, 0.5, 0.0, 0.5 },
      { 0.0, 0.0, 0.375, 0.0, 0.25, 0.0, 0.375 },
      { 0.0, 0.3125, 0.0, 0.1875, 0.0, 0.1875, 0.0, 0.3125 }
      }
      
      means
      \( P_0(x)*T_4(x)=T_4(x) \)
      \( P_1(x)*T_4(x)=0.5*T_3(x)+0.5*T_5(x) \)
      \( P_2(x)*T_4(x)=0.375*T_2(x)+0.25*T_4(x)+0.375*T_6(x) \)
      \( P_3(x)*T_4(x)=0.3125*T_1(x)+0.1875*T_{3}(x)+0.1875*T_5(x)+0.3125*T_7(x) \).
    • convertBasisToPBASIS

      default double[][] convertBasisToPBASIS(int num, BasisFunctionsCalculatable PBASIS)
      A helper method to convert this basis to PBASIS. A typical usage is e.g. to convert Chebyshev to Legendre or to a general RecurrenceAB basis. To convert to monomials use PBASIS=new Monomials(). The method applies getNext() in a serie. For example
      
      new Legendre().convertBasisToPBASIS(4,new Chebyshev())
      ={
      { 1.0 },
      { 0.0, 1.0 },
      { 0.25, 0.0, 0.75 },
      { 0.0, 0.375, 0.0, 0.625 }
      }
      
      means
      \( P_0(x)=T_0(x) \)
      \( P_1(x)=T_1(x) \)
      \( P_2(x)=0.25*T_0(x)+0.75*T_2(x) \)
      \( P_3(x)=0.375*T_1(x)+0.625*T_3(x) \).
      Specified by:
      convertBasisToPBASIS in interface BasisFunctionsCalculatable
      Parameters:
      num - The number of elements in serie.
      PBASIS - The basis in which we obtain this basis polynomials.
      Returns:
      getNext(int, double[], double[], com.polytechnik.utils.BasisFunctionsCalculatable) applied to n=0,1,2,...num-1 basis functions; output array elements are this basis polynomials in the basis PBASIS.
    • convertFunctionTo_PBASIS_from_Basis

      default double[] convertFunctionTo_PBASIS_from_Basis(double[] Qcoefs, BasisFunctionsCalculatable PBASIS)
      Convert from basis to PBASIS basis.
      Specified by:
      convertFunctionTo_PBASIS_from_Basis in interface BasisFunctionsCalculatable
      Parameters:
      Qcoefs - Coefficients.
      PBASIS - The basis to convert to.
      Returns:
      Polynomial in PBASIS.