Numpy Constants


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


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




Primary Tags:

Secondary Tags:

A list of possible tags can be found at The WeBWorK Open Problem Library. For linear algebra tags see the Curated Courses Project.

Related Cells

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




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