This article is part of the Designing with Numbers series, a continuation of the Geometry Basics series. Together, they explore how computational design is shaped first by geometry, then by numbers.
Part 1 : It's not always about geometry, numbers matter too. (this article)
Grasshopper / Dynamo might look like only geometry tools, but numbers is really what controls everything. Well that and how it structures the data but we'll get into that later.
Every surface or curve that you create is all based on numbers. I mean, we instinctively know this, high school math class teaches us that any line or squiggle that we draw can be represented by equations.
Some people even take it a step further and make art.

So, knowing some math will help you with computational design but you definitely don't need to be a master at it. Our tools have come far enough that it handles a lot of it for you. To draw a line, we don't need to know the equation of a line, we just need two points. The computer handles the rest.
Still, if you want more control over your scripts, you're going to need to at least understand some of what's going on.
The math behind geometry can be really complicated but you don't have to understand all of it at once. A lot of understanding comes from experience and keeping that curious mind about things. But one thing is for sure, you can't escape it if you're looking to level up your computational design game.
This article is a quick, practical introduction to numbers in computational design, mainly in Grasshopper. There will be some math (I promise, nothing complicated) and some understanding of what computers need to create geometry. In fact, if you've done some coding before, this will feel familiar.
Alright, let's get started.
Number types
This sounds like a weird question, but did you know Grasshopper has different types of numbers? It took me awhile to understand this. I mean, isn't a number just a number ?
How can there be different types ? Why are there different types?
It comes down to how computers store data. Back when memory was expensive, programmers had to be careful. Whole numbers (like 1
) take up less space than long decimals (0.4981705987...
), so different types of numbers were invented to save memory and help programmers be more intentional about how much memory they were using.
Honestly, if you have a spare hour, I recommend watching the first hour of CS50 - Lecture 0, which is probably the best explanation of computer memory I have every come across.
In traditional programming languages, there are actually more than 2 types, which the CS50 lecture will explain. But Grasshopper keeps it simple, it has two. Well... three. But I'll get into that later.
The two main number types are number and integer
Numbers are what we typically know as "numbers". Integers on the other hand are whole numbers only. Meaning no decimal places. If you do pass in a boolean (true or false) or a number into it, Grasshopper will round it off and turn it into an integer
It's a small difference but quite important. Especially for accuracy reasons, like if you’ve been working with 11.5mm
through out the script and suddenly, you put a integer later, it will get rounded off to 12
, which may not be a big deal depending on what you're modeling. But you've just introduced an unintentional operation in your script.
The third "number" type
Now, let me tell you about the "third" type, null. It represents empty or that something has gone wrong.

Okay... but why don't we just use 0
s instead of nulls to represent empty.
Well it's because 0
can actually be meaningful, especially with booleans, where 0
actually means false. Null is a way to say, “Don’t process this, something’s missing or wrong.”
You might think nulls are bad, but they’re often useful. They let you skip calculations when data isn’t available, rather than forcing the wrong result through.
Okay, now, let's see how these numbers actually get used.
The two popular ways are for creating and modifying Domains and using numbers for arithmetic.
Domains
A domain in Grasshopper is a range between a minimum and maximum number.
It's a concise way of packaging a range of numbers into a single type. If you're not used to programming, it's basically a way of treating a range of numbers as a single object.
You can even use them to create shapes in Grasshopper. The rectangle and box components all take in domains.
Pro Tip: Quickly create a domain with a panel
You can quickly create a domain in Grasshopper by typing "X To Y" in a panel with X being the minimum and Y being the maximum.
Okay, let's dive a little deeper in some of the useful ways to use domains
1. Testing for inclusion
Testing if a number is within a certain domain is something I use a lot.
It's because I work with buildings most of the time and I always need to organise geometry and data per floor.
So, using domains, I can re-structure any data into a data-tree per floor by testing for inclusion. You can also just use it to exclude and include data that falls in that domain.
2. The Range Component
You can also use domains to generate a list of numbers by using the range component. This is useful for anything repetitive. I mostly use it to generate things like holes or grid lines. I even on occasion use it to generate indices but that's a more advanced topic.
3. The Consecutive Domains Component
For any given list, you can also create multiple domains. The Consecutive Domains component takes a list and pairs up each number with the next one. This is great for creating floor ranges in buildings with overlapping or irregular heights.
By default, Grasshopper will take the last number of each domain and add it to the first number of the next domain.
You can also have Grasshopper not add the last number. This is done by passing a False into the additive input of the component.
The list also doesn't have to be in order either. The component will still create a list of domains for you.
This is where the concept of domain as a single object comes in, because now you can work with a list of them instead of just a single one at a time.
Arithmetic
Okay, the other popular way to use numbers is ..... to do math.
Grasshopper already gives you the basic components to do so. Things like plus, minus, divide, etc.
Pro tip: You can quickly summon these components by typing in their respective symbol. Like “+” for addition and “*” for multiply.
You also have your trigonometric components, like Sin, Cos, and Tan.
If you need something more complicated or you prefer to type out the equations, you can also use the expression component.
This is something I do more because it's faster, takes up less space and is cleaner than having a string or components in the script.
Mass Arithmetic
And if you have more than two numbers to add or divide, you can always zoom into each component and add more inputs.
But of course, you could also just use the mass versions of each component. Especially if you have say a 100+ numbers to add, you don't want to be adding inputs a 100 times.
What's also useful, is that they also give you the progressive results. Similar to the consecutive domain component, you can get a list of numbers as it processes the results.
It may sound weird now, but if you ever need to add or multiply numbers in pairs in a list, these components can help you out without doing much data re-arranging.
Final Thoughts
Alright, that mostly covers what you can do with numbers in Grasshopper. I know that might have a been dry but these numbers are the foundation for everything. Especially for the later articles in this series. You'll see how domains become important later on when we start looking at how to extract more information from geometry through something called parameters. So, stay tuned.
Thank you for reading. Consider subscribing if you haven’t, it really helps me know my writing here is useful.