It seems that array's declared with make_array are treated differently
then normal maxima variables.
Results with them don't seem to be simplified and using them in a
depends statement creates a error.
Arrays created with array work differently, but they are created in the
global name space so,
if there is a variable z globally, array(z,2) works, but depends(z,t)
doesnt.
Also apply_nouns does not seem to function in the windows
implementation, which I tried to
use first. I am aware that 'z[i] is not evaluated but if it isnt
quoted, sum of course returns 0.
Is it possible to keep a array created with array out of the global name
space?
I need to work with arrays so that each element can be treated as a
symbol. Is there a different
idiom that I need to use?
Thanks,
Dan Stanger
dan.stanger@ieee.org
With the following function
f():= block([t,
z:make_array('any,2)],
print(sum('diff('z[i],t),i,0,1)),
print(ratsubst(cos(t),'z[0],sum('diff('z[i],t),i,0,1)))
);
f() returns:
(C1) load('s3);
(D1) G:/maxima/mac/s3.mac
(C2) f();
d d
-- (z ) + -- (z )
dt 1 dt 0
d d
-- (COS(t)) + -- (z )
dt dt 1
d d
(D2) -- (COS(t)) + -- (z )
dt dt 1
(C3) ev(d2,nouns);
(D3) - SIN(t)
but
f():= block([t,
z:make_array('any,2)],
print(sum('diff('z[i],t),i,0,1)),
print(ratsubst(cos(t),'z[0],sum('diff('z[i],t),i,0,1))),
print(ev(ratsubst(cos(t),'z[0],sum('diff('z[i],t),i,0,1)),nouns))
);
gives
(C1) load('s3);
(D1) G:/maxima/mac/s3.mac
(C2) f();
d d
-- (z ) + -- (z )
dt 1 dt 0
d d
-- (COS(t)) + -- (z )
dt dt 1
Error: #(NIL NIL) cannot be coerced to a string.
Fast links are on: do (si::use-fast-links nil) for debugging
Error signalled by CATCH.
Broken at MACSYMA-TOP-LEVEL. Type :H for Help.
MAXIMA>>