Skip to content
Related Articles

Related Articles

Differentiate a Hermite series in Python

View Discussion
Improve Article
Save Article
  • Last Updated : 22 Apr, 2022

In this article, we will be looking at the step-wise procedure to differentiate a Hermite series in Python.

Differentiate a Hermite series in Python:

Here, we need to call the np.hermder() function from the NumPy package. And pass the parameter, 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).

Syntax: np.hermder(series, m)

Parameter:

  • c: Array of Hermite series coefficients.
  • m: Number of derivatives taken, must be non-negative. (Default: 1)

Return: Return the coefficient of differentiated series.

Example 1:

In this example, we have created the array containing 10 data points from series 1 to 10 and with the use of the np.hermder() function, we are differentiating the Hermite series in python.

Python3




import numpy as np
from numpy.polynomial import hermite
  
gfg = np.array([1,2,3,4,5,6,7,8,9,10])
  
print("Array - ", gfg)
  
print("Dimension of Array:-",gfg.ndim)
  
print("Datatype of Array:-",gfg.dtype)
  
print("Shape of Array:-",gfg.shape)
  
print("Differentiated  Hermite series", hermite.hermder(gfg))

Output:

Array -  [ 1  2  3  4  5  6  7  8  9 10]
Dimension of Array:- 1
Datatype of Array:- int32
Shape of Array:- (10,)
Differentiated  Hermite series [  4.  12.  24.  40.  60.  84. 112. 144. 180.]

Example 2:

In this example, we will differentiate a Hermite series from an array with 5 data  points  and m=2 using the np.hermder() function from the NumPy package of Python

Python3




import numpy as np
from numpy.polynomial import hermite
  
gfg = np.array([56,84,87,44,98])
  
print("Array - ", gfg)
  
print("Dimension of Array:-",gfg.ndim)
  
print("Datatype of Array:-",gfg.dtype)
  
print("Shape of Array:-",gfg.shape)
  
print("Differentiated  Hermite series", hermite.hermder(gfg, m=2))

Output:

Array -  [56 84 87 44 98]
Dimension of Array:- 1
Datatype of Array:- int32
Shape of Array:- (5,)
Differentiated  Hermite series [ 696. 1056. 4704.]

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!