edahl

20 Reputation

4 Badges

7 years, 73 days

MaplePrimes Activity


These are questions asked by edahl

When running this code in Maple 13 and 16 this works just fine,

GenMs:= (k::posint)-> assign(m||(1..2*k) =~ seq([dx||i, dy||i][], i= 1..k)):
GenMs(k), m || (1 .. 2*k);
gln := evalDG(l1 &s n1+`&s`(l2, n2)+sum('epsilon || i'*(cat(m, 2*i-1) &s cat(m, 2*i-1)+cat(m, 2*i) &s cat(m, 2*i)), i = 1 .. k));

But running the same code in Maple 2018 I get the following error:

Error, (in DifferentialGeometry:-Tensor:-SymmetrizeIndices) expected 1st argument to be a tensor. Received: `m2*i-1`^2

I don't know if it's related to Maple 2018 screwing with my tensor formatting:
https://gyazo.com/88eaeceda2e36cf411df44dbc4aa3ab6

(compare https://gyazo.com/b33396131165d66bbcf16e45d20cc579)

For whatever reason I just noticed that my inline &t's have been turned into `&t` but that's a separate issue.

In the same vein as my last question, I need to bang out function symbols depending on a variable list of parameters, and refer to them later. I'm currently doing this:

PW > FunGen := symb -> PDETools[declare](symb(w1, w2, x1, y1), symb);
F > F0 := [b, seq(cat(r, i), i = 1 .. k), seq(cat(s, i), i = 1 .. k)];
                          [b, r1, s1]
PW > map(FunGen, F0);
          b(w1, w2, x1, y1) will now be displayed as b
         r1(w1, w2, x1, y1) will now be displayed as r1
         s1(w1, w2, x1, y1) will now be displayed as s1
F > dx := i -> 'eval(cat(dx, i))';
dy := i -> eval(cat(dy, i));
r := i -> parse(cat(r, i, "(w1,w2,x1,y1)"));
s := i-> parse(cat(s, i, "(w1,w2,x1,y1)"));
epsilon := i -> cat(epsilon, i);
F > bb := parse(cat(b, "(w1,w2,x1,y1)"));

I generate the function aliases for r,s,b depending on w1,w2,x1,y1, and refer to them later with 'r(i)', 's(i)' and bb. In general however, the number of x's and y's is variable (depending on k).

What I would like to do is something like

F > args := w1, w2, seq([x || i, y || i][], i = 1 .. k);
                         w1, w2, x1, y1
PW > FunGen := symb -> PDETools[declare](symb(args), symb)
r := i -> (cat(r, i)(args)
...

This does now however work, even though cat(r, i)(args) on a standalone line does indeed produce ri(w1, w2, x1, y1) and correctly parses to r1, etc.

I have a parameter k and I'm simply trying to make a list of symbols m1,m2...,m2(k-1),m2k to which I'm attempting to assign dx1,dy1,...,dxk,dyk. I've tried

m := i -> 'parse(cat(m, i))'

dx:= i->'eval(cat(dx,i))'

dy:=i ->'eval(cat(dy,i))'

PW > ms := eval(seq(op([m(2*i-1), m(2*i)]), i = 1 .. k));
PW > xys := eval(seq(op([dx(i), dy(i)]), i = 1 .. k));
F > assign(ms = xys);

for loops, $ expressions, and I feel just about anything else but I can't seem to resolve this rather basic issue.

 

I'm working with tensors using the DifferentialGeometry package (not yet checked out the Physics package since I plan on working with Lie algebras), and in particular I'm computing the Riemann tensor of a metric.

Raising the first index of CurvatureTensor(g), the Riemann tensor has the symmetries of a symmetric product of two 2-forms, and this is how I would like to present it, identifying terms like dw1dw2dw1dw2 with terms like dw1dw2dw2dw1 with the appropriate sign. Ideally I would arrive at an expression that is written in terms of (dw1^dw2) (dw1^dw2) (etc.) basis elements, provided that my tensor has these symmetries.

Is there some readily available functionality to do this, or a simple, standard method in Maple?

I'm quite new to Maple but need it for work. I'm trying to work with metric tensors, and for easy examples it does work. For instance, such as here: https://gyazo.com/730e055f3393956ffe41427e11fa1b43

 

For more complicated problems I come into problems of recognising my tensors as actual metrics. In particular here: https://gyazo.com/58347c676b98ddf99275eea8cfecc69d

 

What am I doing wrong here? Is there some trick I'm missing, am I giving the data incorrectly?

 

Thank you,

Eivind

 

PS: For convenience I'm dumping the document in text format here:

 

> restart;
> with(PDETools); with(DifferentialGeometry); with(Tools); with(Tensor);
> k := 4;
                               4
> C := [w1, w2, z1, z2, seq(cat(x, i), i = 1 .. k), seq(cat(y, i), i = 1 .. k)];
        [w1, w2, z1, z2, x1, x2, x3, x4, y1, y2, y3, y4]
> DGsetup(C, PW, quiet);
                         frame name: PW
PW > F := [b, seq(cat(r, i), i = 1 .. k), seq(cat(s, i), i = 1 .. k)];
              [b, r1, r2, r3, r4, s1, s2, s3, s4]
PW > FunGen := proc (symb) options operator, arrow; PDETools[declare](symb(w1, w2), symb) end proc;
PW > map(FunGen, F);
              b(w1, w2) will now be displayed as b
             r1(w1, w2) will now be displayed as r1
             r2(w1, w2) will now be displayed as r2
             r3(w1, w2) will now be displayed as r3
             r4(w1, w2) will now be displayed as r4
             s1(w1, w2) will now be displayed as s1
             s2(w1, w2) will now be displayed as s2
             s3(w1, w2) will now be displayed as s3
             s4(w1, w2) will now be displayed as s4
PW > NULL;
PW > dx := proc (i) options operator, arrow; 'eval(cat(dx, i))' end proc;
PW > dy := proc (i) options operator, arrow; 'eval(cat(dy, i))' end proc;
PW > r := proc (i) options operator, arrow; cat(r, i) end proc;
PW > s := proc (i) options operator, arrow; cat(s, i) end proc;
PW > epsilon := proc (i) options operator, arrow; cat(epsilon, i) end proc;
PW > L1 := [1, b, seq(r(i), i = 1 .. k), seq(s(i), i = 1 .. k), seq(epsilon(i), i = 1 .. k)];
  [1, b, r1, r2, r3, r4, s1, s2, s3, s4, epsilon1, epsilon2,

    epsilon3, epsilon4]
PW > g := evalDG(`&s`(dw1, dz2)+`&s`(dw2, dz2)+b*(`&s`(dw1, dw1)+`&s`(dw2, dw2))+sum('r(i)'*(`&s`(dx(i), dw1)+`&s`(dy(i), dw2)), i = 1 .. k)+sum('s(i)'*(`&s`(dx(i), dw2)-`&s`(dx(i), dw1)), i = 1 .. k)+sum('epsilon(i)'*(`&s`(dx(i), dx(i))+`&s`(dy(i), dy(i))), i = 1 .. k));
_DG([["tensor", PW, [["cov_bas", "cov_bas"], []]], [

  [[1, 1], 2 b], [[1, 4], 1], [[1, 5], -s1 + r1],

  [[1, 6], -s2 + r2], [[1, 7], -s3 + r3], [[1, 8], -s4 + r4],

  [[2, 2], 2 b], [[2, 4], 1], [[2, 5], s1], [[2, 6], s2],

  [[2, 7], s3], [[2, 8], s4], [[2, 9], r1], [[2, 10], r2],

  [[2, 11], r3], [[2, 12], r4], [[4, 1], 1], [[4, 2], 1],

  [[5, 1], -s1 + r1], [[5, 2], s1], [[5, 5], 2 epsilon1],

  [[6, 1], -s2 + r2], [[6, 2], s2], [[6, 6], 2 epsilon2],

  [[7, 1], -s3 + r3], [[7, 2], s3], [[7, 7], 2 epsilon3],

  [[8, 1], -s4 + r4], [[8, 2], s4], [[8, 8], 2 epsilon4],

  [[9, 2], r1], [[9, 9], 2 epsilon1], [[10, 2], r2],

  [[10, 10], 2 epsilon2], [[11, 2], r3], [[11, 11], 2 epsilon3],

  [[12, 2], r4], [[12, 12], 2 epsilon4]]])
PW > Gam := Christoffel(g);
Error, (in DifferentialGeometry:-Tensor:-Christoffel) expected 1st argument to be a metric tensor. Received: _DG([["tensor", PW, [["cov_bas", "cov_bas"], []]], [`...`]])
PW > Ric := RicciScalar(g);
Error, (in DifferentialGeometry:-Tensor:-RicciScalar) expected 1st argument to be metric tensor. Received: _DG([["tensor", PW, [["cov_bas", "cov_bas"], []]], [`...`]])
PW > CovariantDerivative(g, Gam);
Error, (in DifferentialGeometry:-Tensor:-CovariantDerivative) expected 2nd argument to be an affine connection. Received: Gam
PW > LieDerivative(D_x, g);
Error, (in DifferentialGeometry:-LieDerivative) expected 1st argument to be a vector field. Received D_x
PW > CurvatureTensor(g);
Error, (in DifferentialGeometry:-Tensor:-CurvatureTensor) expected 1st argument to be a metric tensor or an  affine connection. Received: _DG([["tensor", PW, [["cov_bas", "cov_bas"], []]], [`...`]])
PW >

 

Page 1 of 1