- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Return the result of the negative power to which the input value is raised with scimath in Python

To return the result of the power to which the input value is raised with scimath, use the scimath.power() method in Python. Returns x to the power p, i.e. the result of x**p. If x and p are scalars, so is out, otherwise an array is returned. If x contains negative values, the output is converted to the complex domain. The parameter x is the input value

The parameter p is the power(s) to which x is raised. If x contains multiple values, p has to either be a scalar, or contain the same number of values as x. In the latter case, the result is x[0]**p[0], x[1]**p[1], ....

## Steps

At first, import the required libraries −

import numpy as np

Creating a numpy array using the array() method −

arr = np.array([2, 4, 8, 16, 32])

Display the array −

print("Our Array...

",arr)

Check the Dimensions −

print("

Dimensions of our Array...

",arr.ndim)

Get the Datatype −

print("

Datatype of our Array object...

",arr.dtype)

Get the Shape −

print("

Shape of our Array object...

",arr.shape)

To return the result of the power to which the input value is raised with scimath, use the scimath.power() method in Python −

print("

Result...

",np.emath.power(arr, -2))

## Example

import numpy as np # Creating a numpy array using the array() method arr = np.array([2, 4, 8, 16, 32]) # Display the array print("Our Array...

",arr) # Check the Dimensions print("

Dimensions of our Array...

",arr.ndim) # Get the Datatype print("

Datatype of our Array object...

",arr.dtype) # Get the Shape print("

Shape of our Array object...

",arr.shape) # To return the result of the power to which the input value is raised with scimath, use the scimath.power() method in Python print("

Result...

",np.emath.power(arr, -2))

## Output

Our Array... [ 2 4 8 16 32] Dimensions of our Array... 1 Datatype of our Array object... int64 Shape of our Array object... (5,) Result... [0.25 0.0625 0.015625 0.00390625 0.00097656]

- Related Articles
- Return the result of the power to which the negative input value is raised with scimath in Python
- Return the result of the power to which the input value is raised with scimath in Python
- To return value of a number raised to the power of another number, we should use ^ operator in MySQL?
- Return the square of the complex-value input in Python
- Compute the square root of negative input with emath in Python
- Return a scalar type which is common to the input arrays in Python
- Compute the natural logarithm with scimath in Python
- Compute the inverse cosine with scimath in Python
- Compute the inverse sine with scimath in Python
- EXPONENTS AND POWER:If the question is that 10 raised by power 22 + 10 raised by power 20, divided by 10 raised by power 20, then calculate the answer.
- Return the base 2 logarithm for complex value input in Python
- Find value of y mod (2 raised to power x) in C++
- Why is any number raised to the power 0 always 1?
- Compute the logarithm base 2 with scimath in Python
- Compute the logarithm base n with scimath in Python