Question: keep contravariant tensor (Physics)

restart;

with(VectorCalculus);

x := Vector([VectorCalculus:-`*`(VectorCalculus:-`+`(R, VectorCalculus:-`*`(r, cos(p))), cos(t)), VectorCalculus:-`*`(VectorCalculus:-`+`(R, VectorCalculus:-`*`(r, cos(p))), sin(t)), VectorCalculus:-`*`(r, sin(p))]);

s := [p, t];

g := Matrix(nops(s), nops(s));

for i to nops(s) do

for j to nops(s) do

g[i, j] := simplify(DotProduct(diff(x, s[i]), diff(x, s[j])))

end do

end do;

g;

with(Physics);

Setup(dimension = 2);

Coordinates(X = s);

Setup(metric = g);

g_[];

g_[mu, nu].Ricci[mu, nu]

 

I have one question already here: In the last step I calculate the Riemann-Scalar.

I was wondering if also this works:

SubstituteTensorIndices({rho = mu, sigma = nu}, Riemann[mu, nu, rho, sigma, Array])

but it is kinda weird. The LHS is the expression I want and the RHS keeps this Array format. What do I need to specify instead of Array in order for this to work properly...

 

Original Question:

Further I do the following...

Define(A[mu], F);

F[mu, nu] := D_[mu](A[nu](X));

g_[mu, nu].F[`~mu`, `~nu`];

SumOverRepeatedIndices(%);

SubstituteTensorIndices(nu = `~mu`, F[mu, nu]);

SumOverRepeatedIndices(%)

 

The first result using g_[mu,nu] gives me a contravariant D_ and a covariant A while the second approach (SubstituteTensorIndices) gives me the same result with D_ being covariant and A now being contravariant.

I tried to enforce the contravariance with `~mu` but it didn't work.

So is there a way to enforce this?

 

 

A last question:

If I replace D_ above by d_ the partial derivatives do not expand out.

What is the reason for this?

Similarly

Christoffel[mu, nu, nu].A[mu];

SumOverRepeatedIndices(%)

does not give me the real expression in terms of each component A[1] and A[2] the first time I use SumOverRepeatedIndices...I need to do it twice, why is that?

 

 

 

 

 

 

 

 

I'm also happy about general advices to improve the way I implemented everything.

Like is there any meaning for signature() if I specify the metric as I did above?

What is better to use here: Physics or Tensor Package?

Please Wait...