As discussed in [https://.../t/help_create|Creating Templates Overview], an equation is a math sentence that defines the relationship between variables. Equations can include numbers (called constants), variables, math symbols and functions. To be an equation, however, PowerOne expects an equals sign and at least one math symbol or function.

In general PowerOne figures out what you meant as you type. The type indicated in the details display will list a row as unknown with its assumed type in parentheses. When you are done typing it will fix its type. This type can always be changed manually if desired.

Equation rows show [icon--app-equation-inverse | equation indicator]. Note that equations only appear when editing a template and not in the template itself.

An equation is a math sentence that defines a relationship. In PowerOne an equation has two sides, left of the equals sign and right of the equals sign. The left side of the equals sign is generally considered a variable and it is assigned to a math expression on the right side. Math expressions include a combination of constant values (12, 0, 2), [https://.../t/help_functions | math symbols] (*, ^) and [https://.../t/help_functions | functions] (pmt).

These are all examples of equations:

When an equation is entered, PowerOne finds all of the variables within that equation and creates them automatically if they are not already available in the template. It treats the left side of the equals sign as a single variable and breaks the right side into unique variables. When calculating, the values for those variables on the right are used to derive answers.

When entering the Circle Area equation above, the following template would be created:

Radius =

Circle Area =

Note that only the variable on the left side of the equation has an active [icon--app-unknown-inverse | unknown or unsure value button] button, which means it can be calculated. By default, PowerOne assumes only the isolated variable on the left side will be calculated for each equation. Also note that Circle Area is read-only by default. This is because it can only be calculated as it is never marked for calculation or used as an input in another equation.

There is a way to treat both the left and right side of an equation as expressions. There is also a way to designate that variables on the right side of the equation can be calculated. See the Solving section below.

Variables are the glue that ties equations together. A variable can be used in one or multiple equations, and results cascade down the page. For example, we can calculate a down payment on a home and then use that to figure out a loan amount:

The above source creates the following template:

Home Price = 400000

Down = 20

Down Payment = 80000

Loan = 320000

In the first equation, Down Payment is calculated using the variables Home Price and Down. In the second equation, the Loan amount is calculated from the Home Price and the calculated result from the second equation, Down Payment. Equations are tied together simply by using their variables in multiple equations.

Variable names can be used multiple times in the same template. However, when determining the variables within an equation, PowerOne will find the matching variable closest to the equation and use it, whether that variable is above or below the equation. If the wrong variable is selected by PowerOne, create the desired variable directly below the equation then re-type that variable in the equation. It will select the correct one. See Multiple Variables with the Same Name and Aliases section below for more details.

Also notice how variables and equations can be interspersed as desired. Variables can come before equations, after equations or in between them.

Continuing with the example from the section above, let's say you would like Down to calculate automatically when Down Payment is entered, eliminating the need for PowerOne to ask. To do this just add an extra equation where Down is the directly computed variable. We already had this equation:

Now adding this one will also calculate Down:

Home Price = 400000

Down = 20

Down Payment = 80000

Now when Home Price and Down are known, Down Payment is calculated and when Down Payment and Home Price are known, Down is calculated. What if Home Price is changed and both Down and Down Payment are unknown? First equation wins. The expression for Down Payment will be calculated first because its equation is higher in the template.

Technically PowerOne incorporates two methods of calculation: direct computation and solving. Direct computation is what we've explored so far. Entering Home Price and Down% calculates Down Payment and Loan. In direct computation problems, the variable to the left of the equals sign is always calculated by the expression to the right of the equals sign.

Solving is where other variables within the equation can be computed, not just the left side. To solve for other variables within an equation, place the cursor in the desired equation then check variables under "This equation calculates these checked variables..." in the details display. Each checked variable will use this equation to calculate.

Returning to the first example, Loan is calculated automatically when Home Price and Down Payment are entered. But what if you would like Home Price to be a calculate option when Down Payment and Loan are entered? We will use the same equation but changes it details:

To calculate Home Price and Down Payment, select the equation row to edit it, select **details** then check **Home Price** and **Down Payment** in the **Solving** section. Notice that they both change to an active [icon--app-equals-known| known value] button. Click the equation above to see the changes.

Home Price = 400000

Down Payment = 80000

Loan = 320000

When Loan is changed to 350,000, notice how both Home Price and Down Payment indicate they are unknown, where Home Price and Down Payment display an active [icon--app-unknown-inverse | unknown or unsure value button] button. Select that button next to Home Price to recalculate.

Note that this is similar to the Incorporating Multiple Equations section above. The difference is that in Incorporating Multiple Equations section you had to manually manipulate the equation to isolate the desired variable while here PowerOne does it for you.

By default, **Auto calculate left of equals** option in the details is checked. This means that the isolated variable on the left side of the equals sign will automatically calculate. This is why changing Home Price or Down Payment will automatically calculate Loan. Unchecking this option will wait for you to decide what to calculate, showing Loan as an active [icon--app-unknown-inverse | unknown or unsure value] button when either Home Price or Down Payment are entered.

Checking this option also assumes that all of the text left of the equals sign is a single variable when the equation is created. For instance the following equation would automatically create variable End Velocity^2:

Once the equation is created, it is very difficult to correct. Instead, you want this option unchecked before PowerOne interprets your equation. To do that, select **Settings** then check **Default to solving equations** before entering your equation. As long as variable End Velocity^2 is not found, PowerOne will correctly interpret End Velocity as the variable to have math performed upon it.

It is possible to mark the same variable to be calculated in multiple equations. In this case, PowerOne will calculate with the first equation it finds that has all other variables known.

PowerOne's calculation engine starts at the first equation it finds in the template and works down through each equation until it finds one it can calculate. When it does find one, it performs the mathematics and then starts again at the top of the template, working its way down the template again. It repeats this process until there are no equations left to calculate, whether because they all have calculated or because it found equations where there are multiple unknown variables.

Because of this, the equation order is important but the order of variables is not. Remember what ties equations together: their variables. This means that equations used to calculate variables that will then be used in subsequent equations need to go higher up in the template. Think of results as cascading down the page. The calculation log, discussed below in Debugging Your Templates section, can help uncover these issues.

Solving equations are the exception to this rule. In solving equations, where variables to the right of the equals sign are marked to calculate, the template can calculate up the page instead. In these cases it is critical to consider which variables should be calculated by the equation and make sure they are all used in that equation. While you can solve across equations, PowerOne makes no attempt to automatically combine equations and will ask you what to calculate, step-by-step, as it uncovers the unknown variables in each equation.

Finally, don't do PowerOne's work for it. Instead of creating multiple equations that each directly calculate one variable left of the equals sign, mark those variables as calculable in a single equation.

Points to remember and consider:

- Equations are tied together with variables

- Equation order matters but variable order does not

- Order equations so higher-up equations calculate variables used in lower, down-the-page equations

- When creating solver equations, make sure the variables you wish to calculate are incorporated in the same equation

- The calculation log, detailed below in Debugging Your Templates section, is your friend

When adding an equation, PowerOne indicates 1) new variables; and 2) which variables are used in the equation. The current row is marked with a blue bar while connected rows are marked with dark grey bar to the left of the row. Meanwhile, new variables are highlighted:

