## 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.

If you'd like to view the equation in math notation as you type it in, use the visual editor.

#### Unit tracking

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

Below is a brief intro to Blockpad units intelligence. See the units page for more comprehensive information.

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.

For compound units like ft-lb, m^3/min, or ft/s, use math operators like *, /, or ^.

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.

As a side note, you can also save values to a library and use them in multiple files.

##### 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)

#### Visual editor

With the visual editor, you can view a formula in math notation as you type it in. This can be very helpful for long, complex equations.

###### Edit an equation in the visual editor:
1. Select an equation.
2. Click Formula>Visual Editor in the toolbar.
3. Edit the equation as desired and view the changes.
4. Click OK.

You can also click Formula>Visual Editor while editing a formula to enter the visual editor.

#### Math layout options

Blockpad has different settings you can use to change how formulas are displayed in math notation.

These setting can be used to

• Hide name spaces
• This option will hide the names of the frames used in equations to access values in other frames.
• For example, if you use table values in a report, by default the table name appears in front of the cells used. If Hide Namespaces is turned on, the table name will not appear in the math display, but it will still be in the actual formula.
• Wrap long equations into multiple lines
• Blockpad will split the equation at natural points, like at addition or subtraction.
• Reduce the size of superscripts and subscripts
• Change the multiplication operator display (*, âœ•, or ·)
• Change the equals operator display (= or â‰”)
• Change the comparison (boolean) operator displays (e.g. != vs ≠)
• Change the member access operator display (., →, or ->)
• Show just the true section of an If() function
• Change degree unit displays (deg, F, C or °, °F, °C)
• Make all named values in an equation italic
• Show built-in functions in lower case
• Make arrays a smaller font than the parent font
###### Change math layout settings:
1. Select one or more dynamic equations.
2. Open the properties window.
3. Under Formula near the bottom, select Math Layout.
4. Change settings as desired.
5. Click OK.

To apply math layout settings to all equations in a document, use style rules.

###### Apply math layout settings to all equations using styles:
1. Select Style>Manage Styles in the toolbar.
2. Click the Add button in the window that appears.
3. Change Objects of Type to Dynamic Equation.
4. Change Container to Frame Document.
5. Scroll down and click Math Layout near the bottom.
6. Change Use Math Layout to Yes and then change the settings as you want them.
7. Click OK.
8. Close the style manager window.

#### 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.

##### Show steps options

There are three different options for showing equation steps. These can be turned on independently, so you can show only what you want.

1. Reference Values - "plugs in" the numbers for the named values in your formnula.
2. Unit Conversions - shows the conversion process Blockpad uses when the [to keyword] is used.
3. Function Results - shows the calculation results of functions in the formula.

Below are a few examples of Show Steps, with the formula for the law of cosines. In all of the examples the Separate Lines property will also be on.

Here is the equation with Show Steps off:

Only Reference Values:

Only Unit Conversions:

Only Function Results:

All three options:

#### 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.