how to subs t.i with i*t.i
Christian.Bauer at Uni-Mainz.DE
Thu Jul 10 17:20:29 CEST 2003
On Thu, Jul 10, 2003 at 05:11:01PM +0800, Yong Xiao wrote:
> Hi, it seems that the following lines
> ex e1 = indexed(t,i);
> ,where i and i_ are idx and wildcard objects respectively, doesn't
> substitute t.i with i*t.i.
Hm? This works for me:
idx i(symbol("i"), 3);
ex e1 = indexed(t, i);
ex i_ = wild();
ex e2 = e1.subs(indexed(t, idx(i_, 3)) == i_ * indexed(t, idx(i_, 3)));
cout << e1 << " -> " << e2 << endl;
// prints "t.i -> i*t.i"
Perhaps you forgot that subs() returns its result as a new expression?
/ Physics is an algorithm
More information about the GiNaC-list