Skip to content
UPEEC

NumPy

Fast, vectorised arrays and maths — the foundation of scientific Python.

Easy
Comments 0
import numpy as np

t = np.linspace(0, 1, 1000)               # 1000 time points
signal = np.sin(2 * np.pi * 50 * t)       # 50 Hz sine wave
rms = np.sqrt(np.mean(signal ** 2))       # ≈ 0.707

Operations apply to whole arrays at once (vectorisation) and run in optimised C code — often 100× faster than Python loops. np.fft.fft computes a spectrum in one line.

Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.

Discussion (0)

Sign in or join free to ask questions and discuss this topic.