Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

function
numpy
python
communitycreator

What is the numpy.expm1() function in NumPy?

Onyejiaku Theophilus Chidalu

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Overview

The numpy.expm1 function in NumPy computes the exponential minus one (exp(x) - 1) for all elements of a given input array.

Syntax

numpy.expm1(x, out=None, where=True, *)
Syntax for the numpy.expm1() function

Parameter values

The numpy.expm1() function takes the following parameter values:

  • x: This is the array-like object that contains the input values. It is required.
  • out: This is the location where the result obtained is stored. It is optional.
  • where: This is the condition over which the broadcast is done over the input. It is optional.
  • **kwargs: This represents keyword-only arguments.

Return value

The numpy.expm1 function returns an element-wise exponential minus one of the input array.

Example

import numpy as np
# Implementing the numpy.expm1() function
print(np.expm1(5))
print(np.expm1(0.5))
print(np.expm1(1e-10))
Implementing the expm1() function

Explanation

  • Line 1: We import the numpy module.
  • Lines 4–6: We implement the numpy.expm1() function on different input values. Then, we print each result to the console.

RELATED TAGS

function
numpy
python
communitycreator

CONTRIBUTOR

Onyejiaku Theophilus Chidalu

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring