Importing Packages Numpy

Description

To save memory, when we import NumPy, only the basic libraries are imported. If we want a specialized subset of functions, we have to specifically import them. We do this with the from and import commands

Sage Cell

The * is part of a regular expression, and essentially tells the program to import everything in the specified package.

Code

import numpy as np
from numpy.matlib import *
a = ones((2, 2))
print a

Options

Useful Libraries

  • numpy.linalg: A set of linear algebra commands
  • numpy.matlib: A set of matrix and vector operations
  • numpy.polynomial: Commands for creating polynomial objects.

Tags

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.

Attribute

Permalink:

Author:

Date: 07 Apr 2019 21:51

Submitted by: Zane Corbiere

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