CalcTree Help Pages
  • What is CalcTree?
  • Getting started
    • CalcTree Pages
    • Create a CalcTree Page
    • Add a calculation
    • Collaborate with a colleague
  • Calculations
    • Parameters
      • Math formulas
        • Parameter Data Types
        • Native Functions
          • Arithmetic Functions
          • Trigonometric Functions
          • Logical & Comparison Functions
          • Matrix & Vector Functions
          • Probability & Combinatorics Functions
          • Statistical Functions
          • String Functions
          • Utility Functions
          • Other Native Functions
        • Valid Expression Syntax
      • Supported Units
      • Dropdown List Parameters
        • Linking CSV Data to Dependent Dropdowns in CalcTree
      • Parameter Settings
    • Integrations
      • Python in CalcTree
        • Adding a Python Source
        • Defining Parameters in Python
        • Referencing Other Parameters in Python
        • Working with Units in Python
        • Creating Tables and Visuals in Python
        • Consuming Files in Python
        • Using Pre-installed Python Libraries
      • Spreadsheets [Coming Soon!]
      • File Upload
        • CSV files
      • 3rd Party Software Plugins
        • Excel
        • Grasshopper
        • ETABS [v20 & v21]
        • ETABS [v22]
        • SAP 2000
        • CSI Bridge [v26]
    • Templates [Coming Soon!]
    • Optimising your calculations
  • Pages & Reports
    • CalcTree Documents
    • Static content
    • Parametric content
      • Parametric equation
      • Inputs
      • Outputs
  • Export to PDF
  • API
    • GraphQL API
      • Generating an API key
      • Queries
        • GetCalculation
        • Calculate
      • Examples
        • Bulk calculations with Python
  • Collaborate
    • Add members
    • Review and approval
    • Add stakeholders
  • Administrate
    • CalcTree Workspace
    • Versioning and Audit trail
  • CalcTree for System Administrators
Powered by GitBook
On this page
  • Create a math formula
  • Math formula editor
  • Physical units in math formulas
  • Automatic unit conversion
  • Edit a math parameter's Name or Display name
  • Linking math formulas to other sources
  1. Calculations
  2. Parameters

Math formulas

Create calculations with regular math formulas

PreviousParametersNextParameter Data Types

Last updated 1 day ago

CalcTree supports regular math formulas as a calculation option — powered by , the underlying math engine used in the platform.

You can create and edit Math formulas anywhere inside a page.

Create a math formula

Click somewhere on a page document and follow the following steps to create a formula using regular math expression:

Type:
What happens next:

1.

/p then Enter

A new math formula is defined. The math formula defines one parameter. You can start typing the title (Display name) for the parameter.

2.

Length then =

You've assigned Length as a title (Display name) for the math parameter. The calculation-friendly Name of the parameter will be in small letters: length. That means, to refer to this parameter in other sources, you need to use length

3.

2 + 2 then =

You've defined the math formula as 2 + 2, exited the math editor mode, and received a representation of the math formula and the current value of the parameter.

The element you've just created on the page document, acts as an inline source editor for the math source and also as a parametric element that represents the math source and the parameter it defines. Learn more about parametric document elements here: Parametric content

Math formula editor

While editing the formula, a drop-down list of recommendations will appear for you to select from. The suggestions include:

  • Parameter names

  • Physical units

  • Math functions

For example, by typing w in the formula editor below, an available parameter name, two available physical units and an available math function that starts with w are suggested:

Physical units in math formulas

A number and a physical unit comprise a quantity in CalcTree. You can use quantities in math formulas because formulas accept physical units as valid terms. For example, you can multiply 1 kPa and 1 m^2 to get 1 kN:

Note that if you try operations on quantities that are not physically meaningful, you will receive an error. For example adding a length to a time will result in an error, designated by a red background:

This unit-awareness acts as a built-in quality control as it checks the operations are done on compatible quantities. This is especially useful when linking parameters from other sources in Math formulas. Read more here: #chaining-math-formulas-to-other-sources

Automatic unit conversion

CalcTree supports automatic unit handling and conversion within formulas. This makes it easy to write calculations involving physical quantities without having to manually convert units each time.

How It Works

If you want to convert a quantity to a specific unit, you can use the to keyword directly in a formula:

= (3 m + 200 cm) to ft

This will convert the result to feet:

= 16.4 ft

You can also use to with variables:

= total_length to mm

Edit a math parameter's Name or Display name

Each parameter has a Name and a Display name:

  • Name: is a calculation friendly string that is used to refer to the parameter in sources. It follows the common practices for naming in programming:

    • starts with a small letter (a-z) or underline _

    • can contain only small letters, underline, and digits (0-9)

    • can not be a reserved keyword ( Python syntax terms such as if and while, or Physical units such as m and s )

    • should be unique among all Page parameters (collection of all parameters defined by all sources of a CalcTree page)

  • Display name: is a document-friendly way of representing the parameter on the document. The above constraints doesn't apply to Display name

You can edit the Display name of a parameter on the document, or on the Settings panel on the right hand side. The settings panel appears when you click on a parametric element. You can edit both the Display name and the Name of a Math parameter on the settings panel:

The settings panel includes various options for tweaking how the parametric element appears on the document. Learn more about those options here: Parametric equation

Linking math formulas to other sources

You can link multiple sources to create more complex calculations. That means a source picks up a result from another source and does more calculations on it.

In order to link a Math formula to other calculations, it needs to refer to the value of another source's parameters. That is simply achievable by typing the parameter name inside the formula. For example, if you have two parameters called length, and width which are defined by other sources, you can refer to them in your formula:

In the above example, the parameters length and width could be defined by another source of any type.

Math.js
Parametric element settings on the right-hand panel