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

Function legsub

numpy/polynomial/legendre.py:364–405  ·  view source on GitHub ↗

Subtract one Legendre series from another. Returns the difference of two Legendre series `c1` - `c2`. The sequences of coefficients are from lowest order term to highest, i.e., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``. Parameters ---------- c1, c2 : array

(c1, c2)

Source from the content-addressed store, hash-verified

362
363
364def legsub(c1, c2):
365 """
366 Subtract one Legendre series from another.
367
368 Returns the difference of two Legendre series `c1` - `c2`. The
369 sequences of coefficients are from lowest order term to highest, i.e.,
370 [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``.
371
372 Parameters
373 ----------
374 c1, c2 : array_like
375 1-D arrays of Legendre series coefficients ordered from low to
376 high.
377
378 Returns
379 -------
380 out : ndarray
381 Of Legendre series coefficients representing their difference.
382
383 See Also
384 --------
385 legadd, legmulx, legmul, legdiv, legpow
386
387 Notes
388 -----
389 Unlike multiplication, division, etc., the difference of two Legendre
390 series is a Legendre series (without having to "reproject" the result
391 onto the basis set) so subtraction, just like that of "standard"
392 polynomials, is simply "component-wise."
393
394 Examples
395 --------
396 >>> from numpy.polynomial import legendre as L
397 >>> c1 = (1,2,3)
398 >>> c2 = (3,2,1)
399 >>> L.legsub(c1,c2)
400 array([-2., 0., 2.])
401 >>> L.legsub(c2,c1) # -C.legsub(c1,c2)
402 array([ 2., 0., -2.])
403
404 """
405 return pu._sub(c1, c2)
406
407
408def legmulx(c):

Callers 1

legmulFunction · 0.85

Calls 1

_subMethod · 0.80

Tested by

no test coverage detected