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

Function getdomain

numpy/polynomial/polyutils.py:214–258  ·  view source on GitHub ↗

Return a domain suitable for given abscissae. Find a domain suitable for a polynomial or Chebyshev series defined at the values supplied. Parameters ---------- x : array_like 1-d array of abscissae whose domain will be determined. Returns ------- domai

(x)

Source from the content-addressed store, hash-verified

212 return c[:ind[-1] + 1].copy()
213
214def getdomain(x):
215 """
216 Return a domain suitable for given abscissae.
217
218 Find a domain suitable for a polynomial or Chebyshev series
219 defined at the values supplied.
220
221 Parameters
222 ----------
223 x : array_like
224 1-d array of abscissae whose domain will be determined.
225
226 Returns
227 -------
228 domain : ndarray
229 1-d array containing two values. If the inputs are complex, then
230 the two returned points are the lower left and upper right corners
231 of the smallest rectangle (aligned with the axes) in the complex
232 plane containing the points `x`. If the inputs are real, then the
233 two points are the ends of the smallest interval containing the
234 points `x`.
235
236 See Also
237 --------
238 mapparms, mapdomain
239
240 Examples
241 --------
242 >>> from numpy.polynomial import polyutils as pu
243 >>> points = np.arange(4)**2 - 5; points
244 array([-5, -4, -1, 4])
245 >>> pu.getdomain(points)
246 array([-5., 4.])
247 >>> c = np.exp(complex(0,1)*np.pi*np.arange(12)/6) # unit circle
248 >>> pu.getdomain(c)
249 array([-1.-1.j, 1.+1.j])
250
251 """
252 [x] = as_series([x], trim=False)
253 if x.dtype.char in np.typecodes['Complex']:
254 rmin, rmax = x.real.min(), x.real.max()
255 imin, imax = x.imag.min(), x.imag.max()
256 return np.array((complex(rmin, imin), complex(rmax, imax)))
257 else:
258 return np.array((x.min(), x.max()))
259
260def mapparms(old, new):
261 """

Callers

nothing calls this directly

Calls 3

as_seriesFunction · 0.85
minMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected