The mathematical constant pi (\(π\)) equals (roughly) 3.1415926559
.
pi()
Code language: JavaScript (javascript)
\(π\) is the ratio between the circumference and diameter of a circle. This ratio is shared by all circles, no matter the size.
\(π\) can be used to calculate the circumference and area of a circle, volume and surface area of a sphere, and more.
You can learn more about \(π\) here:
Example Formula
pi() * 10 /* 31.41592653589793 */
Code language: JavaScript (javascript)
The above formula will calculate the circumference of a circle with a diameter of 10cm. It uses the simple equation \(πd\), where \(d\) is the diameter of the circle.
In this case, the circumference would be approximately \(31.4159265cm\).
Example Database
In this example database, the Formula (num) property calculates the area of a circle with a given radius, set in the Circle Radius (cm) property.
View and Duplicate Database
“Formula (Num)” Property Formula
pi() * prop("Circle Radius (cm)") ^ 2
Code language: JavaScript (javascript)
The formula to calculate the area inside a circle is \(πr^2\). We can create this equation in a Notion formula using the code above:
pi
is the Notion constant for \(π\)prop("Circle Radius (cm)")
uses theprop()
function to pull in the value of theCircle Radius (cm)
Number property^ 2
squares the radius of the circle
Other formula components used in this example:
“Pretty Formula” Property Formula
format(round(prop("Formula (num)") * 100) / 100) + "cm²"
Code language: JavaScript (javascript)
This formula:
- Intakes the output of the previous formula
- Rounds it to the nearest hundredth (i.e. two decimal places)
- Converts the resulting number to a String
- Appends “cm²”
Note that Notion formulas do not support text formatting, so I’m using the actual ²
symbol. You can find this symbol here:
To round the decimal to two decimal places, I use the following trick:
round(prop("Formula (num)")*100)/100
Code language: JavaScript (javascript)
Notion’s built-in round()
function only rounds numbers to the nearest whole integer. But this trick will output a rounded number to two decimals places instead. Learn more about this trick in the round function reference.
Other formula components used in this example: