Calculations
Date and time arithmetic
Date values and calculations are supported in Blockpad formulas.
Enter a date
To enter a date in a formula, yyyy.mm.dd is the basic syntax. However, the month or day can be typed in as one digit.
For example, the date January 3rd, 1892 is typed in as 1892.01.03 . You can also enter a date using the Date() function. Our example above would be Date(1892,1,3).
Enter a date and time of day
You can type in a date and time, where yyyy.mm.dd.hh.mm.ss is the syntax. With this, military time must be used for p.m. times.
Seconds, minutes, or hours can be left off the end, but year, month, and date must all be specified. Otherwise, Blockpad will see a regular number with a decimal.
Date and time calculations
You can perform basic calculations with date values and numbers with time units. So, a date value subtracted from a date value gives a time number.
Also, a time number added to or subtracted from a date value gives a date value.
Logic and Boolean values
Logic tests and functions in Blockpad are similar to logic operations in conventional spreadsheets.
The main difference between normal spreadsheets is that two equals signs are used to test equality. Other than that, it's the same.
 == equal to
 != not equal to
 <> not equal to (equivalent to !=)
 < less than
 > greater than
 <= less than/equal to
 >= greater than/equal to
You can use If() to perform if/then logic calculations. If() in Blockpad works just like If() in conventional spreadsheets, but it displays as a logic table.
You can also type Boolean values (true or false) directly into a formula.
If multiple tests are used in a row, then all of them must be true separately to yield true.
This is the same as using the And() function on each test separately.
Matrices and arrays
Blockpad dynamic equations support arrays and matrices. Many of the builtin functions are matrix compatible as well.
Enter an array or matrix
To create an array in a formula, brackets are used. Brackets ([ ]) specify the start and end of the array. Commas (,) separate members of one row into columns, and semicolons (;) specify the end of a row. For example, [11, 22, 33; 22, 33, 11; 33, 11, 22] typed into a formula produces the matrix below.
In Blockpad, arrays and references to groups of cells are treated the same. So, arrays can be created by referencing a group of cells from a spreadsheet or table. In this case, the array will update with the table.
Array names
Array values can have names, just like normal number and text values.
Matrix calculations
To add, subtract, divide, and multiply matrices, the normal operators are used (+, , /, *).
To find the inverse of a matrix, you can raise it to negative one (^1) or use the inverse function.
If a matrix calculation can't be completed, then you will get an error.
Matrices also support units and unit tracking
Functions work with arrays too. Some treat the array like a group of spreadsheet cells.
And some treat the array as a matrix.
Arrays  more than just numbers
Arrays can have any type of values: text, numbers, even more arrays  anything that can go in a spreadsheet cell and a little more.
A useful application is to use lookup functions with arrays, just like using them with a spreadsheet.
Array formulas in spreadsheets
Arrays can be displayed in a spreadsheet too.
Make an array formula:
 Type in a formula that results in an array.
 Press ctrl+shift+enter instead of enter to complete the formula.
Now when you try to edit any cell in the array, you are prompted to edit the array formula. However, you can still reference the cells like normal.
If there are nonempty cells that an array formula tries to fill, then the formula still runs, but a red line appears to let you know it didn't fill all of the cells.
Array parentheses lookup
You can reference the values inside of an array using parentheses after the array name. The basic synax is ArrayName(RowNumber, ColumnNumber).
If you give just one number in the parentheses, then it specifies a row. You can specify a column by typing an asterisk for the row. This works to specify just a row too, just put an asterisk for the column.
Advanced array functions
There are a number of useful functions to work with arrays, most of them in the scripts library (Library.Scripts), which isn't automatically included in Blockpad files. To access them, you need to use the long form library name, create a shortcut name, or include the library in the file.
In these examples, the scripts library is included in the file, so below are instructions for how to do so.
Include the scripts library:
 In the toolbar, select Libary>Include Libraries.
 Click Add in the window that appears.
 Select Scripts.
 Click Ok.
 Click Close to exit the include libraries window.
Below we cover the following functions:
LinearSeries()  Creates a one dimensional array given start, end, and interval. 

