numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
polyadd(a1, a2)
note

This forms part of the old polynomial API. Since version 1.4, the new polynomial API defined in :None:None:`numpy.polynomial` is preferred. A summary of the differences can be found in the :None:doc:`transition guide </reference/routines.polynomials>`.

Returns the polynomial resulting from the sum of two input polynomials. Each input must be either a poly1d object or a 1D sequence of polynomial coefficients, from highest to lowest degree.

Parameters

a1, a2 : array_like or poly1d object

Input polynomials.

Returns

out : ndarray or poly1d object

The sum of the inputs. If either input is a poly1d object, then the output is also a poly1d object. Otherwise, it is a 1D array of polynomial coefficients from highest to lowest degree.

Find the sum of two polynomials.

See Also

poly
poly1d

A one-dimensional polynomial class.

polyadd
polyder
polydiv
polyfit
polyint
polysub
polyval

Examples

>>> np.polyadd([1, 2], [9, 5, 4])
array([9, 6, 6])

Using poly1d objects:

>>> p1 = np.poly1d([1, 2])
... p2 = np.poly1d([9, 5, 4])
... print(p1) 1 x + 2
>>> print(p2)
   2
9 x + 5 x + 4
>>> print(np.polyadd(p1, p2))
   2
9 x + 6 x + 6
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.polynomial.polynomial.polymul numpy.polynomial.polynomial.polypow numpy.polynomial.polynomial.polysub numpy.polymul numpy.polynomial.polynomial.polymulx numpy.polydiv numpy.polynomial.polynomial.polydiv numpy.polyadd numpy.polysub

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/lib/polynomial.py#787
type: <class 'function'>
Commit: