MCPcopy Index your code
hub / github.com/numpy/numpy / basis

Method basis

numpy/polynomial/_polybase.py:1115–1151  ·  view source on GitHub ↗

Series basis polynomial of degree `deg`. Returns the series representing the basis polynomial of degree `deg`. Parameters ---------- deg : int Degree of the basis polynomial for the series. Must be >= 0. domain : {None, array_like}, optional

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

Source from the content-addressed store, hash-verified

1113
1114 @classmethod
1115 def basis(cls, deg, domain=None, window=None, symbol='x'):
1116 """Series basis polynomial of degree `deg`.
1117
1118 Returns the series representing the basis polynomial of degree `deg`.
1119
1120 Parameters
1121 ----------
1122 deg : int
1123 Degree of the basis polynomial for the series. Must be >= 0.
1124 domain : {None, array_like}, optional
1125 If given, the array must be of the form ``[beg, end]``, where
1126 ``beg`` and ``end`` are the endpoints of the domain. If None is
1127 given then the class domain is used. The default is None.
1128 window : {None, array_like}, optional
1129 If given, the resulting array must be if the form
1130 ``[beg, end]``, where ``beg`` and ``end`` are the endpoints of
1131 the window. If None is given then the class window is used. The
1132 default is None.
1133 symbol : str, optional
1134 Symbol representing the independent variable. Default is 'x'.
1135
1136 Returns
1137 -------
1138 new_series : series
1139 A series with the coefficient of the `deg` term set to one and
1140 all others zero.
1141
1142 """
1143 if domain is None:
1144 domain = cls.domain
1145 if window is None:
1146 window = cls.window
1147 ideg = int(deg)
1148
1149 if ideg != deg or ideg < 0:
1150 raise ValueError("deg must be non-negative integer")
1151 return cls([0] * ideg + [1], domain, window, symbol)
1152
1153 @classmethod
1154 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