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

Function polymulx

numpy/polynomial/polynomial.py:288–325  ·  view source on GitHub ↗

Multiply a polynomial by x. Multiply the polynomial `c` by x, where x is the independent variable. Parameters ---------- c : array_like 1-D array of polynomial coefficients ordered from low to high. Returns ------- out : ndarray Array repre

(c)

Source from the content-addressed store, hash-verified

286
287
288def polymulx(c):
289 """Multiply a polynomial by x.
290
291 Multiply the polynomial `c` by x, where x is the independent
292 variable.
293
294
295 Parameters
296 ----------
297 c : array_like
298 1-D array of polynomial coefficients ordered from low to
299 high.
300
301 Returns
302 -------
303 out : ndarray
304 Array representing the result of the multiplication.
305
306 See Also
307 --------
308 polyadd, polysub, polymul, polydiv, polypow
309
310 Notes
311 -----
312
313 .. versionadded:: 1.5.0
314
315 """
316 # c is a trimmed copy
317 [c] = pu.as_series([c])
318 # The zero series needs special treatment
319 if len(c) == 1 and c[0] == 0:
320 return c
321
322 prd = np.empty(len(c) + 1, dtype=c.dtype)
323 prd[0] = c[0]*0
324 prd[1:] = c
325 return prd
326
327
328def polymul(c1, c2):

Callers 5

herme2polyFunction · 0.85
leg2polyFunction · 0.85
lag2polyFunction · 0.85
herm2polyFunction · 0.85
cheb2polyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected