Skip to main content

Create Simple Calculations

Currently, there is just one way of manipulating data on your notebook, and that is with calculations blocks.

On the calculation block you can play with numbers and data using the Decipad language.

Other blocks such as tables and widgets are useful for data inputting and display.

To add a calculation block to your notebook:

  1. Write / in a new paragraph;
  2. Select Calculations.

Here's an example:

As you would expect, operators work as in any other mathematical context.

Each calculation block will also resume the operation result on the right for you or anyone reading to follow.

Numbers

You can express simple integer numbers like this:

You can also specify the units of a number:

Quantities can also be fractional:

Arithmetic operations

In Decipad you have all the arithmetic operations you would expect:

When you have numbers with units, these operations also result in numbers with units:

Depending on the operations, the units must match. For instance, when adding or subtracting, the units in the numbers should be the same.

Here you can see what happens when you try to add numbers with different units:

When doing any arithmetic operation with two numbers, you can omit the units in one of them:

Decipad tries its best to match plural and singular units:

Other operations, like exponentiation, do their best to compute the correct units:

You can also use percentages:

Percentages can be added to other numbers, to increase them proportionally:

Variables

In a calculation block, you are able to assign names to your data using the = sign - we call it creating variables. Naming your data is very useful since it allows you to reference that data point on other blocks just by using its name.

For now, variables can't have spaces on their names, but you can use symbols or emojis. Don't forget that variables are case-sensitive, meaning that myvariable is different that MYVARIABLE.

Here are some examples on declaring a variable, where we use names or emojis as names.

Language Tables

If you are looking to create complex tables, you can always build your own table on a calculation block using the Decipad language.

Take a look at this example:


Learn More: