def testlorentz(self): mu=g.varidx(g.symbol("mu"),4) e=g.delta_tensor(g.varidx(0,4),mu.toggle_variance())*\ g.lorentz_g(mu,g.varidx(0,4)) self.assertEqual(e.simplify_indexed(),1) e=g.delta_tensor(g.varidx(0,4),mu.toggle_variance())*\ g.lorentz_g(mu,g.varidx(0,4),True) self.assertEqual(e.simplify_indexed(),-1)
def testdelta(self): i=g.idx(g.symbol("i"),3) j=g.idx(g.symbol("j"),3) k=g.idx(g.symbol("k"),3) l=g.idx(g.symbol("l"),3) A=g.symbol("A") B=g.symbol("B") e=g.indexed(A,i,j)*g.indexed(B,k,l)*g.delta_tensor(i,k)*\ g.delta_tensor(j,l) self.assertEqual((e-g.indexed(A,k,l)*g.indexed(B,k,l)). simplify_indexed(),0) self.assertEqual((e-g.indexed(B,k,l)*g.indexed(A,k,l)). simplify_indexed(),0) self.assertEqual((e-g.indexed(A,i,l)*g.indexed(B,i,l)). simplify_indexed(),0) self.assertEqual((e-g.indexed(A,i,j)*g.indexed(B,i,j)). simplify_indexed(),0) self.assertNotEqual((e-g.indexed(A,i,i)*g.indexed(B,k,k)). simplify_indexed(),0) self.assertEqual(g.delta_tensor(i,i),3) self.assertNotEqual(g.delta_tensor(i,i),4)
def testmetric(self): mu=g.varidx(g.symbol("mu"),4) nu=g.varidx(g.symbol("nu"),4) rho=g.varidx(g.symbol("rho"),4) A=g.symbol("A") e=g.metric_tensor(mu,nu)*g.indexed(A,nu.toggle_variance(),rho) self.assertEqual(e.simplify_indexed(),g.indexed(A,mu,rho)) self.assertNotEqual(e.simplify_indexed(),g.indexed(A,nu,rho)) e=g.delta_tensor(mu,nu.toggle_variance())*g.metric_tensor(nu,rho) self.assertEqual(e.simplify_indexed(),g.metric_tensor(mu,rho)) e=g.metric_tensor(mu.toggle_variance(),nu.toggle_variance())*\ g.metric_tensor(nu,rho) self.assertEqual(e.simplify_indexed(), g.delta_tensor(mu.toggle_variance(),rho)) e=g.metric_tensor(nu.toggle_variance(),rho.toggle_variance())*\ g.metric_tensor(mu,nu)*(g.delta_tensor(mu.toggle_variance(),rho)+\ g.indexed(A,mu.toggle_variance(),rho)) self.assertEqual((e-(4+g.indexed(A,rho.toggle_variance(),rho))). simplify_indexed(),0)