home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   sci.math.symbolic      Symbolic algebra discussion      10,432 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 9,606 of 10,432   
   Piet van Oostrum to asetofsymbols@gmail.com   
   Re: [Axiom] matrix element access   
   13 Aug 17 19:14:55   
   
   From: piet-l@vanoostrum.org   
      
   asetofsymbols@gmail.com writes:   
      
   > I say   
   > If a:List List Type   
   > If i see it as one matrix of generic element of type Type   
   > know value from   
   >   
   > a.i.j    i in 1..#a  j in 1..#a.i   
   >   
   > or something as that   
   > Why not consider matrix, all list of list and definite in that type "List   
   List Type" all matrix operations?   
   >   
   > I know 99% i speak in what i don't know so possible i see it wrong...   
   >   
   > List List List type   
   >   
   > whould be matrix nxmxk...   
      
   Well, you can see it like that, but Axiom sees it differently. It works   
   with Domains, and operations are defined in those domains. The List   
   domain does not have a multiplication operation. The Matrix domain has   
   it, but that is only possible if the elements have an addition and   
   multiplication operation, i.e. they must come from a Ring.   
      
   That is also how a matrix is defined in mathematics.   
      
   In your example you had elements that were Lists themselves. These   
   cannot be multiplied or added. So it makes no sense to put these in a   
   matrix.   
      
   If you only want to have a two dimensional structure you can use   
   TwoDimensionalArray. However, it does not have a nice constructor like   
   matrix. So you have to construct it yourself.   
      
   arr2 : TwoDimensionalArray(List(Integer)) := new(4, 4, [])   
   for i in 1..4 repeat for j in 1..4 repeat arr2(i,j) := [i, j]   
   Then arr2(2,3) will give you [2, 3]   
      
   --   
   Piet van Oostrum    
   WWW: http://piet.vanoostrum.org/   
   PGP key: [8DAE142BE17999C4]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca