~ubuntu-branches/debian/squeeze/maxima/squeeze

« back to all changes in this revision

Viewing changes to demo/subscr.dem

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2006-10-18 14:52:42 UTC
  • mto: (1.1.5 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20061018145242-vzyrm5hmxr8kiosf
ImportĀ upstreamĀ versionĀ 5.10.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
/* useful for manipulating matrices, arrays, and arbitrary dimension and   */
5
5
/* order data objects constructed as lists of lists of lists...            */
6
6
 
7
 
SUBSCRMAP:TRUE                          /* This enables subscript mapping */;
8
 
a[[x1,x2],[y1,y2]]                      /* Map a[x,x] over the subscripts */;
 
7
subscrmap:true                          /* this enables subscript mapping */;
 
8
a[[x1,x2],[y1,y2]]                      /* map a[x,x] over the subscripts */;
9
9
m:matrix([a,b],[c,d])                   /* enter a matrix */;
10
 
M[[1,1,1],[[1,1],[2,2]]]                /* Create a new structure from M */;
11
 
af[i,j]:=x^(i+j)                        /* Define a generating function */;
12
 
iota(n):=                               /* index list generator like APL */
 
10
m[[1,1,1],[[1,1],[2,2]]]                /* create a new structure from m */;
 
11
af[i,j]:=x^(i+j)                        /* define a generating function */;
 
12
iota(n):=                               /* index list generator like apl */
13
13
    block([l], l:[],
14
14
          for i:1 thru n do l:endcons(i,l),
15
15
          l)$
16
16
il:iota(8)                              /* generate an index vector 8 long */;
17
 
af[il,il],eval                          /* Construct a structure */;
 
17
af[il,il],eval                          /* construct a structure */;
18
18
apply(matrix,%)                         /* make it a matrix */;
19
19
m[[2,1]],eval;
20
20
apply(matrix,%);
22
22
matrix(m[[1,2],[1]]),eval               /* select a column */;
23
23
matrix(m[[2,1],''(iota(length(m[1])))]),eval /* select all of one dimension */;
24
24
a['[1,2]]                               /* use a list as a hashed ary subscript*/;
25
 
ARR[[1,2,3,4]]::0.0                     /* Assignment.  Note use of ::      */;
 
25
arr[[1,2,3,4]]::0.0                     /* assignment.  note use of ::      */;