Search Knowledge

© 2026 LIBREUNI PROJECT

Calculus & Analysis / Overview

Vector Fields

Vector Fields

In single-variable calculus, we map a number to a number (xyx \to y). In Vector Calculus, we map a position to a vector (rV\mathbf{r} \to \mathbf{V}). This represents physical phenomena like wind speed at every point in a city, or the force of gravity at every point in the solar system.

The Gradient: The Direction of Maximum Ascent

Given a scalar field f(x,y)f(x, y) (like the altitude of a mountain), the Gradient f\nabla f is a vector field that points in the direction of the steepest uphill slope.

f=(fx,fy)\nabla f = \left( \frac{\partial f}{\partial x}, \frac{\partial f}{\partial y} \right)

The magnitude of the gradient tells you how steep the slope is.

Divergence: Sources and Sinks

The Divergence (V\nabla \cdot \mathbf{V}) of a vector field measures how much the “fluid” is expanding or compressing at a point.

  • Positive Divergence: The point is a Source (fluid is created/flowing out).
  • Negative Divergence: The point is a Sink (fluid is destroyed/flowing in).

Curl: The Rotation of the Field

The Curl (×V\nabla \times \mathbf{V}) measures the tendency of the field to rotate around a point. If you placed a tiny paddlewheel in the field, the curl tells you how fast and in what direction it would spin.

python
1import numpy as np
2import matplotlib.pyplot as plt
3 
4# Define a grid of points
5x, y = np.meshgrid(np.linspace(-2, 2, 10), np.linspace(-2, 2, 10))
6 
7# Example Vector Field: Rotational field (V = [-y, x])
8u = -y
9v = x
10 
11print("Visualizing a rotational field (Curl > 0):")
12# In a real environment, we'd use plt.quiver(x, y, u, v)
13# For now, let's look at the vectors at a few points
14for i in [0, 5, 9]:
15 for j in [0, 5, 9]:
16 print(f"Point ({x[i,j]:.1f}, {y[i,j]:.1f}) -> Vector ({u[i,j]:.1f}, {v[i,j]:.1f})")
17 

Conservative Fields

A vector field is Conservative if it is the gradient of some scalar function (V=fV = \nabla f). In physics, this means the work done moving between two points is independent of the path taken. Gravity and electric fields are conservative; friction is not.

Exercises

If the Divergence of a wind field at a certain point is zero, what does it mean?

What does the Curl of a field represent?

Why is the Gradient important in Machine Learning?

Finish Course