Mathematical Fields for Designers
In science, a mathematical field is a quantity represented by a scalar or vector that has a value at each point in space and time. This quantity usually represents intensity, magnitude, or direction. In design computing, we use fields to translate data into tangible design tools. Temperature maps are examples of scalar fields. In a scalar field, every point in space and time has a distinct scalar value (a number). It can be the degree, height, pressure, or humidity at any point on the map. We are going to work in a two-dimensional space like this. Here is how we can define a point on it.
SCALAR FIELDS

Let’s use points, generated by a function, to define a scalar field. This requires a function that outputs a scalar. The scalar field function f takes n-dimensional inputs and returns a 1-dimensional value. Above are some of the output values for different pairs of (x, y) inputs.

If we calculate more outputs of this function at their (x, y) input points, we will get denser representations of the same scalar field.

We can define the same scalar field in Grasshopper. The “Evaluate” component receives an expression and input values and returns the output. We used the “Series” component to generate a list of values quickly without the need to type them in a “Panel” component. Remember the data list matching procedure. The 2D input points and the result of the expression are used in a “Circle” component to represent the field.

We can change the scalar field function and observe various results. The outcome depends on the expression of the function and the range of inputs used.

More variations can be generated only by changing the expression. Of course, this is not how designers create patterns and deformations. However, we should be aware of the mathematical underpinnings of such structures to be able to have full control over them.

Instead of functions, designers define scalar fields by utilizing Euclidean distance values. In this code, the field function is not explicit because the “Distance” component already calculates it.

Topography maps can also be seen as scalar fields. If you plug in any coordinate (x, y), there is an elevation value (h) for that coordinate. Let’s collect elevation values from a terrain surface in Grasshopper. Since we can get a scalar field, the terrain surface is, in fact, a function (a parametric one).

The Gaussian curvature, or the slope of the surfaces, is also a scalar field. We can colorize them and call them “heat maps”. Heat maps are useful tools for designers and architects.

VECTOR FIELDS
Wind maps are examples of vector fields. In a vector field, every point in space and time has a distinct vector value. These vector fields represent motion and flow in space. Magnets generate force fields around them, which can be visualized as vector fields where the direction and strength of the magnetic force are defined at every point. A vector is a combined quantity of a direction and magnitude. In our case, vectors are independent of the starting point. Wherever you put it, it will still be the same. Because it represents the relative direction and magnitude.

More formally, a vector field is a function whose input and output dimensions are the same. In this case, our inputs and outputs are both two-dimensional. However, the output is not treated as a point, but as a vector. It represents movement in a particular direction, with a particular magnitude. Check the solution table and the notations used.

As with scalar fields, vector fields are represented by placing the vector at the input point. Here are the representations of the same vector field with different sampling densities.

Now, let’s define this vector field in Grasshopper. We will need two functions, unlike the single function in the scalar field. Therefore, we used two “Evaluate” components. We create the vector and normalize it (to a Unit Vector) for better visibility. The “Vector Display” component visualizes the outcome.

Here is another basic vector field, represented by the same Grasshopper code.

Every point on a continuous surface has a normal vector. The totality of these vectors is also a vector field. Since we can produce a 2D vector field from a 2D surface, this means the surface is, in fact, a function (again).

GRADIENT AND CURL
Nabla (∇) is the differential operator for fields. It calculates partial derivatives (rates of change) for each component of a field. If we use this operator with a scalar field, it returns the direction and magnitude of the field’s steepest direction.

This operation is called the gradient of a scalar field.In this example, the nabla operator gives a constant. This means the field is always increasing the scalar result in a constant direction (i + 2j)

A gradient is a vector field that represents the direction and magnitude of the maximal rate of change within a scalar field. For example, the flow diagram in the topography models converts the scalar field (surface heights) into a vector field, indicating the fastest descending routes.

The dot product compares the directions of two vectors. It is positive if the two vectors are pointing in the same direction.

If we calculate the dot product of the nabla operator (the partial derivatives) with a vector field, we get a scalar (number). Therefore, if the dot product of the nabla operator and a vector field is positive at any point, the field at that point acts as a source. This means more of the field is getting out of that region than coming into it.

Conversely, if the result is negative, the point acts as a sink. This means more fields are coming into that region than getting out of it. This operation is called divergence. It measures the net flow of a vector field out of or into a given point, whether it is a source or a sink.

In a fluid simulation (assuming the fluid is incompressible), the divergence of the system must be zero. On the other hand, electric-field simulations use positive and negative divergences to represent charges. In a gravity simulation (in physics), the divergence represents the mass distribution in space that generates the gravitational pull.
The cross product of two vectors gives the area they span. It is maximized when the vectors are perpendicular. If we calculate the cross product of a nabla operator (partial derivatives, rates of change) with a vector field, we get another vector field. This result gives us an idea about how much the vector field at that point “rotates”.

This is called Curl. It is a vector quantity that measures the local rotation or circulation of a vector field. Positive curl means a counter-clockwise rotation, and negative curl means a clockwise rotation at a point.

Here is the basic vector field with zero curl. This means this field does not have rotation.

Magnetic fields are inherently rotational. In their simulations, the curl represents the electric current generated by the magnetic field. On the other hand, in a standard gravity simulation, the curl of the gravitational field is always zero.
GRASSHOPPER 1.0 COMPONENTS
Grasshopper has a built-in group of components for Force Fields. These components help generate scalar and vector fields by using charge objects. We can use different “charge” components to define the field.

Let’s generate a field using a single point charge in Grasshopper. The “Evaluate Field” component gives both scalar and vector outputs of the same field. In Grasshopper, the force field components generate vector fields. However, we can always convert them into scalar fields by measuring the magnitude of the field (as a scalar)

We can use multiple charges. To use them in a single field, we must “Merge” them into a single field. This is done by the “Merge Fields” component. You can observe the effect of different charge types using this definition. Also, you can try different options (e.g., negative charge values). Negative charge value in a “Point Charge” component would make the divergence of the field also negative (sink behavior).

Here are the two visualization tools for the fields in Grasshopper. Both components have a “Samples” input that gets the total number of samples used. If you increase this input, the visualizations will be more detailed.

A field line is a continuous curve that is tangent to the gradient of a vector field at every point along its path, visually representing the flow or direction of force. Let’s experiment with the field lines in Grasshopper’s field components.

SUMMARY
- In science, a mathematical field is a quantity represented by a scalar or vector that has a value at each point in space and time.
- A scalar field represents individual values, such as intensity or magnitude, whereas a vector field combines both direction and magnitude.
- In architectural computing, we use these mathematical fields to translate data into tangible design tools, such as distance attractions.
- Parametric surfaces generate scalar fields from the Gaussian curvature and vector fields from their surface’s normal vectors.
- A gradient is a vector field that represents the direction and magnitude of the steepest rate of change within a scalar field.
- Divergence is a scalar quantity that measures the net flow of a vector field out of or into a specific point, identifying whether that point acts as a source or a sink.
- Curl is a vector quantity that measures the local rotation or circulation of a vector field.
- Grasshopper’s built-in “Force Field” components help generate these fields using charge objects, such as points or lines.
- A field line is a continuous curve that is tangent to the vector field at every point, visually representing the flow of force.





