+10 XP
Why NumPy?
NumPy (Numerical Python) is the foundation of all scientific Python. It makes working with large arrays of numbers incredibly fast.
Python lists are flexible but slow. NumPy arrays are:
• 100–1000x faster for math operations
• Can do math on the whole array at once
• Used by scipy, matplotlib, pandas — everything NMA uses
python
import numpy as np # always import numpy as np
# Create an array of 1000 time steps (0 to 999 ms)
t = np.arange(0, 1000) # [0, 1, 2, ..., 999]
# Create an array of 100 neurons, all at rest (-70 mV)
V = np.full(100, -70.0) # [-70. -70. -70. ... -70.]
print(t.shape) # (1000,) — 1000 elements
print(V.shape) # (100,) — 100 elementsimport numpy as np is the first line of almost every NMA notebook.
NMA fact: Every tutorial starts with 'import numpy as np'. You'll type this thousands of times.