## Calculations

Blockpad calculations use spreadsheet style formulas, but with more functionality like math with units, named values, matrices, and more.

#### Start a new document

First things first. Create a new Blockpad file and select New Document.

#### Dynamic equations

Dynamic equations act like spreadsheet formulas, but in a document. The input is highlighted blue, and the calculated section is purple.

###### Insert a dynamic equation:
1. Type an equals sign.
2. Type in a formula.
3. Press the enter key.

• To edit an equation, double click. You can also select it and press the spacebar.
• To exit an equation, press ESC.
##### Entering and viewing equations

Equations are entered exactly like a formula in a spreadsheet, but they appear in mathematical notation.

#### Unit tracking

Numbers in a formula/dynamic equation can have units assigned to them.

To assign a unit, type the unit text after the number.

The unit text must match what is stored in the Blockpad library, but Blockpad will often auto correct to what's intended. The dropdown selection will also help.

The formula will convert, multiply, and cancel the units as necessary. ##### Convert units

To convert a value to a different unit, type "to" and the desired units.

This sometimes needs to be done at the end of a calculation, because the units will not always auto-cancel.

##### Incompatible units

If units are incompatible, the equation will calculate, but it will show a question mark instead of the unit and an error on the equation.

##### Foot-inch units

Blockpad supports ft-in units. So, 4 ft 3 in is a legitimate number value, which can be used in calculations. To convert to ft-in units, type "to ft in" after a value.

There are other similar units:

• deg min sec (angle)
• day hr min
• day hr min sec
• hr min sec
• hr min
• min sec
##### Make numbers unitless

Sometimes calculations require you to strip units from a number, often in formulas that come from empirical studies.

To strip out units, divide the value by the number 1 with the units the value is assumed to be. If the value has compatible units it will do any conversions automatically. To assign units to a unitless value, multiply the value by 1 with the unit you want to add. You can convert again using "to unit" described above. You can do this inside of equations as necessary. #### Value names

In Blockpad, formula/dynamic equation results are stored in the file as values. These values can be given names so you can reference them in other formulas.

###### Name a value:
1. In a dynamic equation, type the name at the beginning.
2. Type an equals sign.
3. Type the calculation for the formula.

Values are created with calculations or just typing the value into the formula. ##### Reference unnamed values

You can reference values with no name. Blockpad will create the name for you. If you try to reference a value using copy reference or click functionality (see Referencing a value below), then Blockpad will auto-assign a name to that value.

##### Text values

Values can also be text. To create a text value, use quotation marks (") or apostrophes (') to begin and end the text. ##### Other value types

Values can also be dates, arrays, complex numbers, and more. See the sections below for more information.

##### Referencing a value

There are three ways to specify a value reference in a formula.

The primary option is to click on the value like clicking on a spreadsheet cell.

The second option is to use the copy reference tool.

You can also just type the name in. The dropdown will help you out.

A location in front of the name with dot notation may be needed if the value is in a different frame. When in doubt, clicking and copy reference can always be used. See frames for more information about location and value containers.

##### Value name rules
• Names consist of text, numbers and some kinds of symbols.
• Names cannot begin with numbers.
• Underscore (_) and dollar sign (\$) are allowed symbols.
• Spaces are allowed.
• Names are case sensitive but will auto-correct to the correct case if there are no conflicts.
• Avoid using names similar to spreadsheet cell references (e.g. A5, D150, or BR559).
##### Names used multiple times

If the same name is used more than once in a frame, Blockpad will show an error where that name is referenced. This is because Blockpad works like a spreadsheet in terms of dependencies, so you can use a value from anywhere in the document (above or below). To redefine a value (like in programs such as Mathcad), you can use step-by-step sections.

##### Renaming and auto-updated references

If a value is renamed, references to that value will update to the new name. The reference won't be broken.

##### Built in values

There are a few built-in number values. To use them, type the name into an equation like a normal value.

• pi or π (3.1415...)
• e (2.718...)
• i (the square root of negative one)

#### Show steps and more

You can show different parts of a dynamic equation to control what information is visible.

You can show and hide:

• the value name
• the calculation
• the result
• the steps (shows values plugged in)

You can also choose to view the equation as multiple lines and turn the math layout off.

###### Show or hide formula properties:
1. Select a dynamic equation.
2. Open the properties window.
3. Under Formula> near the bottom, toggle the property you wish to change.

Show steps and separate lines. Hide the calculation. Hide name and result, show steps. Hide name and formula. #### Value formatting

Just like in conventional spreadsheets, Blockpad gives you options for how to display values, like number of decimals, scientific notation, etc. Blockpad offers more options too, like number of significant figures to display or fractions with a specified denominator. There are a few value format options directly in the toolbar, like fraction or scientific notation, but there are more options in the value format window. ###### Specify value format:
1. Select the values you wish to format.
2. In the toolbar, select the Value Format icon.
3. Select an option for the number display.
• There are more settings at the bottom of the window.
4. Click OK. Note that the value format doesn't affect the actual number stored in Blockpad, which is always in decimal format like in conventional spreadsheets.

For example, all of the values below are stored the same in Blockpad, even though the formula result on the far right is shown in sixteenths. 