forked from xAct-contrib/xPand
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xPand.m
3152 lines (2002 loc) · 173 KB
/
xPand.m
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(* ::Package:: *)
(************************************************************************)
(* This file was generated automatically by the Mathematica front end. *)
(* It contains Initialization cells from a Notebook file, which *)
(* typically will have the same name as this file except ending in *)
(* ".nb" instead of ".m". *)
(* *)
(* This file is intended to be loaded into the Mathematica kernel using *)
(* the package loading commands Get or Needs. Doing so is equivalent *)
(* to using the Evaluate Initialization Cells menu command in the front *)
(* end. *)
(* *)
(* DO NOT EDIT THIS FILE. This entire file is regenerated *)
(* automatically each time the parent Notebook file is saved in the *)
(* Mathematica front end. Any changes you make to this file will be *)
(* overwritten. *)
(************************************************************************)
xAct`xPand`$Version={"0.4.3",{2018,04,28}};
xAct`xPand`$xTensorVersionExpected={"1.1.3",{2018,2,28}};
xAct`xPand`$xPertVersionExpected={"1.0.6",{2018,2,28}};
(* xPand: Cosmological perturbations about homogeneous space-times *)
(* Copyright (C) 2012-2018 Cyril Pitrou, Xavier Roy and Obinna Umeh *)
(* 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.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place-Suite 330, Boston, MA 02111-1307,
USA.
*)
(* :Title: xPand *)
(* :Author: Cyril Pitrou, Xavier Roy and Obinna Umeh *)
(* :Summary: Computer algebra for cosmological perturbations around homogenous space-times *)
(* :Brief Discussion:
- Background 3+1 splitting of space-time;
- Spatial sections are homogeneous (Friedmann-Lemaitre or Bianchi of all types) *)
(* :Context: xAct`xPand` *)
(* :Package Version: 0.4.3 *)
(* :Copyright: Cyril Pitrou, Xavier Roy and Obinna Umeh (2012-2018) *)
(* :History: see xPand.History *)
(* :Keywords: *)
(* :Source: xPand.nb *)
(* :Warning: *)
(* :Mathematica Version: 7.0 and later *)
(* :Limitations: *)
If[Unevaluated[xAct`xCore`Private`$LastPackage]===xAct`xCore`Private`$LastPackage,xAct`xCore`Private`$LastPackage="xAct`xPand`"];
Off[General::nostdvar]
Off[General::nostdopt]
BeginPackage["xAct`xPand`",{"xAct`xPert`","xAct`xTensor`","xAct`xPerm`","xAct`xCore`","xAct`ExpressionManipulation`"}]
If[Not@OrderedQ@Map[Last,{$xTensorVersionExpected,xAct`xTensor`$Version}],Throw@Message[General::versions,"xTensor",xAct`xTensor`$Version,$xTensorVersionExpected]]
If[Not@OrderedQ@Map[Last,{$xPertVersionExpected,xAct`xPert`$Version}],Throw@Message[General::versions,"xPert",xAct`xPert`$Version,$xPertVersionExpected]]
Print[xAct`xCore`Private`bars];
Print["Package xAct`xPand` version ",$Version[[1]],", ",$Version[[2]]];
Print["CopyRight (C) 2012-2018, Cyril Pitrou, Xavier Roy and Obinna Umeh under the General Public License."];
Off[General::shdw]
xAct`xPand`Disclaimer[]:=Print["These are points 11 and 12 of the General Public License:\n\nBECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM `AS IS\.b4 WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\nIN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES."]
On[General::shdw]
If[xAct`xCore`Private`$LastPackage==="xAct`xPand`",
Unset[xAct`xCore`Private`$LastPackage];
Print[xAct`xCore`Private`bars];
Print["These packages come with ABSOLUTELY NO WARRANTY; for details type Disclaimer[]. This is free software, and you are welcome to redistribute it under certain conditions. See the General Public License for details."];
Print[xAct`xCore`Private`bars]];
$CovDFormat="Prefix";
Message[General::nostdvar,"$CovDFormat","Prefix"];
(*** VERSIONS ***)
$Version::usage="$Version is a global variable giving the version of the package xPand in use.";
$xTensorVersionExpected::usage="$xTensorVersionExpected is a global variable giving the oldest possible version of the package xTensor which is required by the version of the package xPand in use.";
$xPertVersionExpected::usage="$xPertVersionExpected is a global variable giving the oldest possible version of the package xPert which is required by the version of the package xPand in use.";
(*** BOOLEANS ***)
BackgroundFieldMethod::usage = "BackgroundFieldMethod is a boolean option, set by default to 'False'. If set to 'True', then only the first order of the metric perturbation is kept, and it therefore stands for the total metric perturbation.
This option should be placed at the begining of the notebook, right after loading the xPand package.";
(* Recently implemented. Does not work correctly. CP needs to fix that. To be checked... *)
$CacheRules::usage = "If set to 'True', the rules are remembered. This is potentially dangerous, so default is 'False'.";
(* This is obsolete. This will have to be erased. *)
$ConformalTime::usage = "If set to 'True' (default value), then the prime ' stands for the Lie derivative along the vector 'n' normal to the spatial slices. If the time coordinate is taken to be the proper time of the Eulerian observers (identified by the normal vector), then the Lie derivative along 'n' corresponds to the partial time derivative with respect to the conformal time, namely: \!\(\*SubscriptBox[\(\[ScriptCapitalL]\), \(n\)]\) .. = \[PartialD]/\[PartialD]\[Eta] .. .
The second Label-Index (LI) of projected tensors represents the number of Lie derivatives along 'n' that are applied to them. It also corresponds to the number of partial derivatives with respect to conformal time.
In the cases for which we prefer to use the cosmic time, we can choose to employ the second LI not for the number of \!\(\*SubscriptBox[\(\[ScriptCapitalL]\), \(n\)]\), but rather for the number of 1/a \!\(\*SubscriptBox[\(\[ScriptCapitalL]\), \(n\)]\), where 'a' is the scale factor. This is done by setting '$ConformalTime' to 'False'. The label index then indicates a derivative with respect to cosmic time.
The output format of the second LI is a prime for a conformal time derivative, and a dot for a cosmic time derivative.";
$FirstOrderVectorPerturbations::usage = "Boolean option to decide if first order vector modes should be included. Default is 'True'.";
$FirstOrderTensorPerturbations::usage = "Boolean option to decide if first order tensor modes should be included. Default is 'True'.";
$OpenConstantsOfStructure::usage = "Boolean value to decide if the constants of structure should be parameterized as in Ellis & MacCallum (1969). If 'False', then the constants of structure are kept general. If 'True', then the parameterization is: \!\(\*SubscriptBox[SuperscriptBox[\(C\), \(i\)], \(\(jk\)\(\\\ \)\)]\)= \!\(\*SubscriptBox[\(\[Epsilon]\), \(jkl\)]\)\!\(\*SuperscriptBox[\(N\), \(li\)]\) + \!\(\*SubscriptBox[\(A\), \([j\)]\)\!\(\*SubscriptBox[SuperscriptBox[\(\[Delta]\), \(i\)], \(\(k\)\(]\)\)]\).";
$SortCovDAutomatic::usage = "Boolean value to decide whether or not xTensor should commute automatically the induced derivatives. Default is 'True' in order to optimize the canonicalization of expression. Note that some adhoc commutation relations defined in '$CommutecdRules' are also applied in order to enforce the transverse properties of vector and tensor fields, on the one hand, and the appearance of Laplacians, on the other hand.";
(*** ERROR MESSAGES ***)
(** SetSlicing **)
SetSlicing::dimension = "The dimension of the manifold is `1`; it is too small to perform a slicing.";
SetSlicing::invalidnormalvector = "The normal vector `1` used to perform the background slicing should have only one index, belonging to the VBundle of the manifold. To avoid issues, it is possible to not predefine the normal vector and let the function SetSlicing define it automatically.";
(********** The following error message is not yet used. **********)
SetSlicing::ninds = "The number of indices is insufficient to define the (N-1)+1 splitting. Use at least `1` indices.";
SetSlicing::noambientmetric = "The ambient metric `1` was not previously defined as a metric. Define an ambient metric first, and then call SetSlicing.";
(********** The following error message does not seem correct. It should be modified. **********)
SetSlicing::signature = "The signature of the metric `1` should be -1 in order to perform a (N-1)+1 background splitting along a time-like vector. This comes from the fact that in the current version, the norm of the time-like vectors is fixed to -1.";
(** DefProjectedTensor **)
(********** The following error message is not used anymore. **********)
DefProjectedTensor::invalidindices = "No label-index needs to be given for the definition of projected tensors. They are automatically added by subroutines.";
DefProjectedTensor::notdownindices = "In order to be defined, the projected tensor `1` has to be written with down indices.";
(** DefProjectedTensorProperties **)
DefProjectedTensorProperties::symmetrictensors="The current version of DefProjectedTensorProperties can only add properties to tensors that are, at least, fully symmetric.";
(** ExtractComponents **)
ExtractComponents::invalidprojector = "One of the projectors in `1` is not valid. The possible projectors are: 'Time' or '*NameOfNormalVector*', and 'Space' or '*NameOfInducedMetric*'.";
(** RulesSplitCovDsOfTensor **)
RulesSplitCovDsOfTensor::maxcovdnumber = "The number of CovDs was larger than `1`. The last (optional) argument of RulesSplitCovDsOfTensor needs to be set to a larger value in order to split correctly all covariant derivatives.";
(** ToxPand **)
(********** The following two error messages are not yet edited. The first one is not referred to, and the utility of the second one has to be discussed. **********)
ToxPand::invalidindices = "Incorrect indices for tensor `1`";
ToxPand::invalidconffactor = "A conformal factor should have two label indices, one for the perturbation order which is always zero, and one for the number of Lie derivatives along u. And in the argument of SplitGaugeChange, you need only to put the name of the conformal factor (this is not a[LI[0],LI[0]] but just a).";
xPand::makeboxes = "For anisotropic manifolds, the second label-index can be only interpreted as a Lie derivative for indices down.";
(*** FUNCTIONS ***)
SetSlicing::usage = "SetSlicing[g,n,nNorm,h,cd,{cdPost,cdPre},SpaceTimeType].
Given a background manifold of dimension 'N' and an ambient metric 'g' on that manifold, this function performs a (N-1)+1 slicing.
More precisely, it builds the induced metric 'h' on the hypersurfaces, the associated covariant derivative 'cd', and the vector 'n' normal to these hypersurfaces. It also sets the type 'SpaceTimeType' for the hypersurfaces. The latter argument can take a value among {Anisotropic, BianchiB, BianchiA, BianchiI, FLCurved, FLFlat, Minkowski}. The norm 'nNorm' of the vector 'n' is set by default to -1 if omitted.";
$CommutecdRules::usage = "Set of remembered rules for the commutation of the induced derivatives of the hypersurfaces. This is used to handle the successive operations of two, three or four induced derivatices.";
Conformal::usage = "Conformal[metricfinal][metric1,metric2][expr] performs a conformal transformation of 'expr' from 'metric1' to 'metric2' and expresses the result in terms of 'metricfinal' (along with its associated covariant derivative and curvature tensors). If needed, the function first reformulates 'expr' in terms of 'metric1'. The two metrics 'metric1' and 'metric2' have to be conformally related by DefConformalMetric.
Conformal[metric1,metric2][expr] provides the final result with respect to the ambient metric, which is the first metric defined on the manifold.";
ConformalWeight::usage = "ConformalWeight[tensor[inds]] specifies the power of the conformal factor applied in the conformal transformation of the tensor 'tensor'. It corresponds to the number of down indices, minus the number of up indices, plus the quantity ConformalWeight[tensor] (without the indices). The latter is set by default to zero.
For instance, in the setting ConformalWeight[tensor] = 0, we have: ConformalWeight[tensor[\[Alpha],\[Beta]]] = -2, and ConformalWeight[tensor[-\[Alpha],-\[Beta]]] = 2.";
DefConformalMetric::usage = "DefConformalMetric[g,S] defines a metric conformally related to 'g', with the conformal factor 'S'. The new metric is named 'gS2', and its inverse is given by 'Inv[gS2]'. If other metrics are conformally related to 'g', then 'gS2' is related to them by transitivity of the conformal transformation.
When calling the function SetSlicing, the conformal factor is chosen to be the scale factor 'a[h]' (or, equivalently, 'ah'). The constructed metric 'gah2' then corresponds to the 'real' background metric (i.e. the one that would be obtained from the physical metric of the manifold).";
DefMetricFields::usage = "DefMetricFields[g,gpert,h,parameter] defines the perturbed metric 'gpert' from its background value 'g'. The argument 'h' is the induced metric on the spatial hypersurfaces, and the optional argument 'parameter' (set by default to \[Epsilon]) is the symbol used in the perturbative expansions. Several tensors that are used to decompose 'gpert' are defined when calling this function.";
DefMatterFields::usage = "DefMatterFields[uf,ufpert,h,parameter] defines the perturbed vector field 'ufpert' from its background value 'uf'. The argument 'h' is the induced metric on the spatial hypersurfaces, and the optional argument 'parameter' (set by default to \[Epsilon]) is the symbol used in the perturbative expansions. Several tensors that are used to decompose 'ufpert' are defined when calling this function.";
DefProjectedTensor::usage = "DefProjectedTensor[Name[inds],h,options] defines a projected tensor on the spatial hypersurfaces.
'Name' refers to the name of the tensor, and 'inds' (which has to be with down indices) defines its rank. The argument 'h' is the induced metric on the spatial hypersurfaces.
There exist 3 types of options.
The first type is: 'TensorProperties', by default set to 'Transverse', 'Traceless' and 'SymmetricTensor'. These can be overwritten with 'TensorProperties->ListOfProperties', where 'ListOfProperties' is a list whose elements can be: 'Transverse', 'Traceless' and 'SymmetricTensor'.
The second option is: 'SpaceTimesOfDefinition', by default set to 'Background' and 'Perturbed'. These can be also overwritten with 'SpaceTimesOfDefinition->SpaceTimesList', where 'SpaceTimesList' is a list whose elements can be: 'Background' and 'Perturbed'.
The last option is: 'PrintAs', by default set to 'Identity'. This can be overwritten with 'PrintAs->String', in order to specify the output form of the tensor." ;
ExtractComponents::usage = "ExtractComponents[expr,h,ListOfProjectors,ListOfFreeIndices] projects 'expr' along its time component(s) (i.e. along the vector normal to the hypersurfaces) and along its space component(s) (i.e. onto the hypersurfaces), being defined by the background slicing associated with the induced metric 'h'.
'ListOfProjectors' is a list whose elements are among: 'Time' (or, equivalently, '*NameOfNormalVector*') and 'Space' (or, equivalently, '*NameOfInducedMetric*'). The length of the list has to equal the rank of the tensors of 'expr'. The free indices (in canonical order) of 'expr' are then projected according to the 'ListOfProjectors'.
'ListOfFreeIndices' is the list of free indices on which the ListOfProjectors is to be applied. If this is omitted, then it is the list of free indices in alphabetic order.
When the argument 'ListOfProjectors' is omitted, all the projections for rank-0 to rank-2 tensors are displayed in a table.";
(********** The following command, ExtractOrder, will have to be re-edited (a check of the command is in order). **********)
ExtractOrder::usage = "ExtractOrder[expr,order] displays the expression at order 'order' of 'expr'.";
IndicesUp::usage = "IndicesUp[expr] raises the indices of all the tensors of 'expr' using the ambient metric.";
IndicesDown::usage = "IndicesDown[expr] lowers the indices of all the tensors of 'expr' using the ambient inverse metric.";
(********** The following command, SplitMatter, will have to be re-edited. **********)
SplitMatter::usage = "SplitMatter[uf,ufpert,normuf,h,gauge,order,tiltspecification] builds the rules to split the perturbed four-velocity 'ufpert' (with index up) in a given 'gauge', and according to the background slicing associated with the induced metric 'h'. The rules are computed to the order 'order'.
'normuf' is the squared norm of the four-velocity 'uf' (usually taken as -1), and the optional argument 'tiltspecification' (set by default to 'NotTilted') allows for a tilt between the fluid four-velocity and the vector normal to the hypersurfaces.
The perturbations of all the fields that depend on 'uf' are also computed.";
(********** The following command, SplitMetric, will have to be re-edited. **********)
SplitMetric::usage = "SplitMetric[g,gpert,h,gauge] builds the rules to split the perturbed metric 'gpert' in a given gauge and according to the background slicing associated with the induced metric 'h'.";
(********* This command was added in version 0.4.2. More documentation is needed and syntax can still evolve ********)
SplitNormalVector::usage = "SplitNormalVector[h,order], where h is an induced metric, and order is the order up to which the perturbations of the normal vector should be computed in function of the perturbed metric. This outputs a list of rules, one for each order of perturbation of the normal vector. All rules are expressed in function of the perturbed metric";
$MyRules::usage = "List of global rules that are remembered by xPand.";
(*ConstantsDecompositionRules::usage = "ConstantsDecompositionRules[h] provides the rules to transform the constants of structure according to the Bianchi type of the homogeneous hypersurfaces associated with the induced metric 'h'. This option is only valid for three-dimensional hypersurfaces.
The parametrization follows Ellis & MacCallum (1969), that is, the constants of structure are decomposed as: Subscript[C^i, jk ]= Subscript[\[Epsilon], jkl]N^li + Subscript[A, [j]Subscript[\[Delta]^i, k]].";*)
ToBianchiType::usage = "ToBianchiType[h][expr] applies to expr the necessary rules to express the constants of structure according to the Bianchi type of the homogeneous hypersurfaces associated with the induced metric 'h'. This option is only valid for three-dimensional hypersurfaces.
The parametrization follows Ellis & MacCallum (1969), that is, the constants of structure are decomposed as: \!\(\*SubscriptBox[SuperscriptBox[\(C\), \(i\)], \(\(jk\)\(\\\ \)\)]\)= \!\(\*SubscriptBox[\(\[Epsilon]\), \(jkl\)]\)\!\(\*SuperscriptBox[\(N\), \(li\)]\) + \!\(\*SubscriptBox[\(A\), \([j\)]\)\!\(\*SubscriptBox[SuperscriptBox[\(\[Delta]\), \(i\)], \(\(k\)\(]\)\)]\).";
(*ConstantsOfStructureRules::usage = "ConstantsOfStructureRules[h].
Given an induced metric h corresponding to a non trivial Bianchi type, ConstantsOfStructureRules[h] gives all the rules to express the Riemann, the Ricci and the Ricci scalar in function of the constants of structure of the spatial sections.";*)
ToConstantsOfStructure::usage = "ToConstantsOfStructure[h][expr].
Given an induced metric h corresponding to a non trivial Bianchi type, ToConstantsOfStructure[h][expr] applies to expr all the rules to express the Riemann, the Ricci and the Ricci scalar in function of the constants of structure of the spatial sections.";
(*(********** The following command, RulesCovDsOfTensor, is not yet defined. **********)
RulesCovDsOfTensor::usage = "";*)
(* ************** *)
ToCosmicTime::usage = "Transforms an expression where the second label index of projected tensor means \!\(\*SubscriptBox[\(\[ScriptCapitalL]\), SuperscriptBox[\(n\), \(\[Alpha]\)]]\), that is a derivative with respect to conformal time, into an expression where the second index means '1/a *\!\(\*SubscriptBox[\(\[ScriptCapitalL]\), SuperscriptBox[\(n\), \(\[Alpha]\)]]\)', that is a derivative with respect to cosmic time. The global variable $ConformalTime is set to False in the process.";
ToConformalTime::usage = "Transforms an expression where the second label index of projected tensor means '1/a * \!\(\*SubscriptBox[\(\[ScriptCapitalL]\), SuperscriptBox[\(n\), \(\[Alpha]\)]]\)', that is a derivative with respect to cosmic time, into an expression where the second index means '\!\(\*SubscriptBox[\(\[ScriptCapitalL]\), SuperscriptBox[\(n\), \(\[Alpha]\)]]\)', that is a derivative with respect to conformal time. The global variable $ConformalTime is set to True in the process.";
(********** The following command, RulesVelocitySpatial, is not yet edited. **********)
RulesVelocitySpatial::usage = "RulesVelocitySpatial[h,uf,duf,NormVectorSquare,gauge,order,tiltedvalue] gives the standard rules for the spatial velocity in a given gauge. h is the induced metric, uf and duf are the fluid velocity and its perturbation. NormVectorSquare is the norm squared of velocity, and gauge is the gauge choice. Order is the order up to which the perturbations are computed. The last argument, which can be '\"Tilted\"' or '\"NotTiled\"' is by default set to \"NotTilted\" and is optional.";
SplitGaugeChange::usage = "SplitGaugeChange[expr,ListPairs,\[Xi],h,order] performs a gauge transformation of order 'order' on 'expr', with a conformal transformation of conformal factor 'a[h]', and splits the result according to the background slicing associated with the induced metric 'h'.
'\[Xi]' is the general vector field used for the gauge transformation. It must have a Label-Index (LI) for the order of perturbation (i.e. it has to be of the form \[Xi][LI[order],index]). 'ListPairs' is the list of rules used for the background slicing.
The theory and formulas for the power expansion of gauge transformation was developed by Bruni et al. in: Class. Quantum Grav. 14, 2585 (1997).";
(********** The following command, SplitFieldsAndGaugeChange, is not yet edited. **********)
SplitFieldsAndGaugeChange::usage = "SplitFieldsAndGaugeChange[expr,g,dg,uf,duf,h,order,tiltspecification] performs a gauge transformation on expr where expr must involve metric perturbations (or curvature tensor associated with this metric) or matter field perturbation such as the fluid velocity, and splits the results according to the most general gauge choice. \nh is the induced metric, and refers to the background n+1 splitting. g is the metric and dg is the metric perturbation. uf is the fluid velocity and duf is the fluid velocity perturbation (when index is up). \n\[Xi] is the general vector field used for the gauge transformation which must have a label index for the order of perturbation (it is of the form \[Xi][LI[order],Index]), and order is the order of the gauge transformation. 'tiltspecification' is optional and by default is \"NotTilted\". \nThe theory and formulas for the power expansion of changes of gauge was developed by Bruni et al. in reference Class. Quantum Grav. 14, 2585 (1997).";
(*SplitPerturbationsOld::usage = "This is the old version of SplitPerturbations. It is obsolete, and it will have to be removed.";*)
SplitPerturbations::usage="SplitPerturbations[expr,ListPairs,h] splits the expression 'expr', using the list of rules 'ListPairs', according to the background slicing associated with the induced metric 'h'.";
(********** The following command, ToMetric, will have to be re-edited after its modification. **********)
ToMetric::usage = "ToMetric[expr,metric] formulates 'expr' in terms of 'metric', and its associated covariant derivative and curvature tensors.";
ToxPand::usage = "ToxPand[expr,gpert,uf,ufpert,h,gauge,order,tiltspecification].
This function first performs on 'expr' a conformal transformation with the scale factor 'a[h]' (except for a Minkowski 'SpaceType'); then it perturbs the result up to the order 'order' by means of xPert tools; and finally, it splits the result using the rules associated with the 'gauge', and according to the background slicing associated with the induced metric 'h'. 'tiltspecification' is optional and by default is \"NotTilted\"
All the perturbed fields are derived from the perturbed metric 'gpert' and the perturbed fluid four-velocity 'ufpert'.
The syntax for multifluid is xPand[expr,gpert,{{uf1,uf1pert},{uf2,uf2pert},...},h,gauge,order,tiltspecification].
";
ToxPandFromRules::usage = "ToxPandFromRules[expr,ListPairs,h,order].
This function first performs on 'expr' a conformal transformation with the scale factor 'a[h]' (except for a Minkowski 'SpaceType'); then it perturbs the result up to the order 'order' by means of xPert tools; and finally, it splits the result using the list of rules 'ListPairs' and according to the background slicing associated with the induced metric 'h'.
Compared to the function ToxPand, the present function requires to give the rules for the splitting of the perturbations.";
VisualizeTensor::usage = "VisualizeTensor[expr,h] displays in a table the projections of 'expr' along its time components (i.e. along the vector normal to the hypersurfaces) and along its space components (i.e. onto the hypersurfaces), being defined by the background slicing associated with the induced metric 'h'.
'expr' has to be an expression involving tensors of rank 2 only.";
(* VisualizeTensor will be put as private, since the function ExtractComponents already handle this. *)
(*** LISTS OF FIELDS ***)
$ListFieldsBackgroundOnly::usage="$ListFieldsBackgroundOnly[h], with 'h' being the induced metric on the hypersurfaces, is the list of fields that live on the background only. It is automatically defined when calling the function SetSlicing.";
$ListFieldsPerturbedOnly::usage="$ListFieldsPerturbedOnly[h], with 'h' being the induced metric on the hypersurfaces, is the list of fields that live on the perturbed manifold only. It contains the metric perturbations. It is automatically defined when calling the function DefMetricFields.";
$ListFieldsBackgroundAndPerturbed::usage="$ListFieldsBackgroundAndPerturbed[h,uf], with 'h' and 'uf' being respectively the induced metric on the hypersurfaces and the fluid four-velocity, is the list of fields that live on the background manifold and that can be perturbed. It is automatically defined when calling the function DefMatterFields.";
(*** PREDEFINED FIELDS: Geometrical quantities ***)
a::usage = "a[h] is the scale factor of the spatial hypersurfaces whose induced metric is given by 'h'. It is automatically defined when calling the function SetSlicing.
The command a[h] also builds the symbol 'ah', so one can use a[h] or, equivalently, ah.
The default printed form of a[h][] is: 'a'.";
H::usage = "H[h] is the Hubble factor of the spatial hypersurfaces whose induced metric is given by 'h'. It is automatically defined when calling the function SetSlicing.
The command H[h] also builds the symbol 'Hh', so one can use H[h] or, equivalently, Hh.
The default printed form of H[h][] is: '\[ScriptCapitalH]'.";
Connection::usage = "Connection[h][index,index,index] are the coefficients of the connection associated with the induced metric 'h'. They are automatically defined when calling the function SetSlicing.
The command Connection[h] builds the symbol 'Connectionh', so one can use Connection[h][index,index,index] or, equivalently, Connectionh[index,index,index].";
CS::usage = "CS[h][index,index,index] are the constants of structure on the hypersurfaces associated with the induced metric 'h'. They are automatically defined when calling the function SetSlicing.
The command CS[h] builds the symbol 'CSh', so one can use CS[h][index,index,index] or, equivalently, CSh[index,index,index].
The default printed form of CS[h][-index,-index,-index] is: '\!\(\*SubscriptBox[\(C\), \(index\\\ index\\\ index\)]\)'.";
nt::usage = "nt[h][index,index] is the symmetric tensor part involved in the decomposition of the constants of structure: \!\(\*SubscriptBox[SuperscriptBox[\(C\), \(i\)], \(\(jk\)\(\\\ \)\)]\)= \!\(\*SubscriptBox[\(\[Epsilon]\), \(jkl\)]\)\!\(\*SuperscriptBox[\(N\), \(li\)]\) + \!\(\*SubscriptBox[\(A\), \([j\)]\)\!\(\*SubscriptBox[SuperscriptBox[\(\[Delta]\), \(i\)], \(\(k\)\(]\)\)]\), in Ellis and MacCallum (1969). It is automatically defined when calling the function SetSlicing for Bianchi space-times of type other then I. The presence as an argument of the induced metric 'h' is reminiscent of the choice of the background slicing.
The command nt[h] builds the symbol 'nth', so one can use nt[h][index,index] or, equivalently, nth[index,index].
The default printed form of nt[h][-index,-index] is: '\!\(\*SubscriptBox[\(N\), \(index\\\ index\)]\)'.";
av::usage = "av[h][index] is the 'vector' part involved in the decomposition of the constants of structure: \!\(\*SubscriptBox[SuperscriptBox[\(C\), \(i\)], \(\(jk\)\(\\\ \)\)]\)= \!\(\*SubscriptBox[\(\[Epsilon]\), \(jkl\)]\)\!\(\*SuperscriptBox[\(N\), \(li\)]\) + \!\(\*SubscriptBox[\(A\), \([j\)]\)\!\(\*SubscriptBox[SuperscriptBox[\(\[Delta]\), \(i\)], \(\(k\)\(]\)\)]\), in Ellis & MacCallum (1969). It is automatically defined when calling the function SetSlicing for Bianchi space-times of type other than I. The presence as an argument of the induced metric 'h' is reminiscent of the choice of the background slicing.
The command av[h] builds the symbol 'avh', so one can use av[h][index] or, equivalently, avh[index].
The default printed form of av[h][-index] is: '\!\(\*SubscriptBox[\(A\), \(index\)]\)'.";
\[ScriptK]::usage = "\[ScriptK][h] is the (constant) curvature parameter of the isotropic and homogeneous hypersurfaces associated with the induced metric 'h'. It is automatically defined when calling the function SetSlicing for Friedmann-Lemaitre cosmologies.
The command \[ScriptK][h] also builds the symbol '\[ScriptK]h', so one can use \[ScriptK][h] or, equivalently, \[ScriptK]h.
The default printed form of \[ScriptK][h][] is: \[ScriptK].";
(*** PREDEFINED FIELDS: Scalar field and fluid quantities ***)
\[CurlyPhi]::usage = "\[CurlyPhi][LI[p],LI[q]] is a general scalar field, automatically defined when calling the function DefMatterFields.
The first Label-Index (LI) gives the order 'p' of '\[CurlyPhi]' (hence, for p = 0, '\[CurlyPhi]' corresponds to the background value of the scalar field). The second LI represents the number 'q' of Lie derivatives along the vector normal to the hypersurfaces acting on the 'p'-order of '\[CurlyPhi]'.
The commands \[CurlyPhi][] and \[CurlyPhi][LI[p]] are defined to be equal to \[CurlyPhi][LI[0],LI[0]] and \[CurlyPhi][LI[p],LI[0]], respectively.";
\[Rho]::usage = "\[Rho][uf][LI[p],LI[q]] is the energy density of the fluid, automatically defined when calling the function DefMatterFields. It depends on the fluid four-velocity 'uf'.
The first Label-Index (LI) gives the order 'p' of '\[Rho]' (hence, for p = 0, '\[Rho]' corresponds to the background value of the energy density). The second LI represents the number 'q' of Lie derivatives along the vector normal to the hypersurfaces acting on the 'p'-order of '\[Rho]'.
The commands \[Rho][uf][] and \[Rho][uf][LI[p]] are defined to be equal to \[Rho][uf][LI[0],LI[0]] and \[Rho][uf][LI[p],LI[0]], respectively.
The command \[Rho][uf] builds the symbol '\[Rho]uf', so one can use \[Rho][uf][LI[p],LI[q]] or, equivalently, \[Rho]uf[LI[p],LI[q]].";
P::usage = "P[uf][LI[p],LI[q]] is the pressure of the fluid, automatically defined when calling the function DefMatterFields. It depends on the fluid four-velocity 'uf'.
The first Label-Index (LI) gives the order 'p' of 'P' (hence, for p = 0, 'P' corresponds to the background value of the pressure). The second LI represents the number 'q' of Lie derivatives along the vector normal to the hypersurfaces acting on the 'p'-order of 'P'.
The commands P[uf][] and P[uf][LI[p]] are defined to be equal to P[uf][LI[0],LI[0]] and P[uf][LI[p],LI[0]], respectively.
The command P[uf] builds the symbol 'Puf', so one can use P[uf][LI[p],LI[q]] or, equivalently, Puf[LI[p],LI[q]].";
(* \[CapitalPi]::usage = "\[CapitalPi][uf][LI[p],LI[q],index,index] is the anisotropic stress tensor of the fluid, automatically defined when calling the function DefMatterFields. It depends on the fluid four-velocity 'uf'.
The first Label-Index (LI) gives the order 'p' of '\[CapitalPi]' (hence, for p = 0, '\[CapitalPi]' corresponds to the (vanishing) background value of the anisotropic stress). The second LI represents the number 'q' of Lie derivatives along the vector normal to the hypersurfaces acting on the 'p'-order of '\[CapitalPi]'.
The commands \[CapitalPi][uf][index,index] and \[CapitalPi][uf][LI[p],index,index] are defined to be equal to \[CapitalPi][uf][LI[0],LI[0],index,index] and \[CapitalPi][uf][LI[p],LI[0],index,index], respectively.
The command \[CapitalPi][uf] builds the symbol '\[CapitalPi]uf', so one can use \[CapitalPi][uf][LI[p],LI[q],index,index] or, equivalently, \[CapitalPi]uf[LI[p],LI[q],index,index]."; *)
(*** PREDEFINED FIELDS: Perturbed fluid four-velocity ***)
V0::usage = "V0[h,uf][LI[p],LI[q]] is the time part of the perturbed fluid four-velocity 'ufpert' (with index up): ufpert = V0 \[Times] '*NameOfNormalVector*' + Vspat. It is automatically defined when calling the function DefMatterFields. It depends on the choice of the background slicing, and hence on the induced metric 'h'.
The first Label-Index (LI) gives the order 'p' of 'V0' (hence, if the fluid is not tilted in the background, 'V0' equals 1 for p = 0). The second LI represents the number 'q' of Lie derivatives along the vector normal to the hypersurfaces acting on the 'p'-order of 'V0'.
The commands V0[h,uf][] and V0[h,uf][LI[p]] are defined to be equal to V0[h,uf][LI[0],LI[0]] and V0[h,uf][LI[p],LI[0]], respectively.
The command V0[h,uf] builds the symbol 'V0huf', so one can use V0[h,uf][LI[p],LI[q]] or, equivalently, V0huf[LI[p],LI[q]].
The default printed form of V0[h,uf][] is: 'V0'.";
Vspat::usage = "Vspat[h,uf][LI[p],LI[q],index] is the spatial part of the perturbed fluid four-velocity 'ufpert' (with index up): ufpert = V0 \[Times] '*NameOfNormalVector*' + Vspat. It is automatically defined when calling the function DefMatterFields. It depends on the choice of the background slicing, and hence on the induced metric 'h'.
The first Label-Index (LI) gives the order 'p' of 'Vspat' (hence, if the fluid is not tilted in the background, 'Vspat' is null for p = 0). The second LI represents the number 'q' of Lie derivatives along the vector normal to the hypersurfaces acting on the 'p'-order of 'Vspat'.
The commands Vspat[h,uf][index] and Vspat[h,uf][LI[p],index] are defined to be equal to Vspat[h,uf][LI[0],LI[0],index] and Vspat[h,uf][LI[p],LI[0],index], respectively.
The command Vspat[h,uf] builds the symbol 'Vspathuf', so one can use Vspat[h,uf][LI[p],LI[q],index] or, equivalently, Vspathuf[LI[p],LI[q],index].
The default printed form of Vspat[h,uf][-index] is: '\!\(\*SubscriptBox[\(\[ScriptCapitalV]\), \(index\)]\)'.";
Vs::usage = "Vs[h,uf][LI[p],LI[q]] is the scalar part of the scalar-vector decomposition of 'Vspat', where 'Vspat' is the spatial part of the perturbed fluid four-velocity 'ufpert' (with index up). It is automatically defined when calling the function DefMatterFields. It depends on the choice of the background slicing, and hence on the induced metric 'h'.
The first Label-Index (LI) gives the order 'p' of 'Vs' (hence, if the fluid is not tilted in the background, 'Vs' is null for p = 0). The second LI represents the number 'q' of Lie derivatives along the vector normal to the hypersurfaces acting on the 'p'-order of 'Vs'.
The commands Vs[h,uf][] and Vs[h,uf][LI[p]] are defined to be equal to Vs[h,uf][LI[0],LI[0]] and Vs[h,uf][LI[p],LI[0]], respectively.
The command Vs[h,uf] builds the symbol 'Vshuf', so one can use Vs[h,uf][LI[p],LI[q]] or, equivalently, Vshuf[LI[p],LI[q]].
The default printed form of Vs[h,uf][] is: 'V'.";
Vv::usage = "Vv[h,uf][LI[p],LI[q],index] is the vector part of the scalar-vector decomposition of 'Vspat', where 'Vspat' is the spatial part of the perturbed fluid four-velocity 'ufpert' (with index up). It is automatically defined when calling the function DefMatterFields. It depends on the choice of the background slicing, and hence on the induced metric 'h'.
The first Label-Index (LI) gives the order 'p' of 'Vv' (hence, if the fluid is not tilted in the background, 'Vv' is null for p = 0). The second LI represents the number 'q' of Lie derivatives along the vector normal to the hypersurfaces acting on the 'p'-order of 'Vv'.
The commands Vv[h,uf][index] and Vv[h,uf][LI[p],index] are defined to be equal to Vv[h,uf][LI[0],LI[0],index] and Vv[h,uf][LI[p],LI[0],index], respectively.
The command Vv[h,uf] builds the symbol 'Vvhuf', so one can use Vv[h,uf][LI[p],LI[q],index] or, equivalently, Vvhuf[LI[p],LI[q],index].
The default printed form of Vv[h,uf][-index] is: '\!\(\*SubscriptBox[\(V\), \(index\)]\)'.";
(*** PREDEFINED FIELDS: Perturbation of the metric ***)
(** Time component of the metric perturbation **)
\[Phi]::usage = "\[Phi][h][LI[p],LI[q]] is the first Bardeen potential, corresponding to the 00 component of the metric perturbation. It is automatically defined when calling the function DefMetricFields. It depends on the choice of the background slicing, and hence on the induced metric 'h'.
The first Label-Index (LI) gives the order 'p' of the perturbation '\[Phi]' (hence '\[Phi]' is null for p = 0). The second LI represents the number 'q' of Lie derivatives along the vector normal to the hypersurfaces acting on the 'p'-order of '\[Phi]'.
The commands \[Phi][h][] and \[Phi][h][LI[p]] are defined to be equal to \[Phi][h][LI[0],LI[0]] and \[Phi][h][LI[p],LI[0]], respectively.
The command \[Phi][h] builds the symbol '\[Phi]h', so one can use \[Phi][h][LI[p],LI[q]] or, equivalently, \[Phi]h[LI[p],LI[q]].";
(** 0i components of the metric perturbation **)
Bs::usage = "Bs[h][LI[p],LI[q]] is the scalar part of the scalar-vector decomposition of the 0i components of the metric perturbation. It is automatically defined when calling the function DefMetricFields. It depends on the choice of the background slicing, and hence on the induced metric 'h'.
The first Label-Index (LI) gives the order 'p' of the perturbation 'Bs' (hence 'Bs' is null for p = 0). The second LI represents the number 'q' of Lie derivatives along the vector normal to the hypersurfaces acting on the 'p'-order of 'Bs'.
The commands Bs[h][] and Bs[h][LI[p]] are defined to be equal to Bs[h][LI[0],LI[0]] and Bs[h][LI[p],LI[0]], respectively.
The command Bs[h] builds the symbol 'Bsh', so one can use Bs[h][LI[p],LI[q]] or, equivalently, Bsh[LI[p],LI[q]].
The default printed form of Bs[h][] is: 'B'.";
Bv::usage = "Bv[h][LI[p],LI[q],index] is the vector part of the scalar-vector decomposition of the 0i components of the metric perturbation. It is automatically defined when calling the function DefMetricFields. It depends on the choice of the background slicing, and hence on the induced metric 'h'.
The first Label-Index (LI) gives the order 'p' of the perturbation 'Bv' (hence 'Bv' is null for p = 0). The second LI represents the number 'q' of Lie derivatives along the vector normal to the hypersurfaces acting on the 'p'-order of 'Bv'.
The commands Bv[h][index] and Bv[h][LI[p],index] are defined to be equal to Bv[h][LI[0],LI[0],index] and Bv[h][LI[p],LI[0],index], respectively.
The command Bv[h] builds the symbol 'Bvh', so one can use Bv[h][LI[p],LI[q],index] or, equivalently, Bvh[LI[p],LI[q],index].
The default printed form of Bv[h][-index] is: '\!\(\*SubscriptBox[\(B\), \(index\)]\)'.";
(** Spatial components of the metric perturbation **)
\[Psi]::usage = "\[Psi][h][LI[p],LI[q]] is the second Bardeen potential, present in the spatial components of the metric perturbation. It is automatically defined when calling the function DefMetricFields. It depends on the choice of the background slicing, and hence on the induced metric 'h'.
The first Label-Index (LI) gives the order 'p' of the perturbation '\[Psi]' (hence '\[Psi]' is null for p = 0). The second LI represents the number 'q' of Lie derivatives along the vector normal to the hypersurfaces acting on the 'p'-order of '\[Psi]'.
The commands \[Psi][h][] and \[Psi][h][LI[p]] are defined to be equal to \[Psi][h][LI[0],LI[0]] and \[Psi][h][LI[p],LI[0]], respectively.
The command \[Psi][h] builds the symbol '\[Psi]h', so one can use \[Psi][h][LI[p],LI[q]] or, equivalently, \[Psi]h[LI[p],LI[q]].";
Es::usage = "Es[h][LI[p],LI[q]] is the scalar part of the scalar-vector-tensor decomposition of the spatial components of the metric perturbation. It is automatically defined when calling the function DefMetricFields. It depends on the choice of the background slicing, and hence on the induced metric 'h'.
The first Label-Index (LI) gives the order 'p' of the perturbation 'Es' (hence 'Es' is null for p = 0). The second LI represents the number 'q' of Lie derivatives along the vector normal to the hypersurfaces acting on the 'p'-order of 'Es'.
The commands Es[h][] and Es[h][LI[p]] are defined to be equal to Es[h][LI[0],LI[0]] and Es[h][LI[p],LI[0]], respectively.
The command Es[h] builds the symbol 'Esh', so one can use Es[h][LI[p],LI[q]] or, equivalently, Esh[LI[p],LI[q]].
The default printed form of Es[h][] is: 'E'.";
Ev::usage = "Ev[h][LI[p],LI[q],index] is the vector part of the scalar-vector-tensor decomposition of the spatial components of the metric perturbation. It is automatically defined when calling the function DefMetricFields. It depends on the choice of the background slicing, and hence on the induced metric 'h'.
The first Label-Index (LI) gives the order 'p' of the perturbation 'Ev' (hence 'Ev' is null for p = 0). The second LI represents the number 'q' of Lie derivatives along the vector normal to the hypersurfaces acting on the 'p'-order of 'Ev'.
The commands Ev[h][index] and Ev[h][LI[p],index] are defined to be equal to Ev[h][LI[0],LI[0],index] and Ev[h][LI[p],LI[0],index], respectively.
The command Ev[h] builds the symbol 'Evh', so one can use Ev[h][LI[p],LI[q],index] or, equivalently, Evh[LI[p],LI[q],index].
The default printed form of Ev[h][-index] is: '\!\(\*SubscriptBox[\(E\), \(index\)]\)'.";
Et::usage = "Et[h][LI[p],LI[q],index,index] is the tensor part of the scalar-vector-tensor decomposition of the spatial components of the metric perturbation. It is automatically defined when calling the function DefMetricFields. It depends on the choice of the background slicing, and hence on the induced metric 'h'.
The first Label-Index (LI) gives the order 'p' of the perturbation 'Et' (hence 'Et' is null for p = 0). The second LI represents the number 'q' of Lie derivatives along the vector normal to the hypersurfaces acting on the 'p'-order of 'Et'.
The commands Et[h][index,index] and Et[h][LI[p],index,index] are defined to be equal to Et[h][LI[0],LI[0],index,index] and Et[h][LI[p],LI[0],index,index], respectively.
The command Et[h] builds the symbol 'Eth', so one can use Et[h][LI[p],LI[q],index,index] or, equivalently, Eth[LI[p],LI[q],index,index].
The default printed form of Et[h][-index,-index] is: '\!\(\*SubscriptBox[\(E\), \(index\\\ index\)]\)'.";
(*** PREDEFINED FIELDS: Gauge vector, its decomposition and perturbation parameter ***)
\[Xi]::usage = "\[Xi][h][LI[order],index] is the general vector field used in a gauge transformation. It is automatically defined when calling the function SplitFieldsAndGaugeChange. It depends on the choice of the background slicing, and hence on the induced metric 'h'.
The Label-Index (LI) gives the order 'order' of the vector field '\[Xi]' (hence '\[Xi]' is null for p = 0).
The command \[Xi][h] builds the symbol '\[Xi]h', so one can use \[Xi][h][LI[order],index] or, equivalently, \[Xi]h[LI[order],index].";
T::usage = "T[h][LI[p],LI[q]] is the factor of the time component of the vector field '\[Xi]' used in a gauge transformation. It is automatically defined when calling the function DefMetricFields. It depends on the choice of the background slicing, and hence on the induced metric 'h'.
The first Label-Index (LI) gives the order 'p' of 'T' (hence 'T' is null for p = 0). The second LI represents the number 'q' of Lie derivatives along the vector normal to the hypersurfaces acting on the 'p'-order of 'T'.
The commands T[h][] and T[h][LI[p]] are defined to be equal to T[h][LI[0],LI[0]] and T[h][LI[p],LI[0]], respectively.
The command T[h] builds the symbol 'Th', so one can use T[h][LI[p],LI[q]] or, equivalently, Th[LI[p],LI[q]].
The default printed form of T[h][] is: 'T'.";
Ls::usage = "Ls[h][LI[p],LI[q]] is the scalar part of the scalar-vector decomposition of the spatial component of the vector field '\[Xi]' used in a gauge transformation. It is automatically defined when calling the function DefMetricFields. It depends on the choice of the background slicing, and hence on the induced metric 'h'.
The first Label-Index (LI) gives the order 'p' of 'Ls' (hence 'Ls' is null for p = 0). The second LI represents the number 'q' of Lie derivatives along the vector normal to the hypersurfaces acting on the 'p'-order of 'Ls'.
The commands Ls[h][] and Ls[h][LI[p]] are defined to be equal to Ls[h][LI[0],LI[0]] and Ls[h][LI[p],LI[0]], respectively.
The command Ls[h] builds the symbol 'Lsh', so one can use Ls[h][LI[p],LI[q]] or, equivalently, Lsh[LI[p],LI[q]].
The default printed form of Ls[h][] is: 'L'.";
Lv::usage = "Lv[h][LI[p],LI[q],index] is the vector part of the scalar-vector decomposition of the spatial component of the vector field '\[Xi]' used in a gauge transformation. It is automatically defined when calling the function DefMetricFields. It depends on the choice of the background slicing, and hence on the induced metric 'h'.
The first Label-Index (LI) gives the order 'p' of 'Lv' (hence 'Lv' is null for p = 0). The second LI represents the number 'q' of Lie derivatives along the vector normal to the hypersurfaces acting on the 'p'-order of 'Lv'.
The commands Lv[h][index] and Lv[h][LI[p],index] are defined to be equal to Lv[h][LI[0],LI[0],index] and Lv[h][LI[p],LI[0],index], respectively.
The command Lv[h] builds the symbol 'Lvh', so one can use Lv[h][LI[p],LI[q],index] or, equivalently, Lvh[LI[p],LI[q],index].
The default printed form of Lv[h][-index] is: '\!\(\*SubscriptBox[\(L\), \(index\)]\)'.";
\[Epsilon]::usage = "\[Epsilon] is the default perturbation parameter. It is automatically defined when calling either the function DefMetricFields or the function DefMatterFields.";
\[ScriptCapitalN]0::usage = "\[ScriptCapitalN]0[h][LI[p],LI[q]] is the time part of the perturbation of the normal vector to constant time hypersurfaces (whith index down). It is automatically defined when calling SetSlicing.
In the ADM formalism, it is equal to the lapse function.
The first Label-Index (LI) gives the order 'p' of the perturbation '\[ScriptCapitalN]0'. The second LI represents the number 'q' of Lie derivatives along the vector normal to the hypersurfaces acting on the 'p'-order of '\[ScriptCapitalN]'. Hence \[ScriptCapitalN]0[h][LI[0],LI[0]] is the background lapse and is equal to 1.
The commands \[ScriptCapitalN]0[h][index] and \[ScriptCapitalN]0[h][LI[p],index] are defined to be equal to \[ScriptCapitalN]0[h][LI[0],LI[0],index] and \[ScriptCapitalN]0[h][LI[p],LI[0],index], respectively.
The command \[ScriptCapitalN]0[h] builds the symbol '\[ScriptCapitalN]0h', so one can use \[ScriptCapitalN]0[h][LI[p],LI[q],index] or, equivalently, \[ScriptCapitalN]0h[LI[p],LI[q],index].
The default printed form of \[ScriptCapitalN]0[h][-index] is: '\!\(\*SubscriptBox[\(\[ScriptCapitalN]0\), \(index\)]\)'.";
\[ScriptCapitalN]::usage = "\[ScriptCapitalN][h][index] is the normal vector to constant time hypersurfaces. It is automatically defined when calling SetSlicing. Though on the background spacetime it is equal to \!\(\*SuperscriptBox[\(n\), \(\[Mu]\)]\), where \!\(\*SuperscriptBox[\(n\), \(\[Mu]\)]\) is the vector normal to h on the background space-time, this definition allows manipulation of the normal vector, like perturbation, conformal transformations, which would be impossible directly with \!\(\*SuperscriptBox[\(n\), \(\[Mu]\)]\) since many definitions are already automatized for it (e.g. normalization to -1).";
d\[ScriptCapitalN]::usage = "d\[ScriptCapitalN][h][LI[p],index] is the perturbation of the normal vector to constant time hypersurfaces. 'p' is the order of perturbation.
The command d\[ScriptCapitalN][h] builds the symbol 'd\[ScriptCapitalN]h', so one can use d\[ScriptCapitalN][h][LI[p],index] or, equivalently, d\[ScriptCapitalN]h[LI[p]index].";
\[ScriptCapitalN]i::usage = "\[ScriptCapitalN]i[h][index] is the shift vector (in the ADM formalism) of the normal vector to constant time hypersurfaces. It is defined as \[ScriptCapitalN]i[h][upindex] = -Projector[h][ \[ScriptCapitalN]0[h] \[ScriptCapitalN][h][upindex] ].
It is only meaningful when used with and upper index. Its main purpose is the computation of perturbations for the shift vector in the ADM formalism.
The command \[ScriptCapitalN]i[h] builds the symbol '\[ScriptCapitalN]ih', so one can use \[ScriptCapitalN]i[h][upindex] or, equivalently, \[ScriptCapitalN]ih[upindex].
";
(*** RESERVED WORDS AND PROTECTED NAMES ***)
SpaceTimesOfDefinition::usage = "";
TensorProperties::usage = "";
(*** TYPES OF GAUGE ***)
$ListOfGauges::usage = "Possible gauges are: AnyGauge, FluidComovingGauge, ScalarFieldComovingGauge FlatGauge, IsoDensityGauge, NewtonGauge and SynchronousGauge."
(*** TYPES OF MANIFOLD ***)
(*Anisotropic::usage="General type of spatial hypersurfaces for an anisotropic manifold. The boolean function '$OpenConstantsOfStructure' is automatically set to 'False'. For a four-dimensional manifold, the user can choose instead the particular types: BianchiB, BianchiA or BianchiI.";
BianchiB::usage = "Type of spatial hypersurfaces corresponding to a general Bianchi space-time.
If '$OpenConstantsOfStructure' is set to 'True', then the constants of structure Subscript[C^i, jk] are expressed in terms of N^ij and A^i, according to: Subscript[C^i, jk ]= Subscript[\[Epsilon], jkl]N^li + Subscript[A, [j]Subscript[\[Delta]^i, k]].";
BianchiA::usage = "Type of spatial hypersurfaces corresponding to a Bianchi type A space-time.
If '$OpenConstantsOfStructure' is set to 'True', then the constants of structure Subscript[C^i, jk] are expressed in terms of N^ij, according to: Subscript[C^i, jk ]= Subscript[\[Epsilon], jkl]N^li.";
BianchiI::usage = "Type of spatial hypersurfaces corresponding to a Bianchi type I space-time.";
FLCurved::usage = "Type of spatial hypersurfaces corresponding to a curved Friedmann-Lemaitre manifold (that is, with spatial curvature).";
FLFlat::usage = "Type of spatial hypersurfaces corresponding to a flat Friedmann-Lemaitre manifold (that is, without spatial curvature).";
Minkowski::usage = "Type of spatial hypersurfaces corresponding to a Minkowski manifold (that is, a flat FL space-time without expansion).";
*)
SpaceType::usage = "SpaceType[h], with 'h' being the induced metric on the hypersurfaces, displays the type of hypersurfaces chosen for the SetSlicing. It can be: Anisotropic, BianchiB, BianchiA, BianchiI, FLCurved, FLFlat or Minkowski.";
$ListOfSpaceTypes::usage = "Possible space types are: Anisotropic, BianchiB, BianchiA, BianchiI, FLCurved, FLFlat and Minkowski."
Begin["xAct`xPand`Private`"]
(** Why a scalar head inside a scalar function? **)
(** We choose that the Scalar head should be removed**)
Unprotect[xAct`xTensor`NoScalar];
xAct`xTensor`NoScalar[f_?ScalarFunctionQ[expr_]]:=f[NoScalar@expr]
Protect[xAct`xTensor`NoScalar];
(** To avoid complaints from MakeRule when the rule has already been defined and the lhs is zero. **)
(*xAct`xTensor`MakeRule[{lhs_?(Evaluate[#]===0&),rhs_,conditions___},options:OptionsPattern[]]:={};*)
(* We create our own function based on MakeRule, but separating the special problematic case. This avoids overloading a definition from xTensor.
It does not change the way xPand works, but that way, the code is clearly separated from xTensor.
This is a much more polite way to modify the behaviour of xTensor. This method was advised by Leo Stein**)
SetAttributes[BuildRule,HoldFirst]
BuildRule[{lhs_?(Evaluate[#]===0&),rhs_,conditions___},options:OptionsPattern[]]:={};
BuildRule[{lhs_,rhs_,conditions___}]:=MakeRule[{lhs,rhs,conditions}];
BuildRule[{lhs_,rhs_,conditions___},options:OptionsPattern[]]:=MakeRule[{lhs,rhs,conditions},options];
(*** DEFAULT OPTIONS AND PROTECTED NAMES ***)
BackgroundFieldMethod = False;
$DebugInfoQ=False;
$CommutecdRules = {};
$ConformalTime = True;
$FirstOrderVectorPerturbations=True;
$FirstOrderTensorPerturbations=True;
$OpenConstantsOfStructure=True;
$PrePrint=ScreenDollarIndices;
$SortCovDAutomatic=True;
Off[RuleDelayed::rhs];
Block[{Print},DefInertHead[ProtectMyScalar,LinearQ->True]];
FixProtectScalar:=ProtectMyScalar[expr_]:>ProtectMyScalar[xAct`xTensor`Private`MathInputExpand[expr]]
(*** COLORATION OF THE PERTURBATION ORDERS ***)
DerCharacter:=If[$ConformalTime,"\[Prime]","."];
(* The output format of the Lie derivative with respect to the vector normal to the hypersurfaces is a prime when one considers the conformal time, and a dot when one considers the cosmic time. *)
PerturbationOrderColor[1]:=RGBColor[0.85,0,0];
PerturbationOrderColor[2]:=RGBColor[0,0.6,0];
PerturbationOrderColor[3]:=RGBColor[0,0,0.85];
PerturbationOrderColor[4]:=RGBColor[0.6,0.4,0.2];
PerturbationOrderColor[5]:=RGBColor[0.7,0,0.7];
PerturbationOrderColor[_]:=RGBColor[1,0.6,0];
xTensorFormStop[Tensor]
MakeBoxes[Tens_?xTensorQ[LI[p_?((IntegerQ[#]&&#>=0)&)],LI[q_?((IntegerQ[#]&&#>=0)&)],inds___],StandardForm]:=
xAct`xTensor`Private`interpretbox[Tens[LI[p],LI[q],inds],
If[(AnisotropyBool[SpaceType@InducedMetricOf[Tens]]||BianchiBool[SpaceType@InducedMetricOf[Tens]])&&Cases[{inds},_?UpIndexQ]=!={}&&q>=1,
Message[xPand::makeboxes];
RowBox[{OverscriptBox["\[Null]",RowBox[{"(",ToString[p],")"}]],"\[NegativeThinSpace]",OverscriptBox[MakeBoxes[Tens[inds],StandardForm],ToString[q]]}],
Switch[p,
0,RowBox[{OverscriptBox[MakeBoxes[Tens[inds],StandardForm],StringJoin@Table[DerCharacter,{i,1,q}]]}],
_,RowBox[{OverscriptBox["\[Null]",RowBox[{StyleBox["("<>ToString[p]<>")",FontColor->PerturbationOrderColor[p]]}]],"\[NegativeThinSpace]",OverscriptBox[MakeBoxes[Tens[inds],StandardForm],StringJoin@Table[DerCharacter,{i,1,q}]]}]
]
]
];
xTensorFormStart[Tensor]
(*** CONVENIENT FUNCTIONS TO BUILD RULES ***)
PatternLeft[(left_:> right_),ElementsToBePatterned_List]:=(left/.((#->Pattern[#,_])&/@ ElementsToBePatterned)):>right
PatternLeft[(left_-> right_),ElementsToBePatterned_List]:=(left/.((#->Pattern[#,_])&/@ ElementsToBePatterned))->right
(*** HANDLING EXPRESSIONS ***)
collect[expr_]:=Collect[expr,$PerturbationParameter,Identity]
(** fix by Jolyon Bloomfield. No Idea if this works or not. This should correct the bug found by Adam Solomon in August 2014 **)
fixScalar:=Scalar[expr_]:>Scalar[xAct`xTensor`Private`MathInputExpand[expr]]
org[expr_]:=Collect[ContractMetric[expr],$PerturbationParameter,ToCanonical[#/.fixScalar]&]
(* Old org before the fix*)
(* org[expr_]:=Collect[ContractMetric[expr],$PerturbationParameter,ToCanonical[#/.fixScalar]&]*)
TCnoCM[expr_]:=ToCanonical[expr,UseMetricOnVBundle->None]
(*** PRIVATE BOOLEAN FUNCTIONS ***)
(** Miscellaneous **)
$DefInfoQ=True;
(* If set to 'False', the information messages are not printed. *)
(** Testing expressions **)
AnyIndicesListQ[inds_List]:=Cases[inds,AnyIndices[_]]=!={}
(* If the list of indices contains the head 'AnyIndices', then AnyIndicesListQ[inds] returns 'True'; otherwise it returns 'False'. *)
DefTensorQ[symb_]:=Cases[$Tensors,symb]==={symb}
(* If 'symb' has been defined as a tensor, then DefTensorQ[symb] returns 'True'; otherwise it returns 'False'. *)
GaugeQ[strg_]:=Cases[{"AnyGauge","FluidComovingGauge","ScalarFieldComovingGauge","FlatGauge","IsoDensityGauge","NewtonGauge","SynchronousGauge"},strg]==={strg}
(* If 'strg' matches one of the element in the list, then GaugeQ[strg] returns 'True'; otherwise it returns 'False'. *)
InducedMetricQ[symb_]:=If[MetricQ[symb],InducedFrom[symb]=!=Null,False]
(* If 'symb' is not defined as a metric, then InducedMetricQ[symb] returns 'False'. Otherwise, it checks whether 'symb' is an induced metric.
If this is the case, then InducedMetricQ[symb] gives 'True'; otherwise it gives 'False'. *)
SpaceTimeQ[strg_]:=Cases[{"Anisotropic", "BianchiB","BianchiA","BianchiI","FLCurved","FLFlat","Minkowski"},strg]==={strg}
(* If 'strg' matches one of the element of the list, then SpaceTimeQ[strg] returns 'True'; otherwise it returns 'False'. *)
TensorNullQ[tens_]:=If[Cases[SlotsOfTensor[tens],Labels]=!={},Print["** Warning: the function TensorNullQ is only suited to test tensors defined without label-indices. ",tens],With[{inds=DummyIn/@SlotsOfTensor[tens]},tens@@inds===0]]
(* TensorNullQ[tens] returns 'True' if 'tens' is a null tensor and 'False' otherwise. This function is not suited to test tensors defined with label-indices. *)
(** Type of manifolds **)
BianchiBool[Spacetype_]:=(Spacetype==="BianchiB"||Spacetype==="BianchiA"||Spacetype==="BianchiI")
FlatSpaceBool[Spacetype_]:=(Spacetype==="BianchiI"||Spacetype==="FLFlat"||Spacetype==="Minkowski")
NoAnisotropyBool[Spacetype_]:=(Spacetype==="FLCurved"||Spacetype==="FLFlat"||Spacetype==="Minkowski")
AnisotropyBool[Spacetype_]:=(Spacetype==="Anisotropic")
(* The name 'AnisotropyBool' should be changed. *)
(*** BUILDING SYMBOLS: Geometrical quantities ***)
a[symb_]:=SymbolJoin[a,symb];
H[symb_]:=SymbolJoin[H,symb];
Connection[symb_]:=SymbolJoin[Connection,symb];
CS[symb_]:=SymbolJoin[CS,symb];
nt[symb_]:=SymbolJoin[nt,symb];
av[symb_]:=SymbolJoin[av,symb];
K[symb_]:=SymbolJoin[K,symb];
\[ScriptK][symb_]:=SymbolJoin[\[ScriptK],symb];
(*** BUILDING SYMBOLS: Fluid quantities ***)
\[Rho][symb_]:=SymbolJoin[\[Rho],symb];
P[symb_]:=SymbolJoin[P,symb];
(* \[CapitalPi][symb_]:=SymbolJoin[\[CapitalPi],symb]; *)
(*** BUILDING SYMBOLS: Perturbed fluid four-velocity ***)
V0[h_?InducedMetricQ,velocity_]:=SymbolJoin[V0,h,velocity];
Vspat[h_?InducedMetricQ,velocity_]:=SymbolJoin[Vspat,h,velocity];
Vs[h_?InducedMetricQ,velocity_]:=SymbolJoin[Vs,h,velocity];
Vv[h_?InducedMetricQ,velocity_]:=SymbolJoin[Vv,h,velocity];
(*** BUILDING SYMBOLS: Perturbation of the metric ***)
\[Phi][h_?InducedMetricQ]:=SymbolJoin[\[Phi],h];
Bs[h_?InducedMetricQ]:=SymbolJoin[Bs,h];
Bv[h_?InducedMetricQ]:=SymbolJoin[Bv,h];
\[Psi][h_?InducedMetricQ]:=SymbolJoin[\[Psi],h];
Es[h_?InducedMetricQ]:=SymbolJoin[Es,h];
Ev[h_?InducedMetricQ]:=SymbolJoin[Ev,h];
Et[h_?InducedMetricQ]:=SymbolJoin[Et,h];
(*** BUILDING SYMBOLS: Gauge vector and decomposition ***)
\[Xi][h_?InducedMetricQ]:=SymbolJoin[\[Xi],h];
T[h_?InducedMetricQ]:=SymbolJoin[T,h];
Ls[h_?InducedMetricQ]:=SymbolJoin[Ls,h];
Lv[h_?InducedMetricQ]:=SymbolJoin[Lv,h];
$ListFieldsBackgroundOnly[h_?InducedMetricQ]:={{a[h][],"a"}, {H[h][],"\[ScriptCapitalH]"}};
$ListFieldsPerturbedOnly[h_?InducedMetricQ]:=With[{M=ManifoldOfCovD@CovDOfMetric@First@InducedFrom@h},
Block[{\[Mu]},
{\[Mu]}=GetIndicesOfVBundle[Tangent@M,1];
{{\[Phi][h][],"\[Phi]"},{Bs[h][],"B"},{Bv[h][-\[Mu]],"B"},{\[Psi][h][],"\[Psi]"},{Es[h][],"E"},{Ev[h][-\[Mu]],"E"},{Et[h][-\[Mu],-\[Nu]],"E"},{T[h][],"T"},{Ls[h][],"L"},{Lv[h][-\[Mu]],"L"}}
]
];
(* The former implementation of $ListFieldsBackgroundAndPerturbed failed to treat separately different fluids. *)
(* Obinna proposed the replace by the version below. *)
(* We thank Enrico Pajer for reporting this bug. *)
$ListFieldsBackgroundAndPerturbed[h_?InducedMetricQ,velocity_]:=With[{M=ManifoldOfCovD@CovDOfMetric@First@InducedFrom@h},
Block[{\[Mu],\[Nu]},
{\[Mu],\[Nu]}=GetIndicesOfVBundle[Tangent@M,2];
{{\[CurlyPhi][],"\[CurlyPhi]"},{\[Rho][velocity][],ToString@StringJoin[{"\[Rho]"},ToString[velocity]]},{P[velocity][],ToString@StringJoin[{"P"},ToString[velocity]]},{Vspat[h,velocity][-\[Mu]],ToString@StringJoin[{"\[ScriptCapitalV]",ToString[velocity]}]},{V0[h,velocity][],ToString@StringJoin[{"V0",ToString[velocity]}]},{Vs[h,velocity][],ToString@StringJoin[{"V",ToString[velocity]}]},{Vv[h,velocity][-\[Mu]],ToString@StringJoin[{"V",ToString[velocity]}]}}
]
];
(*** DEFAULT VALUES: DefProjectedTensor & DefProjectedTensorProperties ***)
Options[DefProjectedTensor]={PrintAs->Identity,TensorProperties->{"SymmetricTensor","Traceless","Transverse"},SpaceTimesOfDefinition->{"Background","Perturbed"}};
DefProjectedTensorQ[Name_,h___]:=False;
PropertiesList[Name_]:={};
InducedMetricOf[Name_]:={};
(*** MODULE: DefProjectedTensor ***)
DefProjectedTensor[Name_[inds___],h_?InducedMetricQ,options___?OptionQ]:=Catch@Module[{IndsNoLI,p,q,PrAs,SpaTimeDef,TensProp},
With[{M=ManifoldOfCovD@CovDOfMetric[First@InducedFrom@h]},
If[DefProjectedTensorQ[Name,h],
If[$DefInfoQ,
Throw@Print["** DefProjectedTensor: The projection properties on the hypersurfaces associated with the induced metric ", h," have already been defined for the tensor ", Name,"."],
Throw[Null]
];
];
If[DefProjectedTensorQ[Name],
If[$DefInfoQ,
Print["** DefProjectedTensor: Projection properties for the tensor ", Name," have been defined for another slicing. New projection properties on the hypersurfaces associated with the induced metric ", h," are now added."]
];
];
(* If projection properties for the tensor 'Name' have been defined for another slicing, the command 'Name[inds]', with 'inds' being abstract index, is substituted by 'Name[LI[0],LI[0],inds]' (refer to the function DefProjectedTensorProperties for this rule). The following command then serves to remove the possible label indices. *)
IndsNoLI=Select[{inds},Not@LIndexQ[#]&];
If[(Length[IndsNoLI]>= 1)&&(Not@AnyIndicesListQ[IndsNoLI])&&(Select[IndsNoLI,UpIndexQ] =!={}),
Throw[Message[DefProjectedTensor::notdownindices,Name]]];
(********** The following Message is not yet defined. **********)
If[(Length[IndsNoLI]>= 2)&&(AnyIndicesListQ[IndsNoLI]),
Throw[Message[DefProjectedTensor::invalidanyindices,Name]]];
PrAs=PrintAs/.CheckOptions[options]/.Options[DefProjectedTensor];
SpaTimeDef=SpaceTimesOfDefinition/.CheckOptions[options]/.Options[DefProjectedTensor];
TensProp=TensorProperties/.CheckOptions[options]/.Options[DefProjectedTensor];
If[DefProjectedTensorQ[Name]||DefTensorQ[Name],
If[$DefInfoQ,
Print["** DefProjectedTensor: The tensor ", Name," already exists. The projection properties on the hypersurfaces associated with the induced metric ", h," are now defined."]],
DefTensor[Name[LI[p],LI[q],IndsNoLI/.List->Sequence],M,Symmetric[IndsNoLI],PrintAs->PrAs]
];
(* Definition of the projection properties for the tensor 'Name'. *)
If[Not@AnyIndicesListQ[IndsNoLI],
DefProjectedTensorProperties[Name,IndsNoLI/.List->Sequence,h,TensProp,SpaTimeDef],
DefProjectedTensorPropertiesAnyIndices[Name,h,TensProp,SpaTimeDef]];
]
]
SetNumberOfArguments[DefProjectedTensor,{2,Infinity}]
Protect[DefProjectedTensor];
(*** MODULE: DefProjectedTensorProperties ***)
DefProjectedTensorProperties[Name_,inds___?DownIndexQ,h_?InducedMetricQ,Properties_List,Spacetimes_List]:=Catch@Module[{prot,Lengthindices},
With[{
g=First@InducedFrom@h,
n=Last@InducedFrom@h},
With[{
cd=CovDOfMetric[h],
M=ManifoldOfCovD[CovDOfMetric[g]],
SymmetricBool=(Cases[Properties,"SymmetricTensor"]==={"SymmetricTensor"}),
TracelessBool=(Cases[Properties,"Traceless"]==={"Traceless"}),
TransverseBool=(Cases[Properties,"Transverse"]==={"Transverse"}),
BackgroundBool=(Cases[Spacetimes,"Background"]==={"Background"}),
PerturbedBool=(Cases[Spacetimes,"Perturbed"]==={"Perturbed"}),
ToCan=ToCanonical[#,UseMetricOnVBundle->None]&
},
If[Not[SymmetricBool]&&(Length[{inds}]>=2),
Throw@Message[DefProjectedTensorProperties::symmetrictensors]];
DefProjectedTensorQ[Name,h]^=True;
InducedMetricOf[Name]^=h;
If[DefProjectedTensorQ[Name]===False,
PropertiesList[Name]^=Join[Properties,Which[
Length[{inds}]===0,{"Scalar"},
Length[{inds}]===1,{"Vector"},
Length[{inds}]>=2,{"Tensor"}]];
Name[indices___?AIndexQ]:=Name[LI[0],LI[0],indices]
/;(Length[{indices}]===Length[{inds}]);
Name[LI[p_?((IntegerQ[#]&&#>=0)&)],indices___?AIndexQ]:=Name[LI[p],LI[0],indices]
/;(Length[{indices}]===Length[{inds}]);
(* For tensors of rank larger than or equal to 2, the following rules provide the traceless property. *)
If[(Length[{inds}]>=2)&&TracelessBool,
Name/:Name[LI[p_?((IntegerQ[#] && #>=0) &)],LI[0],indices1___,Dum_,indices2___,-Dum_,indices3___]:=0 /;( Length[Join[{indices1},{indices2},{indices3}]]+2===Length[{inds}]);
Name/:Name[LI[p_?((IntegerQ[#] && #>=0) &)],LI[0],indices1___,-Dum_,indices2___,Dum_,indices3___]:=0 /;( Length[Join[{indices1},{indices2},{indices3}]]+2===Length[{inds}]);
Name/:Name[LI[p_?((IntegerQ[#] && #>=0) &)],LI[q_?((IntegerQ[#] && #>=1) &)],indices1___,Dum_,indices2___,-Dum_,indices3___]:=
Module[{Dummy1,Dummy2},
Dummy1=DummyIn[Tangent[M]];
Dummy2=DummyIn[Tangent[M]];
If[$ConformalTime,1,1/a[h][]]*(LieD[n[Dummy1]][ToCan[Name[LI[p],LI[q-1],indices1,Dum,indices2,-Dum,indices3]]]
+2*Name[LI[p],LI[q-1],indices1,-Dummy1,indices2,-Dummy2,indices3]ExtrinsicK[h][Dummy1,Dummy2])
]/;( Length[Join[{indices1},{indices2},{indices3}]]+2===Length[{inds}]);
Name/:Name[LI[p_?((IntegerQ[#] && #>=0) &)],LI[q_?((IntegerQ[#] && #>=1) &)],indices1___,-Dum_,indices2___,Dum_,indices3___]:=
Module[{Dummy1,Dummy2},
Dummy1=DummyIn[Tangent[M]];
Dummy2=DummyIn[Tangent[M]];
If[$ConformalTime,1,1/a[h][]]*(LieD[n[Dummy1]][ToCan[Name[LI[p],LI[q-1],indices1,Dum,indices2,-Dum,indices3]]]
+2 * Name[LI[p],LI[q-1],indices1,-Dummy1,indices2,-Dummy2,indices3]ExtrinsicK[h][Dummy1,Dummy2])
]/;( Length[Join[{indices1},{indices2},{indices3}]]+2===Length[{inds}]);
];