A list is an ordered collection of objects. The objects do not have to be the same type. (A 1D array is also a list, but all the objects must have the same type.)

A list is often called a sequence. It is 1-dimensional. Its elements are separated by commas.

The elements of a list are indexed by the integers, starting with 0.

When doing numerical math, lists should only be used for classroom. NumPy (numeric python) arrays should be used in real life.

A Sage list of numbers is automatically converted to float64 (decimals); not so with NumPy arrays

Within an operation, Sage will use a list either as row matrix or a column matrix depending on what works. This is REALLY handy.

Important: Sage lists and NumPy 1D array have similarities AND differences

The MAIN difference is that a Sage list is more easily manipulated and a NumPy 1D array is faster for calculations.

Home > Objects ->

Lists## EXAMPLES ON MY SAGE PAGE: Sage Lists and NumPy 1d Arrays

In

Sagestarting with 0.When doing numerical math, lists should only be used for

classroom. NumPy (numeric python) arrays should be used in real life.use a list either as row matrix or a column matrixdepending on what works. This is REALLY handy.Important: Sage lists and NumPy 1D array have similarities AND differences

The MAIN difference is that a Sage list is more easily manipulated and a NumPy 1D array is faster for calculations.

References: http://www-rohan.sdsu.edu/~mosulliv/sagetutorial/sageprog.html

Keywords:sage, lists, sequences, elements, numpy, array