Numpy Constants

Description

NumPy has several constants we can make use of:

  • numpy.PINF: a floating point representation of positive infinity
  • numpy.NINF: a floating point representation of negative infinity
  • numpy.e: Euler's constant
  • numpy.euler_gamma: Euler's gamma constant
  • numpy.pi: Pi.

While age has built in constants for pi, infinity and e, it is better to use the NumPy constants when writing cells in NumPy, as certaint NumPy functions such as numpy.isinf do not function with sage constants.

Sage Cell

Code

import numpy as np
print(np.PINF)
print(np.NINF)
print(np.e)
print(np.euler_gamma)
print(np.pi)

Options

none

Tags

Primary Tags: NumPy: Constants

Secondary Tags:

Related Cells

Any related cells go here. Provide a link to the page containing the information about the cell.

Attribute

Permalink:

Author:

Date: 06 Apr 2019 18:41

Submitted by: Zane Corbiere

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License