
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Differentiate Hermite Series and Multiply Each Differentiation by Scalar Using NumPy in Python
Hermite_e series is also known as probabilist's Hermite polynomial or the physicist's Hermite polynomial. It is available in mathematics which is used to calculate the sum of weighted hermites polynomials. In some particular cases of the quantum mechanics, the Hermite_e series the weight function is given as e^(x^2).
Calculating Hermite_e series
The following is the formula for Hermite_e series.
H_n(x) = (1)^n\:e^(x^2/2)\:d^n/dx^n(e^(x^2/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.
In Numpy library we have the function namely, polynomial.hermite.hermder() to differentiate the hermite series and multiply each differentiation by scalar.
Syntax
Following is the syntax for polynomial.hermite.hermder()
np.polynomial.hermite.hermder(coefficients,derivate_range,scalar)
Example
In the following example, we will multiply the differentiate hermite series by multiplying it with a scalar value defined as 'scl' in the hermite.hermder() function.
import numpy as np from numpy.polynomial import hermite coefficients = np.arange(-10,14,2).reshape(2,3,2) print("The coefficient values:",coefficients) diff_coefficicents = hermite.hermder(coefficients,m = 1,scl = 3) print("The derivative of the coefficient values:",diff_coefficicents)
Output
The coefficient values: [[[-10 -8] [ -6 -4] [ -2 0]] [[ 2 4] [ 6 8] [ 10 12]]] The derivative of the coefficient values: [[[12. 24.] [36. 48.] [60. 72.]]]
Example
In the following example, we will create a differentiation of hermite series for the coefficients, that are in the 2D array format.
import numpy as np from numpy.polynomial import hermite coefficients = np.arange(-40,14,4).reshape(7,2) print("The coefficient values:",coefficients) diff_coefficicents = hermite.hermder(coefficients,m = 2,scl = 1) print("The 2nd order derivative of the coefficient values:",diff_coefficicents)
Output
The coefficient values: [[-40 -36] [-32 -28] [-24 -20] [-16 -12] [ -8 -4] [ 0 4] [ 8 12]] The The 2nd order derivative of the coefficient values: [[-192. -160.] [-384. -288.] [-384. -192.] [ 0. 320.] [ 960. 1440.]]
Example
In the following example, we are calculating the differentiate of the hermite series using the hermite.hermder() function in the numpy library.
import numpy as np def diff_hermite(coefficients,m,scl): from numpy.polynomial import hermite print("The coefficient values:",coefficients) diff_coefficicents = hermite.hermder(coefficients,m,scl) print("The 2nd order derivative of the coefficient values:",diff_coefficicents) diff_hermite(np.linspace(-10,20,20),3,-3)
Output
The coefficient values: [-10. -8.42105263 -6.84210526 -5.26315789 -3.68421053 -2.10526316 -0.52631579 1.05263158 2.63157895 4.21052632 5.78947368 7.36842105 8.94736842 10.52631579 12.10526316 13.68421053 15.26315789 16.84210526 18.42105263 20. ] The 2nd order derivative of the coefficient values: [ 6.82105263e+03 1.90989474e+04 2.72842105e+04 1.36421053e+04 -4.77473684e+04 -1.90989474e+05 -4.58374737e+05 -9.00378947e+05 -1.57566316e+06 -2.55107368e+06 -3.90164211e+06 -5.71058526e+06 -8.06930526e+06 -1.10773895e+07 -1.48426105e+07 -1.94809263e+07 -2.51164800e+07]
Example
In the following example, we are calculating the differentiation of the hermite series by passing the default scalar value and order of the derivative.
import numpy as np def diff_hermite(coefficients): from numpy.polynomial import hermite print("The coefficient values:",coefficients) diff_coefficicents = hermite.hermder(coefficients) print("The default order of derivative of the coefficient values:",diff_coefficicents) diff_hermite(np.linspace(-10,20,20))
Output
The coefficient values: [-10. -8.42105263 -6.84210526 -5.26315789 -3.68421053 -2.10526316 -0.52631579 1.05263158 2.63157895 4.21052632 5.78947368 7.36842105 8.94736842 10.52631579 12.10526316 13.68421053 15.26315789 16.84210526 18.42105263 20. ] The default order of derivative of the coefficient values: [-16.84210526 -27.36842105 -31.57894737 -29.47368421 -21.05263158 -6.31578947 14.73684211 42.10526316 75.78947368 115.78947368 162.10526316 214.73684211 273.68421053 338.94736842 410.52631579 488.42105263 572.63157895 663.15789474 760. ]