Math Module
Overview
The ​Math module is a tool to centralize parameter values that are used in more than one place in Shape. In a way similar to a spreadsheet it allows to compute variables from other variables that have already been defined further up. This makes it possible to set up a complex mathematical model of physical processes that can then be harnessed throughout the rest of Shape.
Global Variables:
Since the variables defined in the Math Module can be used throughout Shape, they are called Global Variables. Whenever you wish to use variables from the Math Module in other modules, make sure to enable the flag "Use global variables" where applicable.
Workflow
​
The basic workflow consists first in adding new slots for new variables in the order of dependency, if any. Then provide a meaningful name for and defining their relationships and values. They can then be used in a variety of contexts throughout Shape.
​
Variable Names:
While Shape automatically assigns a letter as a name for new variables, it is very highly recommended to change them with meaningful and descriptive names, such that they can easily be understood wherever they might appear in Shape. The name can be changed by double-clicking on the name field of the variable.
Column Functionalities
​
Variable: This column contains the name of the global variables. In order to use a variable in some other module of Shape, the name needs to match. Upper and lower case letters are not distinguished. When a new variable is added, it receives a default name in alphabetical order. Change the variable names to something descriptive of the meaning of its content.
Expression: Variables get assign a value through a mathematical expression in this column. In most cases this will simply be a value. A value can be given in integer or floating point format as well as scientific format such as 1.09435e-7 for numbers that are much smaller than 1, or 3.2E15 those that are much larger than 1.
In addition to numbers the field can contain more complex mathematical expression, including those combining one or more global variables that are further up in list. To avoid recursive dependencies, variables further down can not be included.
Valid mathematical expression may include the basic symbolic operators +-*/ and ^, but also common textual operators which include the following reserved functions and variable names:
POWER, SIN, COS, TAN, COT, RAND, CSC, ARCSIN, ARCCOS, ARCTAN, EXP, LN, LOG10, LOG2, ABS, SQRT, ROUND, ARCTANH, UNARYMINUS, LT, GT, and the irrational numbers "e" and "pi";
​
As mentioned above, these functions can also be written with lower-case letters.
Menu bar
​
The buttons on the top menu bar of the Math Module control the overall content of the Math Module.
​
Calculate: The Calculate button executes all calculations that may in standby, e.g. for iterative computations. Direct calculations of variables that depend on variables further up are executed on confirming the variable name with the Enter key.
Variable: The Variable button adds a new variable to the end of the list.
The variables sequentially get names of single letters in alphabetical order. As mentioned above, it is recommended to change these names to something descriptive of its meaning. The variable name is changed by double-clicking on the text field.
Separator: Separators are used to keep different sections of the list of variables clearly distinct. They can also function as headings if you add some descriptive text to their text fields. The separators are colored in dark blue.
Constants: This button adds a set of variables that contain the most important natural constants in SI units. If you only need a subset of them, simply select the unwanted ones and delete them with the Remove button.
Remove: To remove variables from the Math Module, select them and click the Remove button. You can select several variable together with Shift-Click and remove them in one operation. A confirmation dialog helps to make sure that you do not delete variables by accident..
Up & Down: To move a variable in position in the list, select the variable and click on the Up or Down button to move it by one position. Repeat the operation until the variable is in the desired position.
Defaults: Use these buttons to restore the default values that variables may have in the Default field. Note that this button restores the defaults of ALL variables at once. Individual or a subset of defaults have to be reset manually.
Save & Load: In order to keep sets of variable interchangeable between different projects that have similar setups, one can save the content of the Math Module in a file with the Save button. To open a saved set of variables use the Load button.