开发者

Maple: having params[1]; returning 'a[0] = 2' how to make a[0] = 2?

So I have some array called params[]开发者_如何学Go; there are things like a[0] = 2 in it. I want to make all such items real meaning I would call a[0]; and get 2. How to do such thing in maple?


These are not the only ways to accomplish your goal. But hopefully they'll guide you.

One ways is to handle each such equation (from params) individually.

restart:
params := array(1..3):
params[1] := a[0]=2:

params[1];
                        a[0] = 2

a[0];
                          a[0]

assign(params[1]);

a[0];
                           2

You might have all entries of params being equations, and wish to accomplish the same task for all entries, at once.

restart:
params := array(1..3):
params[1] := a[0]=2:
params[3] := a[5]=7:

params[1];
                        a[0] = 2

a[0], a[5];
                       a[0], a[5]

entries(params);
                 [a[0] = 2], [a[5] = 7]

assign(entries(params));

a[0], a[5];
                          2, 7

Or, you might wish to use uppercase Array instead of the lowercase array (which is deprecated in modern Maple).

restart:
params := Array(1..3):
params[1] := a[0]=2:
params[3] := a[5]=7:

params[1];
                        a[0] = 2

a[0], a[5];
                       a[0], a[5]

map(rhs,rtable_elems(params));
                  {a[0] = 2, a[5] = 7}

assign(%);

a[0],a[5];
                          2, 7

Or you might have some entries of params being equations, and others being some other type (mere scalar expressions, say). In that case you might first select those which as equations, and only assign using that subset.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