Algebraic Mode

With the Show Algebraic option, users can create custom field quantities using algebraic expressions. Users can enter equations directly in the Data field, which is now editable. The text entered is in black when it parses and red when it does not. The Stack Command buttons can also be used to define an algebraic expression; the input text will be inserted at the current insert point in the Data field.

A sample algebraic expression is shown below:

View sample input of an algebraic exptression and the evaluted output

An algebraic expression can be saved in the Named Expressions list. If Show Algebraic is selected, all the named expressions will be listed in algebraic format. If Show Stack is selected, the named expressions will be listed in stack format.

An algebraic expression is either a namedExpression, a constant, a name, an operator, two expressions separated by binaryOperator, or an expression enclosed in parentheses.

An operator is an opName followed by arguments.

An argument is either empty parentheses, an expression enclosed by parentheses, or two expressions separated by a comma and enclosed by parentheses.

A binaryOperator is one of the following literals: ‘+’, ‘-’, ‘*’, ‘/’, '%', '^'

A name is either a project, design, or intrinsic variable (scalar or vector), or a geometry.

A constant can be one of the following:

The grammar for an algebraic expression is summarized below:

expression : namedExpression

| constant

| name

| operator

| expression binaryOperator expression

| '(' expression ')'

operator : opName arguments

binaryOperator : + | - | * | / | % | ^

arguments : '(' <empty> ')'

| '(' expression ')'

| '(' expression ',' expression ')'

Note the following:

Names

The following named constants and material properties are supported as input in the Fields Calculator:

list of constants includes Pi, Epsi0, Mu0, C, and Conversion Constants List of supported material properties includes Permeability (mu), Conductivity (cond), Permittivity (epsi), Admittivity, and Mass Density

Note that Mass Density corresponds to keyword “MassDensity”.

If there is a conflict between standard quantity names, user-defined named expressions, and user-defined variables, the default name conflict resolution order is

  1. Standard quantities such as E and Mag_E
  2. User-defined named expression
  3. User-defined variables

Words not immediately followed by an open parenthesis will be treated as a quantity or variable. Therefore, a user-defined variable named Real not followed by open parenthesis will be recognized as a variable instead of the operator.

The Var or Expr operator can be used to override the default name conflict resolution. For example, a user-defined design variable named Mag_E would normally not be recognized. Instead, the standard quantity Mag_E will be assumed, and evaluation will fail:

User-defined Mag_E variable cannot be evaluated because it has the same name as a standard constant

With the Var operator, the user-defined variable can be parsed correctly and evaluated for the user -defined value:

Adding Var to Mag_E causes the calculator to evaluate it as a user-defined variable

Here is another example that demonstrates how a user-defined variable can conflict with a standard named constant, such as epsi0, the vacuum permittivity, and how to use the Var operator to resolve the conflict:

Example of using Var to designate user-defined variable. Without Var, epsi0 evaluates as a 8.8542e-12; with Var(epsi0), it evaluates as -2

Geometry

If an operator requires a geometry input, the geometry argument can be either first or second in the argument list, or in some cases, both. The operator automatically infers the geometry of the argument; no explicit specifiers are required. For example, PointValue(GeomX, ExpressionY) will assume GeomX is a point.

If the user specifies an operator, but uses the wrong type of geometry in the argument list, the Calculator will return an error. In the following example, the PointValue operator has a line in its argument list, so the Calculator generates an error:

Fields Calculator PointValue operator has a line in its argument list, so the calculator generates an error

The following example shows the output when the geometry argument are specified correctly:

Fields Calculator displays the coordinate values for the two points specified in the argument list of PointValue

The following operators assume the geometry operand to be of the Volume type: