parameters: (cls, pp, extrapolate=None)
return_statement: return cls.construct_fast(c, pp.x, extrapolate, pp.axis)
docstring: Construct a piecewise polynomial in Bernstein basis
          from a power basis polynomial.
  
          Parameters
          ----------
          pp : PPoly
              A piecewise polynomial in the power basis
          extrapolate : bool or 'periodic', optional
              If bool, determines whether to extrapolate to out-of-bounds points
              based on first and last intervals, or to return NaNs.
              If 'periodic', periodic extrapolation is used. Default is True.
docstring_summary: Construct a piecewise polynomial in Bernstein basis
          from a power basis polynomial.
docstring_tokens: Construct a piecewise polynomial in Bernstein basis from a power basis polynomial .
function: def from_power_basis(cls, pp, extrapolate=None):
          """
          Construct a piecewise polynomial in Bernstein basis
          from a power basis polynomial.
  
          Parameters
          ----------
          pp : PPoly
              A piecewise polynomial in the power basis
          extrapolate : bool or 'periodic', optional
              If bool, determines whether to extrapolate to out-of-bounds points
              based on first and last intervals, or to return NaNs.
              If 'periodic', periodic extrapolation is used. Default is True.
          """
          dx = np.diff(pp.x)
          k = pp.c.shape[0] - 1   # polynomial order
  
          rest = (None,)*(pp.c.ndim-2)
  
          c = np.zeros_like(pp.c)
          for a in range(k+1):
              factor = pp.c[a] / comb(k, k-a) * dx[(slice(None),)+rest]**(k-a)
              for j in range(k-a, k+1):
                  c[j] += factor * comb(j, k-a)
  
          if extrapolate is None:
              extrapolate = pp.extrapolate
  
          return cls.construct_fast(c, pp.x, extrapolate, pp.axis)
function_tokens: def from_power_basis ( cls , pp , extrapolate = None ) : dx = np . diff ( pp . x ) k = pp . c . shape [ 0 ] - 1 # polynomial order rest = ( None , ) * ( pp . c . ndim - 2 ) c = np . zeros_like ( pp . c ) for a in range ( k + 1 ) : factor = pp . c [ a ] / comb ( k , k - a ) * dx [ ( slice ( None ) , ) + rest ] ** ( k - a ) for j in range ( k - a , k + 1 ) : c [ j ] += factor * comb ( j , k - a ) if extrapolate is None : extrapolate = pp . extrapolate return cls . construct_fast ( c , pp . x , extrapolate , pp . axis )