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)
| 192 | return c[:ind[-1] + 1].copy() |
| 193 | |
| 194 | def getdomain(x): |
| 195 | """ |
| 196 | Return a domain suitable for given abscissae. |
| 197 | |
| 198 | Find a domain suitable for a polynomial or Chebyshev series |
| 199 | defined at the values supplied. |
| 200 | |
| 201 | Parameters |
| 202 | ---------- |
| 203 | x : array_like |
| 204 | 1-d array of abscissae whose domain will be determined. |
| 205 | |
| 206 | Returns |
| 207 | ------- |
| 208 | domain : ndarray |
| 209 | 1-d array containing two values. If the inputs are complex, then |
| 210 | the two returned points are the lower left and upper right corners |
| 211 | of the smallest rectangle (aligned with the axes) in the complex |
| 212 | plane containing the points `x`. If the inputs are real, then the |
| 213 | two points are the ends of the smallest interval containing the |
| 214 | points `x`. |
| 215 | |
| 216 | See Also |
| 217 | -------- |
| 218 | mapparms, mapdomain |
| 219 | |
| 220 | Examples |
| 221 | -------- |
| 222 | >>> import numpy as np |
| 223 | >>> from numpy.polynomial import polyutils as pu |
| 224 | >>> points = np.arange(4)**2 - 5; points |
| 225 | array([-5, -4, -1, 4]) |
| 226 | >>> pu.getdomain(points) |
| 227 | array([-5., 4.]) |
| 228 | >>> c = np.exp(complex(0,1)*np.pi*np.arange(12)/6) # unit circle |
| 229 | >>> pu.getdomain(c) |
| 230 | array([-1.-1.j, 1.+1.j]) |
| 231 | |
| 232 | """ |
| 233 | [x] = as_series([x], trim=False) |
| 234 | if x.dtype.char in np.typecodes['Complex']: |
| 235 | rmin, rmax = x.real.min(), x.real.max() |
| 236 | imin, imax = x.imag.min(), x.imag.max() |
| 237 | return np.array((complex(rmin, imin), complex(rmax, imax))) |
| 238 | else: |
| 239 | return np.array((x.min(), x.max())) |
| 240 | |
| 241 | def mapparms(old, new): |
| 242 | """ |