Monday, June 27, 2022
HomeWordPress DevelopmentCombine a Hermite_e sequence Over Axis 0 utilizing Numpy in Python

Combine a Hermite_e sequence Over Axis 0 utilizing Numpy in Python


View Dialogue

Enhance Article

Save Article

Like Article

On this article, we’ll cowl how one can combine a Hermite_e sequence over axis 0 utilizing NumPy in Python.

NumPy e.hermeint() methodology 

We use the hermite e.hermeint() operate current within the NumPy module of python to combine a Hermite e sequence. The primary parameter ‘arr’ is an array of coefficients from the Hermite e sequence. If ‘arr’ is multi-dimensional, the varied axes correspond to varied variables, with the diploma in every axis being decided by the related index.

The second parameter ‘m’ is the integration’s order and it ought to be constructive. The mixing fixed(s) ok is the third parameter. The primary worth within the checklist is the worth of the primary integral at ‘lbnd’ (the decrease sure of the integral which is an elective parameter having a default worth zero(0)), the second worth is the worth of the second integral, and so forth. when the worth of m == 1, we will use a single scalar relatively than utilizing an inventory. 

‘lbnd’ is the fourth parameter and is the decrease sure of the integral  (The default worth is 0). ‘scl’ is the fifth parameter and it’s a scalar. Earlier than including the combination fixed, the results of every integration is multiplied by ‘scl’ (the default is 1). The axis parameter, which is the sixth parameter, is an axis throughout which the integral is calculated.

Parameters : 

  • arr : (an array_like construction containing Hermite_e sequence coefficients)
  • m : integer, elective parameter
  • ok : {[], checklist, scalar}, elective parameter
  • lbnd : scalar, elective parameter
  • scl : scalar, elective parameter
  • axis : integer, elective parameter

Returns : ndarray

Raises : ValueError (if m < 0, len(ok) > m, np.ndim(lbnd) != 0, or np.ndim(scl) != 0)

Instance 1 :

Importing NumPy and  Hermite_e libraries, create a multidimensional array of coefficients after which use hermite_e.hermeint() 

Python3

from numpy.polynomial import hermite_e as h

  

arr = [[0, 1, 2],[3, 4, 5]]

  

print(h.hermeint(arr, m=2, ok=[1, 2], lbnd=-1, axis=0))

Output :

[[2.         2.66666667 3.33333333]
 [1.         2.         3.        ]
 [0.         0.5        1.        ]
 [0.5        0.66666667 0.83333333]]

Instance 2: 

Python3

import numpy as np

from numpy.polynomial import hermite_e

  

arr = np.arange(6).reshape(2,3)

  

print(hermite_e.hermeint(arr, axis = 0))

Output :

[[1.5 2.  2.5]
 [0.  1.  2. ]
 [1.5 2.  2.5]]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments