up previous next

2.2.7 Arithmetic

Here are some first examples; they illustrate CoCoA evaluating arithmetic expressions.

example

    
(2+3)(1+1);  -- multiplication, as usual
10
-------------------------------
2^10;
1024
-------------------------------
2+2/3;
8/3
-------------------------------
1.5+2.3;  -- decimals are converted to fractions
19/5
-------------------------------
Mod(27,5);
2
-------------------------------
2*3;
6
-------------------------------
Fact(4);
24
-------------------------------
        
    
For multiplication, one may use *, parentheses, or just a space.