MCPcopy Create free account
hub / github.com/numpy/numpy / basis

Method basis

numpy/polynomial/_polybase.py:1126–1164  ·  view source on GitHub ↗

Series basis polynomial of degree `deg`. Returns the series representing the basis polynomial of degree `deg`. .. versionadded:: 1.7.0 Parameters ---------- deg : int Degree of the basis polynomial for the series. Must be >= 0. domain :

(cls, deg, domain=None, window=None, symbol='x')

Source from the content-addressed store, hash-verified

1124
1125 @classmethod
1126 def basis(cls, deg, domain=None, window=None, symbol='x'):
1127 """Series basis polynomial of degree `deg`.
1128
1129 Returns the series representing the basis polynomial of degree `deg`.
1130
1131 .. versionadded:: 1.7.0
1132
1133 Parameters
1134 ----------
1135 deg : int
1136 Degree of the basis polynomial for the series. Must be >= 0.
1137 domain : {None, array_like}, optional
1138 If given, the array must be of the form ``[beg, end]``, where
1139 ``beg`` and ``end`` are the endpoints of the domain. If None is
1140 given then the class domain is used. The default is None.
1141 window : {None, array_like}, optional
1142 If given, the resulting array must be if the form
1143 ``[beg, end]``, where ``beg`` and ``end`` are the endpoints of
1144 the window. If None is given then the class window is used. The
1145 default is None.
1146 symbol : str, optional
1147 Symbol representing the independent variable. Default is 'x'.
1148
1149 Returns
1150 -------
1151 new_series : series
1152 A series with the coefficient of the `deg` term set to one and
1153 all others zero.
1154
1155 """
1156 if domain is None:
1157 domain = cls.domain
1158 if window is None:
1159 window = cls.window
1160 ideg = int(deg)
1161
1162 if ideg != deg or ideg < 0:
1163 raise ValueError("deg must be non-negative integer")
1164 return cls([0]*ideg + [1], domain, window, symbol)
1165
1166 @classmethod
1167 def cast(cls, series, domain=None, window=None):

Callers 4

test_basisFunction · 0.80
test_degreeFunction · 0.80
test_copyFunction · 0.80
test_basisFunction · 0.80

Calls

no outgoing calls

Tested by 4

test_basisFunction · 0.64
test_degreeFunction · 0.64
test_copyFunction · 0.64
test_basisFunction · 0.64