Differentiate Hermite series and multiply each differentiation by scalar using NumPy in Python
Last Updated :
03 Jun, 2022
In this article, we will see how to differentiate the Hermite series and multiply each differentiation by a scalar in python.
hermite.hermder method
The hermite.hermder() is used to differentiate the Hermite series which is available in the NumPy module. We can pass the following parameters, the first parameter will be the c, which is an array of Hermite series coefficients. Further, the next parameter is m which is non-negative (Default: 1) and sci is a scalar which is the last parameter.
Syntax: hermite.hermder(c,m,sci)
Parameter:
- c: Array of Hermite series coefficients.
- m: Number of derivatives taken, must be non-negative. (Default: 1)
- sci: scalar
Return: Hermite series of the derivative.
Example 1:
In this example, we have created the 1D array containing 5 elements using hermite.hermder() function, we are differentiating the Hermite series in python with multiply each differentiation a scalar -1, and the number of derivatives is taken as m=2.
Python3
import numpy as np
from numpy.polynomial import hermite
c = np.array([ 1 , 2 , 3 , 4 , 5 ])
print (c)
print ( "Shape of the array is : " ,c.shape)
print ( "The dimension of the array is : " ,c.ndim)
print ( "Datatype of our Array is : " ,c.dtype)
print (hermite.hermder(c, m = 2 , scl = - 1 ))
|
Output:
[1 2 3 4 5]
Shape of the array is : (5,)
The dimension of the array is : 1
Datatype of our Array is : int32
[ 24. 96. 240.]
Example 2:
In this example, we have created the 2D array containing 5 elements each and using hermite.hermder() function, we are differentiating the Hermite series in python with multiply each differentiation a scalar -1.
Python3
import numpy as np
from numpy.polynomial import hermite
c = np.array([[ 1 , 2 , 3 , 4 , 5 ],[ 56 , 65 , 44 , 44 , 33 ]])
print (c)
print ( "Shape of the array is : " ,c.shape)
print ( "The dimension of the array is : " ,c.ndim)
print ( "Datatype of our Array is : " ,c.dtype)
print (hermite.hermder(c, scl = - 1 ))
|
Output:
[[ 1 2 3 4 5]
[56 65 44 44 33]]
Shape of the array is : (2, 5)
The dimension of the array is : 2
Datatype of our Array is : int64
[[-112. -130. -88. -88. -66.]]
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...