Working with Arrays

A basic building block while working in MP is an array or vector. An array holds a list of values (numbers or Boolean values). After an array is created we can perform many useful operations on them. Have a look at the following MP session:

>> format (G);
>> old_salaries = array ( 200, 230, 340, 430, 239, 293, 983, 19);
>> new_salaries = old_salaries * 1.1
>> 220 253 374 473 262.9 322.3 1081.3 20.9
>> sum (old_salaries)
>> 2734
>> sum (new_salaries)
>> 3007.4