Articles on Trending Technologies

Technical articles with clear explanations and examples

Differentiate a Hermite_e series in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 258 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 321 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 358 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 474 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 876 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

Array axis summations with Einstein summation convention in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 345 Views

The einsum() method evaluates the Einstein summation convention on operands. Using the Einstein summation convention, many common multi-dimensional, linear algebraic array operations can be represented in a simple fashion. This method provides flexibility to compute array operations including axis summations by specifying subscript labels. For array axis summations with Einstein summation convention, use the numpy.einsum() method. The first parameter is the subscript string that specifies the summation pattern, and the second parameter is the input array. Syntax numpy.einsum(subscripts, *operands) Parameters subscripts − String specifying the subscripts for summation as comma separated list ...

Read More

Extract the diagonal of a matrix with Einstein summation convention in Python

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

The Einstein summation convention provides a concise way to express array operations. The numpy.einsum() method implements this convention, allowing us to extract matrix diagonals using subscript notation like 'ii->i'. Understanding Einstein Summation for Diagonals The subscript 'ii->i' means we take elements where both indices are equal (diagonal elements) and output them as a 1D array. The repeated index i on the left indicates we want elements at positions (0, 0), (1, 1), (2, 2), etc. Basic Example Here's how to extract diagonal elements from a 4x4 matrix ? import numpy as np # ...

Read More

Get the trace of a matrix with Einstein summation convention in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 787 Views

The einsum() method evaluates the Einstein summation convention on operands. Using the Einstein summation convention, many common multi-dimensional, linear algebraic array operations can be represented in a simple fashion. To get the trace of a matrix with Einstein summation convention, use the numpy.einsum() method. The trace is the sum of diagonal elements, which can be computed using the subscript 'ii'. Syntax numpy.einsum(subscripts, *operands) Parameters: subscripts − String specifying the subscripts for summation operands − Input arrays for the operation Basic Example Let's create a 4x4 matrix and calculate its trace ...

Read More
Showing 2421–2430 of 61,299 articles
« Prev 1 241 242 243 244 245 6130 Next »
Advertisements