Programming Articles

Page 220 of 2547

Evaluate a polynomial at points x with multidimensioanl array of roots in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 255 Views

To evaluate a polynomial specified by its roots at points x, use the polynomial.polyvalfromroots() method in Python NumPy. This function takes the roots of a polynomial and evaluates the resulting polynomial at given points. Syntax numpy.polynomial.polynomial.polyvalfromroots(x, r, tensor=True) Parameters The function accepts three parameters ? x ? Points at which to evaluate the polynomial. Can be a scalar, list, tuple, or ndarray r ? Array of roots. For multidimensional arrays, the first index represents the root index tensor ? Boolean flag controlling evaluation behavior for multidimensional roots (default: True) Understanding ...

Read More

Differentiate a Hermite_e series and set the derivatives in Python

Niharika Aitam
Niharika Aitam
Updated on 26-Mar-2026 236 Views

The Hermite_e series (probabilist's Hermite polynomials) is a mathematical series used in quantum mechanics and probability theory. The weight function is e^(−x²/2). This guide shows how to differentiate Hermite_e series using NumPy's polynomial module. Formula The Hermite_e polynomial formula is: H_n(x) = (−1)^n e^(x²/2) d^n/dx^n(e^(−x²/2)) Where: H_n(x) is the nth Hermite polynomial of degree n x is the independent variable d^n/dx^n denotes the nth derivative with respect to x Basic Hermite_e Series Differentiation To differentiate a Hermite_e series, use hermite_e.hermeder() function with coefficient arrays ? import numpy as np ...

Read More

Differentiate a Hermite_e series with multidimensional coefficients in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 214 Views

To differentiate a Hermite_e series with multidimensional coefficients, use the hermite_e.hermeder() method in Python. This method can handle arrays where different axes correspond to different variables. Syntax numpy.polynomial.hermite_e.hermeder(c, m=1, scl=1, axis=0) Parameters The method accepts the following parameters: c − Array of Hermite_e series coefficients. If multidimensional, different axes correspond to different variables m − Number of derivatives taken, must be non-negative (Default: 1) scl − Scalar multiplier for each differentiation. Final result is multiplied by scl**m (Default: 1) axis − Axis over which the derivative is taken (Default: 0) ...

Read More

Differentiate a Hermite_e series in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 210 Views

To differentiate a Hermite_e series, use the hermite_e.hermeder() method in Python. This function computes the derivative of a Hermite_e polynomial series represented by its coefficients. Syntax numpy.polynomial.hermite_e.hermeder(c, m=1, scl=1, axis=0) Parameters The function accepts the following parameters: c − Array of Hermite_e series coefficients. If multidimensional, different axes correspond to different variables m − Number of derivatives to take (default: 1). Must be non-negative scl − Scalar multiplier for each differentiation (default: 1) axis − Axis over which the derivative is taken (default: 0) Example Let's differentiate a Hermite_e ...

Read More

Integrate a polynomial in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 1K+ Views

Polynomial integration is a fundamental mathematical operation. In Python, the numpy.polynomial.polynomial.polyint() method integrates polynomial coefficients efficiently. The coefficients represent a polynomial from low to high degree, so [1, 2, 3] represents 1 + 2*x + 3*x². Syntax numpy.polynomial.polynomial.polyint(c, m=1, k=[], lbnd=0, scl=1, axis=0) Parameters c − 1-D array of polynomial coefficients, ordered from low to high degree m − Order of integration (default: 1) k − Integration constant(s) (default: []) lbnd − Lower bound of the integral (default: 0) scl − Scaling factor applied after each integration (default: 1) axis − Axis over ...

Read More

Evaluate a 2-D polynomial at points (x, y) with 1D array of coefficient in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 270 Views

To evaluate a 2-D polynomial at points (x, y), use the polynomial.polyval2d() method in Python NumPy. The method returns the values of the two dimensional polynomial at points formed with pairs of corresponding values from x and y. The parameter c is an array of coefficients ordered so that the coefficient of the term of multidegree i, j is contained in c[i, j]. If c has dimension greater than two, the remaining indices enumerate multiple sets of coefficients. If c has fewer than two dimensions, ones are implicitly appended to its shape to make it 2-D. Syntax ...

Read More

Evaluate a 2-D polynomial at points (x, y) with 3D array of coefficient in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 300 Views

To evaluate a 2-D polynomial at points (x, y), use the polynomial.polyval2d() method in Python NumPy. The method returns the values of the two-dimensional polynomial at points formed with pairs of corresponding values from x and y. The two-dimensional series is evaluated at the points (x, y), where x and y must have the same shape. If x or y is a list or tuple, it is first converted to an ndarray, otherwise it is left unchanged and, if it isn't an ndarray, it is treated as a scalar. The parameter c is an array of coefficients ordered ...

Read More

Evaluate a polynomial when coefficients are multi-dimensional in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 433 Views

To evaluate a polynomial at points x with multi-dimensional coefficients, use the numpy.polynomial.polynomial.polyval() method in Python. This method handles coefficient arrays where multiple polynomials can be stored in different columns. Parameters The polyval() method accepts three key parameters ? x ? The points at which to evaluate the polynomial. Can be a scalar, list, or array c ? Array of coefficients where c[n] contains coefficients for degree n terms. For multidimensional arrays, columns represent different polynomials tensor ? If True (default), evaluates every column of coefficients for every element of x. If False, broadcasts x over ...

Read More

Raise a polynomial to a power in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 810 Views

To raise a polynomial to a power in Python, use the numpy.polynomial.polynomial.polypow() method. This function returns the polynomial raised to the specified power, where coefficients are ordered from low to high degree. Syntax numpy.polynomial.polynomial.polypow(c, pow, maxpower=16) Parameters The function accepts the following parameters: c − A 1-D array of polynomial coefficients ordered from low to high degree (e.g., [1, 2, 3] represents 1 + 2*x + 3*x²) pow − The power to which the polynomial will be raised maxpower − Maximum power allowed to limit series growth (default is 16) ...

Read More

Divide one polynomial by another in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 1K+ Views

To divide one polynomial by another in Python, use the numpy.polynomial.polynomial.polydiv() method. This function performs polynomial division and returns both the quotient and remainder. The arguments are sequences of coefficients from lowest order term to highest, e.g., [1, 2, 3] represents 1 + 2*x + 3*x². Syntax numpy.polynomial.polynomial.polydiv(c1, c2) Parameters The parameters are ? c1 − 1-D array of coefficients for the dividend polynomial c2 − 1-D array of coefficients for the divisor polynomial Return Value Returns a tuple containing two arrays ? Quotient − Array of ...

Read More
Showing 2191–2200 of 25,466 articles
« Prev 1 218 219 220 221 222 2547 Next »
Advertisements