AME 209: 16. Arrays with NumPy

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/20

flashcard set

Earn XP

Description and Tags

By the end of this section, students should be able to... • Create and manipulate Python lists and NumPy arrays • Understand the differences between lists and arrays • Apply indexing, slicing, and basic operations • Use NumPy for efficient, array-based numerical computation • Understand broadcasting for working with arrays of different shapes

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

21 Terms

1
New cards

Emulating Arrays with Lists

Python lists can behave like arrays, but are less efficient and harder to manage in numerical work.

2
New cards

NumPy Array

A grid-like data structure that stores elements of the same type in an efficient format.

3
New cards

1D Array

A one-dimensional list of numbers, similar to a vector.

4
New cards

2D Array

A two-dimensional array, often visualized like a matrix (rows and columns)

5
New cards

Indexing (1D)

Accessing elements in a one-dimensional array using a[i] where i is the position.

6
New cards

Indexing (2D)

Accessing elements using a[i, j], where i is the row index and j is the column index.

7
New cards

Negative Indexing

Using negative numbers to count from the end (e.g., a[-1] is the last element).

8
New cards

Slicing

Selecting a range of elements using a colon (e.g., a[1:3] gives index 1 and 2, but not 3).

9
New cards

Colon Operator :

Represents a range or full row/column, similar to MATLAB.

10
New cards

Slicing (2D Arrays)

a[:,1] selects a column; a[0,:] selects a row.

11
New cards

Broadcasting

A NumPy feature that allows operations on arrays of different shapes by expanding dimensions where possible.

12
New cards

Vectorized Operation

Performing arithmetic across all array elements without using explicit loops.

13
New cards

Elementwise Operation

Each element of an array is operated on individually (e.g., a + b adds corresponding elements).

14
New cards

No Dot Operator

Unlike MATLAB, NumPy does not need .* or ./ for elementwise math.

15
New cards

Array Creation

Arrays can be created with functions like np.array(), np.zeros(), or np.arange().

16
New cards

Array Shape

Describes the dimensions and size of a NumPy array, indicating how many elements are in each dimension.

17
New cards

Array Consistency with MATLAB

NumPy indexing and slicing is conceptually similar to MATLAB, but uses square brackets.

18
New cards

Advantages of Arrays Over Lists

Arrays are more memory-efficient and faster for large numerical computations.

19
New cards

Dimensionality

Arrays can be extended beyond 2D to represent higher-dimensional data (e.g., time, layers).

20
New cards

Use of Arrays (in Engineering)

Arrays are ideal for simulations, signal processing, matrix algebra, and other engineering tasks.

21
New cards

Emulating Arrays with Lists

Python lists can behave like arrays, but are less efficient and harder to manage in numerical work.