afosterri

10 Reputation

2 Badges

17 years, 206 days

MaplePrimes Activity


These are questions asked by afosterri

See the following code

restart;
u:=Vector(1);
u[1]:=1;
x1:=sum('u[i]^i','i'=1..1);
u[1]:=2;
x2:=sum('u[i]^(i)','i'=1..1);
x3:=sum('u[i]^(i+1)','i'=1..1);

When I run x1=1 and x2=1, but x3=4. But x2 should be 2. I presume this has something to do with the fact that when sum sees u[1] it already thinks it knows what u[1] is, but when it sees u[1]^2 it recalculates.  I realize that "add" would solve the problem here, but I thought for short sums sum called add. Suggestions?

 

 

Page 1 of 1