×

Python Tutorial

Python Basics

Python I/O

Python Operators

Python Conditions & Controls

Python Functions

Python Strings

Python Modules

Python Lists

Python OOPs

Python Arrays

Python Dictionary

Python Sets

Python Tuples

Python Exception Handling

Python NumPy

Python Pandas

Python File Handling

Python WebSocket

Python GUI Programming

Python Image Processing

Python Miscellaneous

Python Practice

Python Programs

What exactly does numpy.exp() do?

Learn, what exactly does numpy.exp() do in Python? By Pranit Sharma Last updated : October 08, 2023

NumPy is an abbreviated form of Numerical Python. It is used for different types of scientific operations in python. Numpy is a vast library in python which is used for almost every kind of scientific or mathematical operation. It is itself an array which is a collection of various methods and functions for processing the arrays.

Python numpy.exp() Method

The numpy.exp() method of numpy is used to Calculate the exponential of all elements in the input array. It takes an argument called out which is a location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have a length equal to the number of outputs.

It also takes an argument called where which takes a condition that is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out array is created via the default out=None, locations within it where the condition is False will remain uninitialized.

Let us understand with the help of an example,

Python program to demonstrate the example of numpy.exp() method

# Import numpy
import numpy as np

# Creating a numpy array
arr = np.array([1,2,3])

# Display original array
print("Original array:\n",arr,"\n")

# Defining an array for finding exponents
a = [1,2,3]

# Using exp function
res = np.exp(arr)

# Display result
print("New Array:\n",res)

Output

The output of the above program is:

Example: What exactly does numpy.exp() do?

Python NumPy Programs »

Advertisement
Advertisement

Comments and Discussions!

Load comments ↻


Advertisement
Advertisement
Advertisement

Copyright © 2025 www.includehelp.com. All rights reserved.