This is a pre-release version (latest). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy latest / numpy / polyadd

_ArrayFunctionDispatcher

numpy:polyadd

source: /dev/numpy/build-install/usr/lib/python3.14/site-packages/numpy/lib/_polynomial_impl.py :795

Signature

def   polyadd ( a1 a2 )

Summary

Find the sum of two polynomials.

Extended Summary

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.

Examples

import numpy as np
np.polyadd([1, 2], [9, 5, 4])
Using poly1d objects:
p1 = np.poly1d([1, 2])
p2 = np.poly1d([9, 5, 4])
print(p1)
print(p2)
print(np.polyadd(p1, p2))

See also

poly
poly1d

A one-dimensional polynomial class.

polyadd
polyder
polydiv
polyfit
polyint
polysub
polyval

Aliases

  • numpy.polyadd

Referenced by