Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Machine Learning
avec Scikit-Learn
Voir le programme détaillé
Classe « BSpline »

Méthode scipy.interpolate.BSpline.from_power_basis

Signature de la méthode from_power_basis

def from_power_basis(pp, bc_type='not-a-knot') 

Description

help(BSpline.from_power_basis)

Construct a polynomial in the B-spline basis
from a piecewise polynomial in the power basis.

For now, accepts ``CubicSpline`` instances only.

Parameters
----------
pp : CubicSpline
    A piecewise polynomial in the power basis, as created
    by ``CubicSpline``
bc_type : string, optional
    Boundary condition type as in ``CubicSpline``: one of the
    ``not-a-knot``, ``natural``, ``clamped``, or ``periodic``.
    Necessary for construction an instance of ``BSpline`` class.
    Default is ``not-a-knot``.

Returns
-------
b : BSpline object
    A new instance representing the initial polynomial
    in the B-spline basis.

Notes
-----
.. versionadded:: 1.8.0

Accepts only ``CubicSpline`` instances for now.

The algorithm follows from differentiation
the Marsden's identity [1]: each of coefficients of spline
interpolation function in the B-spline basis is computed as follows:

.. math::

    c_j = \sum_{m=0}^{k} \frac{(k-m)!}{k!}
               c_{m,i} (-1)^{k-m} D^m p_{j,k}(x_i)

:math:`c_{m, i}` - a coefficient of CubicSpline,
:math:`D^m p_{j, k}(x_i)` - an m-th defivative of a dual polynomial
in :math:`x_i`.

``k`` always equals 3 for now.

First ``n - 2`` coefficients are computed in :math:`x_i = x_j`, e.g.

.. math::

    c_1 = \sum_{m=0}^{k} \frac{(k-1)!}{k!} c_{m,1} D^m p_{j,3}(x_1)

Last ``nod + 2`` coefficients are computed in ``x[-2]``,
``nod`` - number of derivatives at the ends.

For example, consider :math:`x = [0, 1, 2, 3, 4]`,
:math:`y = [1, 1, 1, 1, 1]` and bc_type = ``natural``

The coefficients of CubicSpline in the power basis:

:math:`[[0, 0, 0, 0, 0], [0, 0, 0, 0, 0],
[0, 0, 0, 0, 0], [1, 1, 1, 1, 1]]`

The knot vector: :math:`t = [0, 0, 0, 0, 1, 2, 3, 4, 4, 4, 4]`

In this case

.. math::

    c_j = \frac{0!}{k!} c_{3, i} k! = c_{3, i} = 1,~j = 0, ..., 6

References
----------
.. [1] Tom Lyche and Knut Morken, Spline Methods, 2005, Section 3.1.2



Vous êtes un professionnel et vous avez besoin d'une formation ? RAG (Retrieval-Augmented Generation)
et Fine Tuning d'un LLM
Voir le programme détaillé