Formulas and functions: numbers
In the sections getting started with formulas and getting started with functions the basics of this topic are presented. This section is specifically about the use of formulas and functions to edit numbers. Examples of models that show how to use these functions can be found at the example models.
The basic math operations - adding, subtracting, multiplying and dividing - all work as you might expect in the Berkeley Studio. For example, consider two variables:
number1 + number2 number1 - number2 number1 * number2 number1 / number2
You can of course do the same with plain numbers as well:
7 * 8 = 56 5 * 6 / 3 = 10
And so on. If you want to do more complex calculations this way, you can also use parentheses:
8 * (5 - 3) = 16 (number1 + number2) / (number1 * 5)
Functions on numbers
The Berkeley Studio has several functions that are useful when working with numbers. Below most of them are presented with some examples. Whenever you are working in the Berkeley Studio, you can always look up the functions with their help text via the Finder.
Power and square root
power() function calculates a number to a given power. The first parameter you need to enter is the number and the second the power. For example:
power(5,2) = 25 power(12,2) = 144 power(3,3) = 27
The square root is calculated in similar fashion, but with the
sqrt(9) = 3 sqrt(144) = 12
Min and max
max() are useful when working with variables.
max() always returns the largest number of two given numbers.
min() always gives the smallest. Given variables
number2 with values 10 and 5:
min(number1, number2) = number2 max(number1, number2) = number1 max(100, 3) = 100 min(100, 3) = 3
Rounding numbers is useful in a lot of situations. In the Berkeley Studio, the function
round() does the job. You need to give two parameters: the number you want to round and the precision (number of decimals). Some examples:
round(1.234, 2) = 1.23 round(1.23456, 4) = 1.2346
Note that you have to use dots in the Berkeley Studio for decimals!