Formulas 1.2. Numeric expressions

All the formulas whose outcome is a number are called numeric expressions. For the following examples, all the outcomes can be checked with the calculator.

Examples with numbers

Some numeric expressions involve numbers only:

8*17
computes a multiplication. Outcome: 136.
2^10
computes the tenth power of 2. Outcome: 1024.
sqrt (2) / 2
computes the square root of 2, and divides the result by 2. Outcome: 0.7071067811865476.
sin (1/4 * pi)
computes the sine of π/4. Outcome: 0.7071067811865476 (again).

Examples with strings

Some numeric expressions compute numeric properties of strings:

length ("internationalization")
computes the length of the string "internationalization". Outcome: 20.
index ("internationalization", "ation")
computes the location of the first occurrence of the string "ation" in the string "internationalization". Outcome: 7, because the first letter of "ation" lines up with the seventh letter of "internationalization". If the substring does not occur, the outcome is 0.

Examples with arrays

Some numeric expressions compute numeric properties of numeric vectors:

size ({ 40, 70, 60, 50 })
computes the length of the vector { 40, 70, 60, 50 }, i.e. the number of its elements. Outcome: 4.
mean ({ 40, 70, 60, 50 })
computes the mean of the four numbers 40, 70, 60 and 50. Outcome: 55.