[https://poweronecalc.s3.amazonaws.com/help/editor_indicators_equation.png | variables used in equation indicator]

Conversely, which equations a selected variable is in is indicated the same way:

[https://poweronecalc.s3.amazonaws.com/help/editor_indicators_variables.png | equations containing variable indicator]

Equations can become long and unwieldy. To help, PowerOne makes it possible to break equations into multiple lines, add spaces to the beginning of each line (indenting), and add comments within equations to assist with clarity.

Lines can be broken with a simple return anywhere in an equation except in the middle of variables. A return in the middle of a variable will treat the break as two separate variables. Furthermore, to assist with readability, spaces can be added to the beginning of any line. For instance it is often easier to see multiple nested if() functions by indenting the "true" and "false" parameters.

Comments can also be added anywhere in an equation. A comment starts with /* and ends with */. These comments are ignored while evaluating so anything can be included within the comment itself.

The comment /* calculates a total */ is ignored when calculating this equation.

Variable names can be used multiple times in the same template. However, when determining the variables within an equation, PowerOne will find the matching variable closest to the equation and use it, whether that variable is above or below the equation. If the wrong variable is selected by PowerOne (as indicated per the section above), create the desired variable right above or below the equation then re-type that variable in the equation. It will select the correct one.

Using the same variable name can cause calculation problems, though. Given the following variables and this equation, PowerOne will choose only one (the one closest to the equation) for computation:

Subtotal = 500

Subtotal = 600

Subtotal = 700

Total = 2100

In this case it chooses the Subtotal closest to the equation, which is the one assigned 700. To distinguish between each of these, you can assign an alias to each variable. An alias is an alternative name for the same variable. While the template user can see three subtotal rows, you instead can use the alias in the equation:

Subtotal = 500

Subtotal = 600

Subtotal = 900

Total = 2000

Each of these subtotals has its own alias (Subtotal 1, Subtotal 2, and Subtotal 3) and therefore uses that alias within the equation instead:

The rules for naming an alias is the same as [https://.../t/help_variables | defining variables] except aliases must be unique.

Each row has additional details that can be set. Most of these details are available in the details view, available by selecting the **details** button just below the editor to see them. Type, however, is available all of the time. Equation options include:

- ++**Type**++: The row's type. Equation rows are listed as "equation?" if the row is unknown or "equation" if already fixed (returning to an existing equation row). This option can be changed by selecting the pop-up list below the editor. It is also displayed in details but cannot be modified there.

- ++**Alias**++: Equation aliases are used only for source code rows. See [https://.../t/help_text | text] for details.

- ++**Ignore**++: Ignore this equation. This is similar to commenting out the equation in a programming language.

- ++**Comment**++: Add any comments desired here. These are for your eyes only and will not appear to the template user.

- ++**Auto calculate left of equals**++: When checked the left side of the equation is treated as a single variable and will be automatically calculated (Phase 1in the How Calculating Works section). When unchecked the left side of the equation is treated as an expression instead, which may be treated as containing multiple variables, and requires manual calculation. See the Solving section above.

- ++**This equation calculates these checked variables...**++: Checked variables will be calculated with this equation. Variables marked as constants are not listed. See the Solving section above.

There are two kinds of errors, calculation and syntax. A calculation error occurs when the result of a computation fails. Calculation errors are discussed in [https://.../t//help_variables|Variables].

Syntax errors occur when an equation is formed in a way PowerOne doesn't understand. When a syntax error occurs, an error alert is displayed in the lower, left corner and each equation with an error shows an error button:

[https://poweronecalc.s3.amazonaws.com/help/equation_error.png | syntax error alert and indicator]

Selecting the row in the editor will position the cursor at the error and tell you what error occurred. Syntax errors include:

- ++**Missing "(" or "["**++: expects a left parenthesis or left bracket

- ++**Missing ")" or "]"**++: expects a right parenthesis or right bracket

- ++**Missing or invalid value**++: a value is expected and missing or is invalid [i.e., 3**4 expects a number between the two multiplication symbols (*)]

-++** Missing or invalid math symbol**++: a math symbol is expected and missing or is invalid [i.e., 356( expects a multiplication symbol (*) between 356 and the left parenthesis]

- ++**Invalid data or unit type : the data or unit type is malformed [i.e., 13/45/12 is not a valid month/day/year formatted date]

- ++**Invalid dimensions**++: tables don't have a correct number of items (i.e., [3;4]+[3;4;5])

- ++**Not enough function parameters**++: a function expects more parameters than were provided [i.e., comb(3)]

- ++**Too many function parameters**++: a function expects less parameters than were provided [i.e., fact(3;4)]

- ++**Unknown function**++: the function named does not exist [i.e., xyz()]

- ++**Unknown variable**++: variable is unknown or doesn’t exist

- ++**Parameter out of range**++: the parameter is outside of the expected range [i.e., floor(34.53; 15) where the decimal places parameter -- the second one -- must be between -10 and 10]

- ++**Too many nested operations**++: PowerOne can handle a maximum of 256 functions in other functions [i.e., if(if(if(...))) 257 times ]

- ++**Unexpected semi-colon**++: found a semi-colon in an unexpected location [i.e., 2;3*4]

- ++**Missing "**++: missing a quote mark in a string, especially within functions [i.e., error("Too few quotes)]

- ++**Unused equation**++: occurs when an equation has no variables marked for calculation or those marked for calculation are also marked as constants

Sometimes it is not clear why a template is misbehaving. In these cases, it is often useful to see how PowerOne's engine viewed your template. The Calculation Log shows you exactly how PowerOne engine works, stepping you through how the template calculates using many of the concepts discussed above.

To see the calculation log, select [icon--app-more | more] then **View Calculation Log** while editing a template.

[https://equals.s3.amazonaws.com/help/equations_calclog.png|calculation log view]

The calculation log is updated after each calculation (including Clear), displaying each equation, in the order it was considered, and the decisions it made. Separators separate unique calculation events with the most recent at the bottom.

It retains up to 100 events and can be cleared (via Clear Log). We even provide a simple method to email technical support to get help with your template and share with us your log.

Radius

Circle Area

Home Price

Down

Down Payment

Loan

Home Price

Down

Down Payment

Home Price

Down Payment

Loan

Subtotal

Subtotal

Subtotal

Total

Subtotal

Subtotal

Subtotal

Total

-------------

Solving

Multiple Equations

Indicators

Aliases

Syntax Errors

Missing "(" or "["

Missing ")" or "]"

Missing or Invalid Value

Missing or Invalid Math Symbol

Invalid Data or Unit Type

Invalid Dimensions

Not Enough Function Parameters

Too Many Function Parameters

Unknown Function

Parameter Out of Range

Too Many Nested Operations

Unexpected Semi-Colon

Missing "

Unused Equation

Calculation Log

Debugging Templates

Default to solving equations

Auto calculate left of equals

Alias

Ignore

Comment

This equation calculates these checked variables

View Calculation Log

Breaking Equations

Equation Formatting

Indenting

Comments