The p[i]
in the entries in the first Vector returned by xearm
are so-called escaped locals. As such they have a different address from entries of your global p
Vector, which is why they fail to evaluate as you expected.
You can get around this like as follows. Replace,
v:=f[1];
by,
v:=f[1];
v:=convert(v,`global`);
The a[i]
and b[i]
in the first result returned by xearm
appear to be indexed into the global names a
and b
, and don't have the same issue as do the p[i]
.
Using the properly working example from my earlier answer, here is a problematic version which exhibits similar behavior.
restart:
myProc:=proc()
local w, p;
w:=Vector(2);
w[1]:=p[2] + a[1];
w[2]:=p[5] + a[3] + sqrt(a[1]);
return w;
end proc:
v:=myProc():
v[1];
p[2] + a[1]
v[2];
(1/2)
p[5] + a[3] + a[1]
a:=Vector(3,1):
p:=Vector(5,2):
v[1];
p[2] + 1
v[2];
p[5] + 2
v:=convert(v,`global`):
v;
[3]
[ ]
[4]