Identity()  Returns an indentity matrix given the size. 
Each()  Performs a function on each item in an array. 
EachRow()  Performs a function on each row in an array. 
EachColumn()  Performs a function on each column in an array. 
Where()  Returns a one dimensional array of items that meet provided criteria. 
First()  Returns the first item from an array that meets the provided criteria. 
Last()  Returns the first item from an array that meets the provided criteria. 
ConcatRows()  Combines arrays by vertical stacking. 
ConcatColumns()  Combines arrays by horizontal stacking. 
ConcatItems()  Combines arrays into a onedimensional array. 
Use LinearSeries() and Identity()
LinearSeries() is relatively straightforward. Specify the start of the array, the end of the array, and the interval of the steps between.
Identity() is even easier. Just specify the size (n) of the matrix, and the function will create an n x n identity matrix.
Using the Each() function.
The Each() function performs a specified function on each item in an array, and then returns that as a new array.
It looks like this: Each(Array, Inline function to perform)
.
In the example above, each item in array A_4 is squared.
Notice the inline function.
For Each() (and many other array formulas), the inline function follows this form
nameForItem => formula using nameForItem
.
Note that you name the nameForItem, so the example below works the same as the example above.
Below is another example. Notice that outside values can be used in the function, in this case Pressure.
EachRow() and EachColumn() are similar to the Each() function, but they work on rows and columns instead of individual items. The set up is the same, including the use of inline functions, but the inline function is working on a onedimensional array (the row or column).
Note that because EachRow() and EachColumn() act on the rows/columns as arrays, the output can be an array of arrays, as in the example below.
Using Where(), First(), and Last().
Where(), First(), and Last() are used to find specific values in an array, and they all follow the same pattern. First let's look at Where(), the most general.
Where() finds all of the items in an array that meet a criteria, and returns them in a one dimensional array.
It looks like this: Where(Array, Criteria function)
.
The criteria function typically consists of just a boolean operator (==, >, <, <=, or >=) and a value.
This is actually short hand for an inline function (like talked about above).
You can also specify criteria using the form nameForItem => formula using nameForItem
.
Where the formula has a boolean result.
The examples below do the same thing as those above.
Most of the time you don't need this, but it allows more functionality. In the example below, the Where() function is used to filter out nonlength units.
The First() and Last() functions are like the Where() function, but return a single value instead of an array. It's like if you performed the Where() function and then kept only the first (or last) value from the array.
You can also use First() and Last() without the criteria. They just return the first or last value from the array.
Using ConcatRows(), ConcatColumns(), and ConcatItems()
ConcatRows() and ConcatColumns() are used to combine arrays by stacking the rows or columns.
ConcatItems() combines arrays by putting all items into a single onedimensional array.
Complex numbers
Blockpad supports complex numbers in a very simple way. Simply use the letter i to denote the imaginary number inside of a formula/dynamic equation. The square root of a negative number will also produce i.
Table of Contents

 Start a new document
 Dynamic equations
 Unit tracking
 Value names
 Reference unnamed values
 Text values
 Other value types
 Referencing a value
 Value name rules
 Names used multiple times
 Renaming and autoupdated references
 Built in values
 Visual editor
 Math layout options
 Show steps and more
 Value formatting
 Spreadsheet in a file
 Sort and filter
 Conditional formatting
 Blockpad specific features
 Open a CSV file
 Minispreadsheets in a document
 Reports in a file
 Reference values from other reports in a file
 Header and footer
 Misc. document formatting
 Start a drawing
 Drawing objects
 Lines, points, and shapes
 Text labels
 Linear dimension labels
 Textboxes
 Images
 Selecting multiple objects
 Ordering objects
 Using the point snapping
 Points you can snap to
 Horizontal and vertical from points
 Parallel or perpendicular lines
 Point snap options
 Transformations  resizing and moving
 Format drawings
 Keyboard input and canvas scales
 Top level frames
 Frames in Frames
 Value containers and location
 Frames and sections are containers
 Containers inside containers
 Dot notation to specify a value in a container
 Capture values
 What is a block?
 Block example
 Use the block results
 Block inputs
 View block as table
 Block instances and block definitions
 More examples
 Create a block
 When to make a block
 Make a block with Blockpad calculations
 Update a block definition
 Create a block using scripts
 Block tables
 Examples library
 Use library items in a document
 Use the long form library item name
 Assign a shortcut name to the library
 Include a library in a file
 Use a library number value
 Use a library function
 Use items in a library frame
 Use a library data table as function
 Use library blocks
 Core, builtin, and subscription libraries
 Create personal libraries
 Save items to your library
 Manage your library online
 Library subscriptions
 Console basics
 Read values from the console
 Overwrite values from the console
 Use read and write to manipulate values
 Assign units to numbers in a cell range
 Stemscript basics for scripts
 Macros
 Macros
 Module functions