Lists

ArtSGraph treats lists as a valid expressions. A list consists of several expressions separated by commas and enclosed in brackets. While evaluation a list, ArtSGraph evaluates each element of the list separately and independently.

Examples

(1,2,3)              (cos(x),sin(x))

 

If list is assigned to a variable you can extract its element using indexes.

Example

v=(1,3,2)                                             ; a vector

len_v=sqrt(v(1)^2+v(3)^2+v(3)^2)   ; length of the vector

 

ArtSGraph allows nested lists. To extract elements of nested list use second index.  

Example

m=((2,-1),(1,2))                                               ; a matrix

det_m=m(1,1)*m(2,2)-m(1,2)*m(2,1)            ; length of the vector