Question: bizarre bug in Physics tensor manipulation

Here's a short tensor manipulation which goes totally bananas. Basically I have a metric, and I define a vector k, and right at the end I calcualte the covariant derivative of it. In the metric and elsewhere I have a constant epsilon, a function of time a(t), and 2 functions of all coords, Phi and psi. Then at the end it gives the covariant derivative of k, but now with epsilon and a as functions of all coordinates. 

Any idea what's going on??

 

code:

 

restart;
with(Physics);with(PDEtools):
Setup(coordinatesystems=spherical);

ds2:=expand(a(t)^2*(-(1+2*epsilon*Phi(r,theta,phi,t))*dt^2+(1-2*epsilon*psi(r,theta,phi,t))*(dr^2+r^2*dtheta^2+r^2*sin(theta)^2*dphi^2)));
declare(%,(H)(t),(k0,k1,k2,k3)(X));
Setup(metric = ds2);

Define(k[~mu]=[-1/a(t)^2+epsilon*k1(X),epsilon*k2(X),epsilon*k3(X),1/a(t)^2+epsilon*k0(X)]);

Define(NullGDE[nu]=(k[~mu](X)*D_[mu](k[nu](X))),OpticalDeformationMatrix[mu,nu]=(D_[mu](k[nu](X))));

(OpticalDeformationMatrix[1,1,nonzero]);

 

the final output is Matrix(1, 1, [[(-(2*((diff(epsilon(X), r))*(psi(X))(X))+2*epsilon(X)*(diff((psi(X))(X), r)))*(epsilon(X)*(k1(X))(X)*((a(t))(X)^2)-1)*a(t)-(2*epsilon(X)*(psi(X))(X)-1)*((diff(epsilon(X), r))*(k1(X))(X)*((a(t))(X)^2)+epsilon(X)*((diff((k1(X))(X), r))*((a(t))(X)^2))+2*epsilon(X)*(k1(X))(X)*(a(t))(X)*(diff((a(t))(X), r)))*a(t)+epsilon*psi[r]*(epsilon*k1(X)*(a(t)^2)-1)*a(t)-epsilon^2*psi[theta]*(a(t)^3)*k2(X)-epsilon^2*psi[phi]*(a(t)^3)*k3(X)-(2*(diff(a(t), t))*psi(X)*epsilon+psi[t]*a(t)*epsilon-(diff(a(t), t)))*(epsilon*k0(X)*(a(t)^2)+1))*(1/a(t))]])

where epsilon is now a function!

 

 

 

Please Wait...