Element-Wise Operations and Universal Functions

Introduction

In NumPy, arithmetic and mathematical operations are applied element by element across an entire array at once. Writing a + b, a * 2, or np.sin(a) tells NumPy to loop internally in compiled code rather than in Python, which is why vectorized code is both shorter to write and dramatically faster than an equivalent for-loop. The functions that perform these element-wise operations — np.add, np.sqrt, np.exp, np.sin, and many others — are called universal functions, or ufuncs.

This matters for engineering work because measurement data, time steps, node positions, and sensor channels naturally live in arrays. Converting a column of readings from volts to pressure, computing the magnitude of force components, or evaluating a model at a thousand time points all become single expressions. Related ideas follow from the same mechanism: comparison operators (>, <=, ==) applied to an array return a Boolean array of the same shape, which can then be used as a mask, and aggregate reductions such as sum(), mean(), min(), max(), and std() collapse an array down to a summary value, optionally along a chosen axis.

As you watch, pay attention to three things: the shapes of the arrays going into each operation and coming out, when broadcasting lets arrays of different shapes combine (and when it raises an error), and the difference between an operation that returns a full array and a reduction that returns a single number. Try typing the examples yourself and checking .shape and .dtype after each step.

Video 1: Numpy Fundamentals | Array Operations

Dan Kornas · 6:25 · 92 views · 1y ago · captions — Watch on YouTube

About this video

A short overview of core NumPy array operations, aimed at showing how computations are performed efficiently on arrays rather than through Python loops. Expect demonstrations of basic element-wise arithmetic and common built-in array methods and functions.

Why this video

Its brevity and focus on operations make it a good orientation to the whole topic, setting up vectorized arithmetic and the general idea of applying functions across an array at once.

Video 2: Arithmetic Operations with NumPy Arrays | NumPy Python Tutorials - In English

WsCube Tech! ENGLISH · 5:15 · 1,616 views · 3y ago · captions — Watch on YouTube

About this video

A focused tutorial on arithmetic with NumPy arrays, covering addition, subtraction, multiplication, and division applied element-wise between arrays and between an array and a scalar. It is part of WsCube Tech's structured NumPy tutorial series, so the examples are presented step by step in a coding environment.

Why this video

It gives direct, hands-on coverage of the vectorized arithmetic subtopic, and being from an established tutorial series it keeps the syntax and terminology consistent and easy to follow.

Video 3: 🚀 How to BROADCAST Numpy Arrays?🚀(DON'T MISS the Rules to Broadcast Arrays)

Non Techie · 3:23 · 54 views · 3y ago · captions — Watch on YouTube

About this video

A quick explainer on broadcasting: how NumPy stretches arrays of different but compatible shapes so that element-wise operations can still be performed. The description indicates it also walks through the rules that determine when broadcasting is allowed.

Why this video

Broadcasting is the rule set that makes element-wise operations work beyond identically shaped arrays, so this video fills in the shape-compatibility reasoning that the arithmetic videos assume.

How These Videos Support the Learning Outcomes

Together these videos target MO2 most directly: the first two build fluency with vectorized element-wise arithmetic on arrays, and the third supplies the broadcasting rules needed to combine arrays of compatible but different shapes without writing loops. Because element-wise comparisons produce Boolean arrays, the operations shown here also underpin the Boolean masking skills in MO3, and the ufunc and reduction patterns introduced here are the same ones used to evaluate trigonometric functions and compute descriptive statistics in MO5. The arrays used in the demonstrations assume the creation functions from MO1, so watching these clips reinforces that earlier material in an applied setting.

About These Videos

These videos were chosen from YouTube on October 2, 2026. Each has captions; the player turns them on. Videos on YouTube can be changed or removed — if one no longer plays, tell your instructor. If a player does not appear, use its Watch on YouTube link.