File: formQ0.mac

package info (click to toggle)
maxima 5.47.0-9
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 193,104 kB
  • sloc: lisp: 434,678; fortran: 14,665; tcl: 10,990; sh: 4,577; makefile: 2,763; ansic: 447; java: 328; python: 262; perl: 201; xml: 60; awk: 28; sed: 15; javascript: 2
file content (56 lines) | stat: -rw-r--r-- 1,986 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* formQ0: Evaluate trace-free decomposition of a symmetric tensor.
 *
 * Usage: Q0(Q);
 *
 * parameters: Q: itensor expression
 *
 * Given the tensor Q that is fully symmetric in all indices, this
 * function returns the corresponding STF tensor.
 *
 * Side effects: None.
 *
 * Example:
 *
 * (%i1) load("formQ0.mac")$
 * (%i2) load(itensor)$
 * (%i3) dim:3$
 * (%i4) decsym(g,0,2,[],[sym(all)])$
 * (%i5) imetric(g)$
 * (%i6) flipflag:true$
 * (%i7) defcon(Q,Q,Q)$
 * (%i8) decsym(Q,0,3,[],[sym(all)])$
 * (%i9) ishow(canform('kdels([a,b,c],[j,k,l])*Q0(Q([],[a,b,c]))))$
 *                                          %1  %2 %3      j k l
 *                                       3 Q   g      kdels
 *              %1 %2 %3      j k l                        %1 %2 %3
 * (%t9)       Q         kdels         - --------------------------
 *                            %1 %2 %3               5
 *
 * (c) 2021 Viktor T. Toth (https://www.vttoth.com/)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be
 * useful, but WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE.  See the GNU General Public License for more details.
 */

Q0(_Q):=block
([_a,_k,_i,_j,_l,_g],
  _a:indices(_Q)[1],
  _k:length(_a),
  _g:ev(imetric),
  _Q+canform(contract(sum(
    (-1/2)^_p*(dim+2*_k-2*(_p+2))!!/_p!/(_k-2*_p)!/(dim+2*_k-4)!!
    *canform(contract(expand(
    kdels(makelist(concat('_i,_j),_j,1,_k),_a)
    *prod(_g([],[concat('_i,2*_i-1),
    concat('_i,2*_i)])*_g([concat('_j,2*_i-1),concat('_j,2*_i)]),_i,1,_p)
    *sublis(makelist(_a[_l]=(flatten([makelist(concat('_j,_i),_i,1,2*_p),
    makelist(concat('_i,_i),_i,2*_p+1,_k)]))[_l],_l,1,_k),_Q)))),
  _p,1,_k/2)))
)$