how to do subs for symmetric indexed objects?
Hello, I am tring to substitute Y_{imn}t_{nj} by Y_{jmn}t_{ni} where Y is a symmetric indexed object. My code for this is like indexed(Y,sy_symm(),i_,m_,n_)*indexed(t,n_,j_) ==indexed(Y,sy_symm(),j_,n_,m_)*indexed(t,n_,i_) where i_,j_,m_ and n_ are wildcards. But the code doesn't work. Attached is the code. How should I do? Thanks #include <iostream> #include <ginac/ginac.h> using namespace std; using namespace GiNaC; int main() { symbol Y("Y"),t("t"); symbol i_sym("i"),j_sym("j"),m_sym("m"),n_sym("n"); idx i(i_sym,3),j(j_sym,3),m(m_sym,3),n(n_sym,3); wildcard i_(0),j_(1),m_(2),n_(3); ex e1 = indexed(Y,sy_symm(),i,m,n)*indexed(t,n,j); e1 = e1.subs(indexed(Y,sy_symm(),idx(i_,3),idx(m_,3),idx(n_,3)) *indexed(t,idx(n_,3),idx(j_,3)) ==indexed(Y,sy_symm(),idx(j_,3),idx(n_,3),idx(m_,3)) *indexed(t,idx(n_,3),idx(i_,3)), subs_options::subs_algebraic); cout << e1 << endl; return 0; }
Hi! On Fri, Jun 27, 2003 at 06:06:13PM +0800, Yong Xiao wrote:
indexed(Y,sy_symm(),i_,m_,n_)*indexed(t,n_,j_) ==indexed(Y,sy_symm(),j_,n_,m_)*indexed(t,n_,i_)
This assumes that the first index ('n') of the 't' is equal to the last index of the 'Y'. However, with sy_symm(), GiNaC will rearrange the indices into a canonical, but unpredictable, order. So you have to drop the sy_symm() in the subs() and provide a list of substitutions for all three possible positions of the common index 'n_' in 'Y'. You also don't need the subs_algebraic. Bye, Christian -- / Physics is an algorithm \/ http://www.uni-mainz.de/~bauec002/
participants (2)
-
Christian Bauer
-
Yong Xiao