how to subs t.i with i*t.i

Yong Xiao yxiao at zimp.zju.edu.cn
Fri Jul 11 06:32:59 CEST 2003


> 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?
Oh, yes. It's really stupid that I forgot this. Thank you much. :-)

Yong




More information about the GiNaC-list mailing list