Sponsored links: Algebra eBooks
 

Help Index

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

The Maxima on-line user's manual

Algebra Calculator

Search:

Make_array Calculator

Make_array

Function: make_array (<type>, <dim_1>, ..., <dim_n>) Creates and returns a Lisp array. <type> may be any, flonum, fixnum, hashed or functional. There are n indices, and the ith index runs from 0 to <dim_i> - 1.

The advantage of make_array over array is that the return value doesnt have a name, and once a pointer to it goes away, it will also go away. For example, if y: make_array (...) then y points to an object which takes up space, but after y: false, y no longer points to that object, so the object can be garbage collected.

     Examples:
          (%i1) A1 : make_array (fixnum, 10);
          (%o1)           {Array:  #(0 0 0 0 0 0 0 0 0 0)}
          (%i2) A1 [8] : 1729;
          (%o2)                         1729
          (%i3) A1;
          (%o3)          {Array:  #(0 0 0 0 0 0 0 0 1729 0)}
          (%i4) A2 : make_array (flonum, 10);
          (%o4) {Array:  #(0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0)}
          (%i5) A2 [2] : 2.718281828;
          (%o5)                      2.718281828
          (%i6) A2;
          (%o6)
               {Array:  #(0.0 0.0 2.718281828 0.0 0.0 0.0 0.0 0.0 0.0 0.0)}
          (%i7) A3 : make_array (any, 10);
          (%o7) {Array:  #(NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL)}
          (%i8) A3 [4] : x - y - z;
          (%o8)                      - z - y + x
          (%i9) A3;
          (%o9) {Array:  #(NIL NIL NIL NIL ((MPLUS SIMP) $X ((MTIMES SIMP)\
           -1 $Y) ((MTIMES SIMP) -1 $Z))
            NIL NIL NIL NIL NIL)}
          (%i10) A4 : make_array (fixnum, 2, 3, 5);
          (%o10) {Array:  #3A(((0 0 0 0 0) (0 0 0 0 0) (0 0 0 0 0)) ((0 0 \
          0 0 0) (0 0 0 0 0) (0 0 0 0 0)))}
          (%i11) fillarray (A4, makelist (i, i, 1, 2*3*5));
          (%o11) {Array:  #3A(((1 2 3 4 5) (6 7 8 9 10) (11 12 13 14 15))
              ((16 17 18 19 20) (21 22 23 24 25) (26 27 28 29 30)))}
          (%i12) A4 [0, 2, 1];
          (%o12)                         12

(%o1)                                true
(%i2) 

Make_array Example

Related Examples

array

array(a,0,90,8);

Calculate

array-disp-do

array( E,1000);

array(F,1000);

E[0]:0;

Calculate

array

array(a,2,3,4);

Calculate

array

array(T, 901);

array(N_c, 901);

array(N_v, 901);

Calculate

array-block-cos-floor-mod-random-sin-subst

array(data,16,16,16);

for i: 0 thru 7 do f...

data[0,0,0] = data[8,...

Calculate

array-diff-subst

array(M, 4);

array (CM, 4);

f(x):=1/(1-x*p);

Calculate

array-fillarray-make_array-makelist

A1 : make_array (fixn...

A1 [8] : 1729;

A1;

Calculate

array-expand-plot2d
plot2d([[discrete, p],f(x)], [x,1.0,3.3], [style, points, lines], [color, red, blue], [point_type, asterisk], [legend, "data", "approximation"], [xlabel, "x"], [ylabel, "y"]);

p:[[1.7,0.75],[1.65,2...

n:6;

array (d, n, n);

Calculate