Importing Specialized 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—NumPy: Routines

Secondary Tags—Routines: Linear algebra (numpy.linalg), Matrix library (numpy.matlib), Polynomials

## Related Cells

- Numpy Constants Constants defined in the NumPy package.
- The N-Dimensional Array Using NumPy to create an array of n dimensions.
- Indexing in ndarray objects Using indices for multidimensional arrays.
- Accessing Attributes of N-Dimensional Arrays How to access information about an
`ndarray`object. - Evaluating Booleans in an N-Dimensional Array Using the
`all`and`any`methods to evaluate an`ndarray`of`bool`data. - Sum and Prod commands on ndarrays Using the
`ndarray``sum`and`prod`commands. - Finding the minimum and maximum of an ndarray object How to find the minimum and maximum values of an ndarray object.
- Finding the standard deviation and variance of an ndarray Using the
`std`and`var`commands to find the standard deviation and variance of an`ndarray`. - Finding the percentile of a value in an ndarray Using the
`percentile`and`nanpercentile`commands to find the percentile of an item in an`ndarray`. - Median of an ndarray Finding the median of an
`ndarray`object. - Average of an ndarray Finding the average of an
`ndarray`object. - Evaluating Booleans in an N-Dimensional Array Using the
`all`and`any`methods to evaluate an`ndarray`of`bool`data. - Testing ndarray objects for equivalence Using the
`array-equiv`command to test`ndarray`objects for equivalence. - Testing for Infinite Values Using
`numpy.isinf`to test a value for infinity. - Testing for Finite Values Using
`numpy.isfinite`to test a value for finiteness. - Testing for NaN values Using
`numpy.isnan`to test for a Not a Number value, such as $\frac{1}{0}$.

## Attribute

Permalink:

Author:

Date: 07 Apr 2019 21:51

Submitted by: Zane Corbiere