how to subs t.i with i*t.i
Christian Bauer
Christian.Bauer at Uni-Mainz.DE
Thu Jul 10 17:20:29 CEST 2003
Hi!
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);
> e1.subs(indexed(t,idx(i_,3))==idx(i_,3).get_value()*indexed(t,idx(i_,3)));
> ,where i and i_ are idx and wildcard objects respectively, doesn't
> substitute t.i with i*t.i.
Hm? This works for me:
symbol t("t");
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?
Bye,
Christian
--
/ Physics is an algorithm
\/ http://www.uni-mainz.de/~bauec002/
More information about the GiNaC-list
mailing list