Saturday, November 16, 2024
Google search engine
HomeLanguagesRaise a Hermite_e series to a power using NumPy in Python

Raise a Hermite_e series to a power using NumPy in Python

In this article, we will cover how to raise a Hermite_e series to power in Python using NumPy.

Example

Input: [1,2,3,4,5]

Output: 

 [3.66165553e+08 1.13477694e+09 3.40357434e+09 3.15464455e+09

 4.62071689e+09 2.26002499e+09 2.15384684e+09 6.43945096e+08

 4.48843239e+08 8.58196000e+07 4.66275200e+07 5.62768800e+06

 2.48058600e+06 1.73880000e+05 6.39000000e+04 2.00000000e+03

 6.25000000e+02]

Explanation: Hermite_e series of power.

hermite_e.hermepow method

This hermepow method is available in the hermite_e module which is used to return the power within the given series by taking two parameters. the first parameter is the coefficients_data which is a NumPy array and the second parameter takes power_value to raise the series. Below is the syntax of the Hermite_e method.

Syntax: hermite_e.hermepow(coefficients_data,power_value)

Parameter:

  • c: 1-D array
  • pow: Power to which the series will be raised
  • maxpower: Maximum power allowed

Return: Hermite_e series at points x

Example 1:

In this example, we are creating a NumPy array of 8 elements and returning the Hermite_e series of power-2

Python3




# import the numpy module
import numpy
# import hermite_e
from numpy.polynomial import hermite_e
 
# create array of coefficients with 8 elements
coefficients_data = numpy.array([1, 2, 3, 4, 5, 6, 7, 8])
 
# Display the coefficients
print("Coefficients: ", coefficients_data)
 
# get the shape
print(f"\nShape of an array: {coefficients_data.shape}")
 
# get the dimensions
print(f"Dimension: {coefficients_data.ndim}")
 
# Hermite_e series of power-2
print("\nHermite_e series of power-2: ",
      hermite_e.hermepow(coefficients_data, 2))


Output:

Coefficients:  [1 2 3 4 5 6 7 8]

Shape of an array: (8,)

Dimension: 1

Hermite_e series of power-2:  [3.628790e+05 6.332920e+05 2.764342e+06 1.935364e+06 4.129799e+06

 1.594520e+06 2.230596e+06 5.187600e+05 5.368410e+05 7.548400e+04

 6.174200e+04 4.868000e+03 3.281000e+03 1.120000e+02 6.400000e+01]

Example 2:

In this example, we are creating a NumPy array of 5 elements and returning the Hermite_e series of power-4

Python3




# import the numpy module
import numpy
# import hermite_e
from numpy.polynomial import hermite_e
 
# create array of coefficients with 8 elements
coefficients_data = numpy.array([1, 2, 3, 4, 5, 6, 7, 8])
 
# Display the coefficients
print("Coefficients: ", coefficients_data)
 
# Hermite_e series of power-4
print("\nHermite_e series of power-4: ",
      hermite_e.hermepow(coefficients_data, 4))


Output:

Coefficients:  [1 2 3 4 5 6 7 8]

Hermite_e series of power-4:  [3.97500340e+16 1.49635409e+17 6.90078074e+17 8.12934090e+17

 1.85579789e+18 1.22432879e+18 1.84443090e+18 8.05732481e+17

 9.01019555e+17 2.81488357e+17 2.49199880e+17 5.79907426e+16

 4.23305587e+16 7.49568603e+15 4.63962656e+15 6.30387873e+14

 3.37709500e+14 3.51179224e+13 1.65385994e+13 1.29784246e+12

 5.43940247e+11 3.12738806e+10 1.17804880e+10 4.69559112e+08

 1.60270881e+08 3.96720000e+06 1.23532800e+06 1.43360000e+04

 4.09600000e+03]

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments