functions:LOOP

general

 All the looping functions mimic standard mathematical notation. The
 looping functions require a previously declared scalar dummy variable
 as second argument. A dummy variable is declared with the SCALAR\DUMMY
 command. A dummy variable is different from other scalar variables in
 that its value is only defined while inside the looping function. The
 third argument of a looping function is always the range of this dummy
 variable, and must be a vector. The first argument of a looping function
 would normally be some function of the dummy variable, but it is not
 necessary that the dummy variable appear in the first argument.

1_example

                                          |  1  2  3  4 |
                                          |  5  6  7  8 |
 Suppose X=[1;2;3;4;5], Y=[2;3;4;5;6], M= |  9 10 11 12 | and I and J
                                          | 13 14 15 16 |
 have been declared to be dummy variables with SCALAR\DUMMY I J.

 function                        result
 ------------------------------------------------
 LOOP(X[I]*Y[(6-I)],I,1:5)       [6;10;12;12;10]
 LOOP(M[I,I],I,1:4)              [1;6;11;16]

                                 | 1  1  1 |
                                 | 2  2  2 |
 LOOP(X,I,1:3)                   | 3  3  3 |
                                 | 4  4  4 |
                                 | 5  5  5 |

                                 | 1  2  3  4 |
                                 | 0  6  7  8 |
 LOOP(LOOP(M[I,J],I,1:J),J,1:4)  | 0  0 11 12 |
                                 | 0  0  0 16 |

                                 | 1  5  9 13 |
                                 | 0  6 10 14 |
 LOOP(LOOP(M[J,I],I,1:J),J,1:4)  | 0  0 11 15 |
                                 | 0  0  0 16 |

2_example

            | 11 12 13 |
 Suppose M= | 21 22 23 | and J has been declared to be a dummy variable 
            | 31 32 33 |
 with SCALAR\DUMMY J. To invert the matrix, that is, to flip the matrix
 upside down, use:

 function                         result
 ------------------------------------------------ 
                                  | 31 32 33 |
 <-LOOP(M[I,*],I,3:1:-1)          | 21 22 23 |
                                  | 11 12 13 |

 You must use the transpose operator, <-, since M[I,*] is a vector,
 and each time LOOP iterates on I, it produces a column of the output
 matrix.