File: Ctensor.texi

package info (click to toggle)
maxima 5.10.0-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 44,268 kB
  • ctags: 17,987
  • sloc: lisp: 152,894; fortran: 14,667; perl: 14,204; tcl: 10,103; sh: 3,376; makefile: 2,202; ansic: 471; awk: 7
file content (1580 lines) | stat: -rw-r--r-- 59,455 bytes parent folder | download
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
@menu
* Introduction to ctensor::
* Definitions for ctensor::
@end menu

@node Introduction to ctensor, Definitions for ctensor, ctensor, ctensor
@section Introduction to ctensor

@code{ctensor} is a component tensor manipulation package.  To use the @code{ctensor}
package, type @code{load(ctensor)}.
To begin an interactive session with @code{ctensor}, type @code{csetup()}.  You are
first asked to specify the dimension of the manifold. If the dimension
is 2, 3 or 4 then the list of coordinates defaults to @code{[x,y]}, @code{[x,y,z]}
or @code{[x,y,z,t]} respectively.
These names may be changed by assigning a new list of coordinates to
the variable @code{ct_coords} (described below) and the user is queried about
this. Care must be taken to avoid the coordinate names conflicting
with other object definitions.

Next, the user enters the metric either directly or from a file by
specifying its ordinal position.
@c NO SUCH FILE !
@c As an example of a file of common metrics, see @code{share/tensor/metrics.mac}.
The metric is stored in the matrix
@code{lg}. Finally, the metric inverse is computed and stored in the matrix
@code{ug}. One has the option of carrying out all calculations in a power
series.

A sample protocol is begun below for the static, spherically symmetric
metric (standard coordinates) which will be applied to the problem of
deriving Einstein's vacuum equations (which lead to the Schwarzschild
solution) as an example. Many of the functions in @code{ctensor} will be
displayed for the standard metric as examples.

@example
(%i1) load(ctensor);
(%o1)      /share/tensor/ctensor.mac
(%i2) csetup();
Enter the dimension of the coordinate system:
4;
Do you wish to change the coordinate names?
n;
Do you want to
1. Enter a new metric?

2. Enter a metric from a file?

3. Approximate a metric with a Taylor series?
1;

Is the matrix  1. Diagonal  2. Symmetric  3. Antisymmetric  4. General
Answer 1, 2, 3 or 4
1;
Row 1 Column 1:
a;
Row 2 Column 2:
x^2;
Row 3 Column 3:
x^2*sin(y)^2;
Row 4 Column 4:
-d;

Matrix entered.
Enter functional dependencies with the DEPENDS function or 'N' if none
depends([a,d],x);
Do you wish to see the metric?
y;
                          [ a  0       0        0  ]
                          [                        ]
                          [     2                  ]
                          [ 0  x       0        0  ]
                          [                        ]
                          [         2    2         ]
                          [ 0  0   x  sin (y)   0  ]
                          [                        ]
                          [ 0  0       0       - d ]
(%o2)                                done
(%i3) christof(mcs);
                                            a
                                             x
(%t3)                          mcs        = ---
                                  1, 1, 1   2 a

                                             1
(%t4)                           mcs        = -
                                   1, 2, 2   x

                                             1
(%t5)                           mcs        = -
                                   1, 3, 3   x

                                            d
                                             x
(%t6)                          mcs        = ---
                                  1, 4, 4   2 d

                                              x
(%t7)                          mcs        = - -
                                  2, 2, 1     a

                                           cos(y)
(%t8)                         mcs        = ------
                                 2, 3, 3   sin(y)

                                               2
                                          x sin (y)
(%t9)                      mcs        = - ---------
                              3, 3, 1         a

(%t10)                   mcs        = - cos(y) sin(y)
                            3, 3, 2

                                            d
                                             x
(%t11)                         mcs        = ---
                                  4, 4, 1   2 a
(%o11)                               done

@end example

@c end concepts ctensor
@node Definitions for ctensor,  , Introduction to ctensor, ctensor

@section Definitions for ctensor

@subsection Initialization and setup

@deffn {Function} csetup ()
A function in the @code{ctensor} (component tensor) package
which initializes the package and allows the user to enter a metric
interactively. See @code{ctensor} for more details.
@end deffn

@deffn {Function} cmetric (@var{dis})
@deffnx {Function} cmetric ()
A function in the @code{ctensor} (component tensor) package
that computes the metric inverse and sets up the package for
further calculations.

If @code{cframe_flag} is false, the function computes the inverse metric
@code{ug} from the (user-defined) matrix @code{lg}. The metric determinant is
also computed and stored in the variable @code{gdet}. Furthermore, the
package determines if the metric is diagonal and sets the value
of @code{diagmetric} accordingly. If the optional argument @var{dis}
is present and not equal to @code{false}, the user is prompted to see
the metric inverse.

If @code{cframe_flag} is @code{true}, the function expects that the values of
@code{fri} (the inverse frame matrix) and @code{lfg} (the frame metric) are
defined. From these, the frame matrix @code{fr} and the inverse frame
metric @code{ufg} are computed.

@end deffn

@deffn {Function} ct_coordsys (@var{coordinate_system}, @var{extra_arg})
@deffnx {Function} ct_coordsys (@var{coordinate_system})
Sets up a predefined coordinate system and metric. The argument
@var{coordinate_system} can be one of the following symbols:

@example

  SYMBOL               Dim Coordinates       Description/comments
  --------------------------------------------------------------------------
  cartesian2d           2  [x,y]             Cartesian 2D coordinate system
  polar                 2  [r,phi]           Polar coordinate system
  elliptic              2  [u,v]             Elliptic coordinate system
  confocalelliptic      2  [u,v]             Confocal elliptic coordinates
  bipolar               2  [u,v]             Bipolar coordinate system
  parabolic             2  [u,v]             Parabolic coordinate system
  cartesian3d           3  [x,y,z]           Cartesian 3D coordinate system
  polarcylindrical      3  [r,theta,z]       Polar 2D with cylindrical z
  ellipticcylindrical   3  [u,v,z]           Elliptic 2D with cylindrical z
  confocalellipsoidal   3  [u,v,w]           Confocal ellipsoidal
  bipolarcylindrical    3  [u,v,z]           Bipolar 2D with cylindrical z
  paraboliccylindrical  3  [u,v,z]           Parabolic 2D with cylindrical z
  paraboloidal          3  [u,v,phi]         Paraboloidal coordinates
  conical               3  [u,v,w]           Conical coordinates
  toroidal              3  [u,v,phi]         Toroidal coordinates
  spherical             3  [r,theta,phi]     Spherical coordinate system
  oblatespheroidal      3  [u,v,phi]         Oblate spheroidal coordinates
  oblatespheroidalsqrt  3  [u,v,phi]
  prolatespheroidal     3  [u,v,phi]         Prolate spheroidal coordinates
  prolatespheroidalsqrt 3  [u,v,phi]
  ellipsoidal           3  [r,theta,phi]     Ellipsoidal coordinates
  cartesian4d           4  [x,y,z,t]         Cartesian 4D coordinate system
  spherical4d           4  [r,theta,eta,phi] Spherical 4D coordinate system
  exteriorschwarzschild 4  [t,r,theta,phi]   Schwarzschild metric
  interiorschwarzschild 4  [t,z,u,v]         Interior Schwarzschild metric
  kerr_newman           4  [t,r,theta,phi]   Charged axially symmetric metric

@end example

@code{coordinate_system} can also be a list of transformation functions,
followed by a list containing the coordinate variables. For instance,
you can specify a spherical metric as follows:

@example

(%i1) load(ctensor);
(%o1)       /share/tensor/ctensor.mac
(%i2) ct_coordsys([r*cos(theta)*cos(phi),r*cos(theta)*sin(phi),
      r*sin(theta),[r,theta,phi]]);
(%o2)                                done
(%i3) lg:trigsimp(lg);
                           [ 1  0         0        ]
                           [                       ]
                           [     2                 ]
(%o3)                      [ 0  r         0        ]
                           [                       ]
                           [         2    2        ]
                           [ 0  0   r  cos (theta) ]
(%i4) ct_coords;
(%o4)                           [r, theta, phi]
(%i5) dim;
(%o5)                                  3

@end example

Transformation functions can also be used when @code{cframe_flag} is @code{true}:

@example

(%i1) load(ctensor);
(%o1)       /share/tensor/ctensor.mac
(%i2) cframe_flag:true;
(%o2)                                true
(%i3) ct_coordsys([r*cos(theta)*cos(phi),r*cos(theta)*sin(phi),
      r*sin(theta),[r,theta,phi]]);
(%o3)                                done
(%i4) fri;
      [ cos(phi) cos(theta)  - cos(phi) r sin(theta)  - sin(phi) r cos(theta) ]
      [                                                                       ]
(%o4) [ sin(phi) cos(theta)  - sin(phi) r sin(theta)   cos(phi) r cos(theta)  ]
      [                                                                       ]
      [     sin(theta)            r cos(theta)                   0            ]
(%i5) cmetric();
(%o5)                                false
(%i6) lg:trigsimp(lg);
                           [ 1  0         0        ]
                           [                       ]
                           [     2                 ]
(%o6)                      [ 0  r         0        ]
                           [                       ]
                           [         2    2        ]
                           [ 0  0   r  cos (theta) ]

@end example

The optional argument @var{extra_arg} can be any one of the following:
@c LOOKING AT share/tensor/ctensor.mac CIRCA LINE 837, misner IS RECOGNIZED ALSO; WHAT EFFECT DOES IT HAVE ??

@code{cylindrical} tells @code{ct_coordsys} to attach an additional cylindrical coordinate.

@code{minkowski} tells @code{ct_coordsys} to attach an additional coordinate with negative metric signature.

@code{all} tells @code{ct_coordsys} to call @code{cmetric} and @code{christof(false)} after setting up the metric.

@c GLOBAL VARIABLE verbose IS USED IN ctensor.mac IN JUST THIS ONE CONTEXT
If the global variable @code{verbose} is set to @code{true}, @code{ct_coordsys} displays the values of @code{dim}, @code{ct_coords}, and either @code{lg} or @code{lfg} and @code{fri}, depending on the value of @code{cframe_flag}.

@end deffn

@deffn {Function} init_ctensor ()
Initializes the @code{ctensor} package.

The @code{init_ctensor} function reinitializes the @code{ctensor} package. It removes all arrays and matrices used by @code{ctensor}, resets all flags, resets @code{dim} to 4, and resets the frame metric to the Lorentz-frame.

@end deffn


@subsection The tensors of curved space

The main purpose of the @code{ctensor} package is to compute the tensors
of curved space(time), most notably the tensors used in general
relativity.

When a metric base is used, @code{ctensor} can compute the following tensors:

@example

 lg  -- ug
   \      \
    lcs -- mcs -- ric -- uric
              \      \       \
               \      tracer - ein -- lein
                \
                 riem -- lriem -- weyl
                     \
                      uriem


@end example

@code{ctensor} can also work using moving frames. When @code{cframe_flag} is
set to @code{true}, the following tensors can be calculated:

@example

 lfg -- ufg
     \
 fri -- fr -- lcs -- mcs -- lriem -- ric -- uric
      \                       |  \      \       \
       lg -- ug               |   weyl   tracer - ein -- lein
                              |\
                              | riem
                              |
                              \uriem

@end example

@deffn {Function} christof (@var{dis})
A function in the @code{ctensor} (component tensor)
package.  It computes the Christoffel symbols of both
kinds.  The argument @var{dis} determines which results are to be immediately
displayed.  The Christoffel symbols of the first and second kinds are
stored in the arrays @code{lcs[i,j,k]} and @code{mcs[i,j,k]} respectively and
defined to be symmetric in the first two indices. If the argument to
@code{christof} is @code{lcs} or @code{mcs} then the unique non-zero values of @code{lcs[i,j,k]}
or @code{mcs[i,j,k]}, respectively, will be displayed. If the argument is @code{all}
then the unique non-zero values of @code{lcs[i,j,k]} and @code{mcs[i,j,k]} will be
displayed.  If the argument is @code{false} then the display of the elements
will not occur. The array elements @code{mcs[i,j,k]} are defined in such a
manner that the final index is contravariant.

@end deffn

@deffn {Function} ricci (@var{dis})
A function in the @code{ctensor} (component tensor)
package. @code{ricci} computes the covariant (symmetric)
components @code{ric[i,j]} of the Ricci tensor.  If the argument @var{dis} is @code{true},
then the non-zero components are displayed.

@end deffn

@deffn {Function} uricci (@var{dis})
This function first computes the
covariant components @code{ric[i,j]} of the Ricci tensor.
Then the mixed Ricci tensor is computed using the
contravariant metric tensor.  If the value of the argument @var{dis}
is @code{true}, then these mixed components, @code{uric[i,j]} (the
index @code{i} is covariant and the index @code{j} is contravariant), will be displayed
directly.  Otherwise, @code{ricci(false)} will simply compute the entries
of the array @code{uric[i,j]} without displaying the results.

@end deffn

@deffn {Function} scurvature ()
Returns the scalar curvature (obtained by contracting
the Ricci tensor) of the Riemannian manifold with the given metric.

@end deffn

@deffn {Function} einstein (@var{dis})
A function in the @code{ctensor} (component tensor)
package.  @code{einstein} computes the mixed Einstein tensor
after the Christoffel symbols and Ricci tensor have been obtained
(with the functions @code{christof} and @code{ricci}).  If the argument @var{dis} is
@code{true}, then the non-zero values of the mixed Einstein tensor @code{ein[i,j]}
will be displayed where @code{j} is the contravariant index.
The variable @code{rateinstein} will cause the rational simplification on
these components. If @code{ratfac} is @code{true} then the components will
also be factored.

@end deffn

@deffn {Function} leinstein (@var{dis})
Covariant Einstein-tensor. @code{leinstein} stores the values of the covariant Einstein tensor in the array @code{lein}. The covariant Einstein-tensor is computed from the mixed Einstein tensor @code{ein} by multiplying it with the metric tensor. If the argument @var{dis} is @code{true}, then the non-zero values of the covariant Einstein tensor are displayed.

@end deffn

@deffn {Function} riemann (@var{dis})
A function in the @code{ctensor} (component tensor)
package.  @code{riemann} computes the Riemann curvature tensor
from the given metric and the corresponding Christoffel symbols. The following
index conventions are used:

@example
                l      _l       _l       _l   _m    _l   _m
 R[i,j,k,l] =  R    = |      - |      + |    |   - |    |
                ijk     ij,k     ik,j     mk   ij    mj   ik
@end example

This notation is consistent with the notation used by the @code{itensor}
package and its @code{icurvature} function.
If the optional argument @var{dis} is @code{true},
the non-zero components @code{riem[i,j,k,l]} will be displayed.
As with the Einstein tensor, various switches set by the user
control the simplification of the components of the Riemann tensor.
If @code{ratriemann} is @code{true}, then
rational simplification will be done. If @code{ratfac}
is @code{true} then
each of the components will also be factored.

If the variable @code{cframe_flag} is @code{false}, the Riemann tensor is
computed directly from the Christoffel-symbols. If @code{cframe_flag} is
@code{true}, the covariant Riemann-tensor is computed first from the
frame field coefficients.

@end deffn

@deffn {Function} lriemann (@var{dis})
Covariant Riemann-tensor (@code{lriem[]}).

Computes the covariant Riemann-tensor as the array @code{lriem}. If the
argument @var{dis} is @code{true}, unique nonzero values are displayed.

If the variable @code{cframe_flag} is @code{true}, the covariant Riemann
tensor is computed directly from the frame field coefficients. Otherwise,
the (3,1) Riemann tensor is computed first.

For information on index ordering, see @code{riemann}.

@end deffn

@deffn {Function} uriemann (@var{dis})
Computes the contravariant components of the Riemann
curvature tensor as array elements @code{uriem[i,j,k,l]}.  These are displayed
if @var{dis} is @code{true}.

@end deffn

@deffn {Function} rinvariant ()
Forms the Kretchmann-invariant (@code{kinvariant}) obtained by
contracting the tensors

@example
lriem[i,j,k,l]*uriem[i,j,k,l].
@end example

This object is not automatically simplified since it can be very large.

@end deffn

@deffn {Function} weyl (@var{dis})
Computes the Weyl conformal tensor.  If the argument @var{dis} is
@code{true}, the non-zero components @code{weyl[i,j,k,l]} will be displayed to the
user.  Otherwise, these components will simply be computed and stored.
If the switch @code{ratweyl} is set to @code{true}, then the components will be
rationally simplified; if @code{ratfac} is @code{true} then the results will be
factored as well.

@end deffn

@subsection Taylor series expansion

The @code{ctensor} package has the ability to truncate results by assuming
that they are Taylor-series approximations. This behavior is controlled by
the @code{ctayswitch} variable; when set to true, @code{ctensor} makes use
internally of the function @code{ctaylor} when simplifying results.

The @code{ctaylor} function is invoked by the following @code{ctensor} functions:

@example

    Function     Comments
    ---------------------------------
    christof()   For mcs only
    ricci()
    uricci()
    einstein()
    riemann()
    weyl()
    checkdiv()
@end example

@deffn {Function} ctaylor ()

The @code{ctaylor} function truncates its argument by converting
it to a Taylor-series using @code{taylor}, and then calling
@code{ratdisrep}. This has the combined effect of dropping terms
higher order in the expansion variable @code{ctayvar}. The order
of terms that should be dropped is defined by @code{ctaypov}; the
point around which the series expansion is carried out is specified
in @code{ctaypt}.

As an example, consider a simple metric that is a perturbation of
the Minkowski metric. Without further restrictions, even a diagonal
metric produces expressions for the Einstein tensor that are far too
complex:

@example

(%i1) load(ctensor);
(%o1)       /share/tensor/ctensor.mac
(%i2) ratfac:true;
(%o2)                                true
(%i3) derivabbrev:true;
(%o3)                                true
(%i4) ct_coords:[t,r,theta,phi];
(%o4)                         [t, r, theta, phi]
(%i5) lg:matrix([-1,0,0,0],[0,1,0,0],[0,0,r^2,0],[0,0,0,r^2*sin(theta)^2]);
                        [ - 1  0  0         0        ]
                        [                            ]
                        [  0   1  0         0        ]
                        [                            ]
(%o5)                   [          2                 ]
                        [  0   0  r         0        ]
                        [                            ]
                        [              2    2        ]
                        [  0   0  0   r  sin (theta) ]
(%i6) h:matrix([h11,0,0,0],[0,h22,0,0],[0,0,h33,0],[0,0,0,h44]);
                            [ h11   0    0    0  ]
                            [                    ]
                            [  0   h22   0    0  ]
(%o6)                       [                    ]
                            [  0    0   h33   0  ]
                            [                    ]
                            [  0    0    0   h44 ]
(%i7) depends(l,r);
(%o7)                               [l(r)]
(%i8) lg:lg+l*h;
         [ h11 l - 1      0          0                 0            ]
         [                                                          ]
         [     0      h22 l + 1      0                 0            ]
         [                                                          ]
(%o8)    [                        2                                 ]
         [     0          0      r  + h33 l            0            ]
         [                                                          ]
         [                                    2    2                ]
         [     0          0          0       r  sin (theta) + h44 l ]
(%i9) cmetric(false);
(%o9)                                done
(%i10) einstein(false);
(%o10)                               done
(%i11) ntermst(ein);
[[1, 1], 62]
[[1, 2], 0]
[[1, 3], 0]
[[1, 4], 0]
[[2, 1], 0]
[[2, 2], 24]
[[2, 3], 0]
[[2, 4], 0]
[[3, 1], 0]
[[3, 2], 0]
[[3, 3], 46]
[[3, 4], 0]
[[4, 1], 0]
[[4, 2], 0]
[[4, 3], 0]
[[4, 4], 46]
(%o12)                               done

@end example

However, if we recompute this example as an approximation that is
linear in the variable @code{l}, we get much simpler expressions:

@example

(%i14) ctayswitch:true;
(%o14)                               true
(%i15) ctayvar:l;
(%o15)                                 l
(%i16) ctaypov:1;
(%o16)                                 1
(%i17) ctaypt:0;
(%o17)                                 0
(%i18) christof(false);
(%o18)                               done
(%i19) ricci(false);
(%o19)                               done
(%i20) einstein(false);
(%o20)                               done
(%i21) ntermst(ein);
[[1, 1], 6]
[[1, 2], 0]
[[1, 3], 0]
[[1, 4], 0]
[[2, 1], 0]
[[2, 2], 13]
[[2, 3], 2]
[[2, 4], 0]
[[3, 1], 0]
[[3, 2], 2]
[[3, 3], 9]
[[3, 4], 0]
[[4, 1], 0]
[[4, 2], 0]
[[4, 3], 0]
[[4, 4], 9]
(%o21)                               done
(%i22) ratsimp(ein[1,1]);
                         2      2  4               2     2
(%o22) - (((h11 h22 - h11 ) (l )  r  - 2 h33 l    r ) sin (theta)
                              r               r r

                                2               2      4    2
                  - 2 h44 l    r  - h33 h44 (l ) )/(4 r  sin (theta))
                           r r                r



@end example

This capability can be useful, for instance, when working in the weak
field limit far from a gravitational source.

@end deffn


@subsection Frame fields

When the variable @code{cframe_flag} is set to true, the @code{ctensor} package
performs its calculations using a moving frame.

@deffn {Function} frame_bracket (@var{fr}, @var{fri}, @var{diagframe})
The frame bracket (@code{fb[]}).

Computes the frame bracket according to the following definition:

@example
   c          c         c        d     e
ifb   = ( ifri    - ifri    ) ifr   ifr
   ab         d,e       e,d      a     b
@end example

@end deffn

@subsection Algebraic classification

A new feature (as of November, 2004) of @code{ctensor} is its ability to
compute the Petrov classification of a 4-dimensional spacetime metric.
For a demonstration of this capability, see the file
@code{share/tensor/petrov.dem}.

@deffn {Function} nptetrad ()
Computes a Newman-Penrose null tetrad (@code{np}) and its raised-index
counterpart (@code{npi}). See @code{petrov} for an example.

The null tetrad is constructed on the assumption that a four-diemensional
orthonormal frame metric with metric signature (-,+,+,+) is being used.
The components of the null tetrad are related to the inverse frame matrix
as follows:

@example

np  = (fri  + fri ) / sqrt(2)
  1       1      2

np  = (fri  - fri ) / sqrt(2)
  2       1      2

np  = (fri  + %i fri ) / sqrt(2)
  3       3         4

np  = (fri  - %i fri ) / sqrt(2)
  4       3         4

@end example

@end deffn

@deffn {Function} psi (@var{dis})
Computes the five Newman-Penrose coefficients @code{psi[0]}...@code{psi[4]}.
If @code{psi} is set to @code{true}, the coefficients are displayed.
See @code{petrov} for an example.

These coefficients are computed from the Weyl-tensor in a coordinate base.
If a frame base is used, the Weyl-tensor is first converted to a coordinate
base, which can be a computationally expensive procedure. For this reason,
in some cases it may be more advantageous to use a coordinate base in the
first place before the Weyl tensor is computed. Note however, that
constructing a Newman-Penrose null tetrad requires a frame base. Therefore,
a meaningful computation sequence may begin with a frame base, which
is then used to compute @code{lg} (computed automatically by @code{cmetric}
and then @code{ug}. At this point, you can switch back to a coordinate base
by setting @code{cframe_flag} to false before beginning to compute the
Christoffel symbols. Changing to a frame base at a later stage could yield
inconsistent results, as you may end up with a mixed bag of tensors, some
computed in a frame base, some in a coordinate base, with no means to
distinguish between the two.

@end deffn

@deffn {Function} petrov ()
Computes the Petrov classification of the metric characterized by @code{psi[0]}...@code{psi[4]}.

For example, the following demonstrates how to obtain the Petrov-classification
of the Kerr metric:

@example
(%i1) load(ctensor);
(%o1)       /share/tensor/ctensor.mac
(%i2) (cframe_flag:true,gcd:spmod,ctrgsimp:true,ratfac:true);
(%o2)                                true
(%i3) ct_coordsys(exteriorschwarzschild,all);
(%o3)                                done
(%i4) ug:invert(lg)$
(%i5) weyl(false);
(%o5)                                done
(%i6) nptetrad(true);
(%t6) np =

       [  sqrt(r - 2 m)           sqrt(r)                                     ]
       [ ---------------   ---------------------      0             0         ]
       [ sqrt(2) sqrt(r)   sqrt(2) sqrt(r - 2 m)                              ]
       [                                                                      ]
       [  sqrt(r - 2 m)            sqrt(r)                                    ]
       [ ---------------  - ---------------------     0             0         ]
       [ sqrt(2) sqrt(r)    sqrt(2) sqrt(r - 2 m)                             ]
       [                                                                      ]
       [                                              r      %i r sin(theta)  ]
       [        0                    0             -------   ---------------  ]
       [                                           sqrt(2)       sqrt(2)      ]
       [                                                                      ]
       [                                              r       %i r sin(theta) ]
       [        0                    0             -------  - --------------- ]
       [                                           sqrt(2)        sqrt(2)     ]

                             sqrt(r)          sqrt(r - 2 m)
(%t7) npi = matrix([- ---------------------, ---------------, 0, 0],
                      sqrt(2) sqrt(r - 2 m)  sqrt(2) sqrt(r)

          sqrt(r)            sqrt(r - 2 m)
[- ---------------------, - ---------------, 0, 0],
   sqrt(2) sqrt(r - 2 m)    sqrt(2) sqrt(r)

           1               %i
[0, 0, ---------, --------------------],
       sqrt(2) r  sqrt(2) r sin(theta)

           1                 %i
[0, 0, ---------, - --------------------])
       sqrt(2) r    sqrt(2) r sin(theta)

(%o7)                                done
(%i7) psi(true);
(%t8)                              psi  = 0
                                      0

(%t9)                              psi  = 0
                                      1

                                          m
(%t10)                             psi  = --
                                      2    3
                                          r

(%t11)                             psi  = 0
                                      3

(%t12)                             psi  = 0
                                      4
(%o12)                               done
(%i12) petrov();
(%o12)                                 D

@end example

The Petrov classification function is based on the algorithm published in
"Classifying geometries in general relativity: III Classification in practice"
by Pollney, Skea, and d'Inverno, Class. Quant. Grav. 17 2885-2902 (2000).
Except for some simple test cases, the implementation is untested as of
December 19, 2004, and is likely to contain errors.

@end deffn


@subsection Torsion and nonmetricity

@code{ctensor} has the ability to compute and include torsion and nonmetricity
coefficients in the connection coefficients.

The torsion coefficients are calculated from a user-supplied tensor
@code{tr}, which should be a rank (2,1) tensor. From this, the torsion
coefficients @code{kt} are computed according to the following formulae:

@example

              m          m      m
       - g  tr   - g   tr   - tr   g
          im  kj    jm   ki     ij  km
kt   = -------------------------------
  ijk                 2


  k     km
kt   = g   kt
  ij         ijm

@end example

Note that only the mixed-index tensor is calculated and stored in the
array @code{kt}.

The nonmetricity coefficients are calculated from the user-supplied
nonmetricity vector @code{nm}. From this, the nonmetricity coefficients
@code{nmc} are computed as follows:

@example

             k    k        km
       -nm  D  - D  nm  + g   nm  g
   k      i  j    i   j         m  ij
nmc  = ------------------------------
   ij                2

@end example

where D stands for the Kronecker-delta.

When @code{ctorsion_flag} is set to @code{true}, the values of @code{kt}
are substracted from the mixed-indexed connection coefficients computed by
@code{christof} and stored in @code{mcs}. Similarly, if @code{cnonmet_flag}
is set to @code{true}, the values of @code{nmc} are substracted from the
mixed-indexed connection coefficients.

If necessary, @code{christof} calls the functions @code{contortion} and
@code{nonmetricity} in order to compute @code{kt} and @code{nm}.

@deffn {Function} contortion (@var{tr})

Computes the (2,1) contortion coefficients from the torsion tensor @var{tr}.

@end deffn

@deffn {Function} nonmetricity (@var{nm})

Computes the (2,1) nonmetricity coefficients from the nonmetricity
vector @var{nm}.

@end deffn



@subsection Miscellaneous features

@deffn {Function} ctransform (@var{M})
A function in the @code{ctensor} (component tensor)
package which will perform a coordinate transformation
upon an arbitrary square symmetric matrix @var{M}. The user must input the
functions which define the transformation.  (Formerly called @code{transform}.)

@end deffn

@deffn {Function} findde (@var{A}, @var{n})

returns a list of the unique differential equations (expressions)
corresponding to the elements of the @var{n} dimensional square
array @var{A}. Presently, @var{n} may be 2 or 3. @code{deindex} is a global list
containing the indices of @var{A} corresponding to these unique
differential equations. For the Einstein tensor (@code{ein}), which
is a two dimensional array, if computed for the metric in the example
below, @code{findde} gives the following independent differential equations:


@example
(%i1) load(ctensor);
(%o1)       /share/tensor/ctensor.mac
(%i2) derivabbrev:true;
(%o2)                                true
(%i3) dim:4;
(%o3)                                  4
(%i4) lg:matrix([a,0,0,0],[0,x^2,0,0],[0,0,x^2*sin(y)^2,0],[0,0,0,-d]);
                          [ a  0       0        0  ]
                          [                        ]
                          [     2                  ]
                          [ 0  x       0        0  ]
(%o4)                     [                        ]
                          [         2    2         ]
                          [ 0  0   x  sin (y)   0  ]
                          [                        ]
                          [ 0  0       0       - d ]
(%i5) depends([a,d],x);
(%o5)                            [a(x), d(x)]
(%i6) ct_coords:[x,y,z,t];
(%o6)                            [x, y, z, t]
(%i7) cmetric();
(%o7)                                done
(%i8) einstein(false);
(%o8)                                done
(%i9) findde(ein,2);
                                            2
(%o9) [d  x - a d + d, 2 a d d    x - a (d )  x - a  d d  x + 2 a d d
        x                     x x         x        x    x            x

                                                        2          2
                                                - 2 a  d , a  x + a  - a]
                                                     x      x
(%i10) deindex;
(%o10)                     [[1, 1], [2, 2], [4, 4]]

@end example


@end deffn
@deffn {Function} cograd ()
Computes the covariant gradient of a scalar function allowing the
user to choose the corresponding vector name as the example under
@code{contragrad} illustrates.
@end deffn
@deffn {Function} contragrad ()

Computes the contravariant gradient of a scalar function allowing
@c "vector^F2name^F*" LOOKS LIKE IT NEEDS TO BE FIXED UP, NOT SURE HOW THOUGH
the user to choose the corresponding vector name as the example
below for the Schwarzschild metric illustrates:

@example

(%i1) load(ctensor);
(%o1)       /share/tensor/ctensor.mac
(%i2) derivabbrev:true;
(%o2)                                true
(%i3) ct_coordsys(exteriorschwarzschild,all);
(%o3)                                done
(%i4) depends(f,r);
(%o4)                               [f(r)]
(%i5) cograd(f,g1);
(%o5)                                done
(%i6) listarray(g1);
(%o6)                            [0, f , 0, 0]
                                      r
(%i7) contragrad(f,g2);
(%o7)                                done
(%i8) listarray(g2);
                               f  r - 2 f  m
                                r        r
(%o8)                      [0, -------------, 0, 0]
                                     r

@end example

@end deffn
@deffn {Function} dscalar ()
computes the tensor d'Alembertian of the scalar function once
dependencies have been declared upon the function. For example:

@example
(%i1) load(ctensor);
(%o1)       /share/tensor/ctensor.mac
(%i2) derivabbrev:true;
(%o2)                                true
(%i3) ct_coordsys(exteriorschwarzschild,all);
(%o3)                                done
(%i4) depends(p,r);
(%o4)                               [p(r)]
(%i5) factor(dscalar(p));
                          2
                    p    r  - 2 m p    r + 2 p  r - 2 m p
                     r r           r r        r          r
(%o5)               --------------------------------------
                                       2
                                      r
@end example

@end deffn
@deffn {Function} checkdiv ()

computes the covariant divergence of the mixed second rank tensor
(whose first index must be covariant) by printing the
corresponding n components of the vector field (the divergence) where
n = @code{dim}. If the argument to the function is @code{g} then the
divergence of the Einstein tensor will be formed and must be zero.
In addition, the divergence (vector) is given the array name @code{div}.
@end deffn

@deffn {Function} cgeodesic (@var{dis})
A function in the @code{ctensor} (component tensor)
package.  @code{cgeodesic} computes the geodesic equations of
motion for a given metric.  They are stored in the array @code{geod[i]}.  If
the argument @var{dis} is @code{true} then these equations are displayed.

@end deffn


@deffn {Function} bdvac (@var{f})

generates the covariant components of the vacuum field equations of
the Brans- Dicke gravitational theory. The scalar field is specified
by the argument @var{f}, which should be a (quoted) function name
with functional dependencies, e.g., @code{'p(x)}.

The components of the second rank covariant field tensor are
represented by the array @code{bd}.

@end deffn

@deffn {Function} invariant1 ()

generates the mixed Euler- Lagrange tensor (field equations) for the
invariant density of R^2. The field equations are the components of an
array named @code{inv1}.

@end deffn

@deffn {Function} invariant2 ()

*** NOT YET IMPLEMENTED ***

generates the mixed Euler- Lagrange tensor (field equations) for the
invariant density of @code{ric[i,j]*uriem[i,j]}. The field equations are the
components of an array named @code{inv2}.


@end deffn
@deffn {Function} bimetric ()

*** NOT YET IMPLEMENTED ***

generates the field equations of Rosen's bimetric theory. The field
equations are the components of an array named @code{rosen}.

@end deffn

@subsection Utility functions

@deffn {Function} diagmatrixp (@var{M})

Returns @code{true} if @var{M} is a diagonal matrix or (2D) array.

@end deffn

@deffn {Function} symmetricp (@var{M})

Returns @code{true} if @var{M} is a symmetric matrix or (2D) array.

@end deffn

@deffn {Function} ntermst (@var{f})
gives the user a quick picture of the "size" of the doubly subscripted
tensor (array) @var{f}.  It prints two element lists where the second
element corresponds to NTERMS of the components specified by the first
elements.  In this way, it is possible to quickly find the non-zero
expressions and attempt simplification.

@end deffn

@deffn {Function} cdisplay (@var{ten})
displays all the elements of the tensor @var{ten}, as represented by
a multidimensional array. Tensors of rank 0 and 1, as well as other types
of variables, are displayed as with @code{ldisplay}. Tensors of rank 2 are
displayed as 2-dimensional matrices, while tensors of higher rank are displayed
as a list of 2-dimensional matrices. For instance, the Riemann-tensor of
the Schwarzschild metric can be viewed as:

@example
(%i1) load(ctensor);
(%o1)       /share/tensor/ctensor.mac
(%i2) ratfac:true;
(%o2)                                true
(%i3) ct_coordsys(exteriorschwarzschild,all);
(%o3)                                done
(%i4) riemann(false);
(%o4)                                done
(%i5) cdisplay(riem);
               [ 0               0                    0            0      ]
               [                                                          ]
               [                              2                           ]
               [      3 m (r - 2 m)   m    2 m                            ]
               [ 0  - ------------- + -- - ----       0            0      ]
               [            4          3     4                            ]
               [           r          r     r                             ]
               [                                                          ]
    riem     = [                                 m (r - 2 m)              ]
        1, 1   [ 0               0               -----------       0      ]
               [                                      4                   ]
               [                                     r                    ]
               [                                                          ]
               [                                              m (r - 2 m) ]
               [ 0               0                    0       ----------- ]
               [                                                   4      ]
               [                                                  r       ]

                                [    2 m (r - 2 m)       ]
                                [ 0  -------------  0  0 ]
                                [          4             ]
                                [         r              ]
                     riem     = [                        ]
                         1, 2   [ 0        0        0  0 ]
                                [                        ]
                                [ 0        0        0  0 ]
                                [                        ]
                                [ 0        0        0  0 ]

                                [         m (r - 2 m)    ]
                                [ 0  0  - -----------  0 ]
                                [              4         ]
                                [             r          ]
                     riem     = [                        ]
                         1, 3   [ 0  0        0        0 ]
                                [                        ]
                                [ 0  0        0        0 ]
                                [                        ]
                                [ 0  0        0        0 ]

                                [            m (r - 2 m) ]
                                [ 0  0  0  - ----------- ]
                                [                 4      ]
                                [                r       ]
                     riem     = [                        ]
                         1, 4   [ 0  0  0        0       ]
                                [                        ]
                                [ 0  0  0        0       ]
                                [                        ]
                                [ 0  0  0        0       ]

                               [       0         0  0  0 ]
                               [                         ]
                               [       2 m               ]
                               [ - ------------  0  0  0 ]
                    riem     = [    2                    ]
                        2, 1   [   r  (r - 2 m)          ]
                               [                         ]
                               [       0         0  0  0 ]
                               [                         ]
                               [       0         0  0  0 ]

                   [     2 m                                         ]
                   [ ------------  0        0               0        ]
                   [  2                                              ]
                   [ r  (r - 2 m)                                    ]
                   [                                                 ]
                   [      0        0        0               0        ]
                   [                                                 ]
        riem     = [                         m                       ]
            2, 2   [      0        0  - ------------        0        ]
                   [                     2                           ]
                   [                    r  (r - 2 m)                 ]
                   [                                                 ]
                   [                                         m       ]
                   [      0        0        0         - ------------ ]
                   [                                     2           ]
                   [                                    r  (r - 2 m) ]

                                [ 0  0       0        0 ]
                                [                       ]
                                [            m          ]
                                [ 0  0  ------------  0 ]
                     riem     = [        2              ]
                         2, 3   [       r  (r - 2 m)    ]
                                [                       ]
                                [ 0  0       0        0 ]
                                [                       ]
                                [ 0  0       0        0 ]

                                [ 0  0  0       0       ]
                                [                       ]
                                [               m       ]
                                [ 0  0  0  ------------ ]
                     riem     = [           2           ]
                         2, 4   [          r  (r - 2 m) ]
                                [                       ]
                                [ 0  0  0       0       ]
                                [                       ]
                                [ 0  0  0       0       ]

                                      [ 0  0  0  0 ]
                                      [            ]
                                      [ 0  0  0  0 ]
                                      [            ]
                           riem     = [ m          ]
                               3, 1   [ -  0  0  0 ]
                                      [ r          ]
                                      [            ]
                                      [ 0  0  0  0 ]

                                      [ 0  0  0  0 ]
                                      [            ]
                                      [ 0  0  0  0 ]
                                      [            ]
                           riem     = [    m       ]
                               3, 2   [ 0  -  0  0 ]
                                      [    r       ]
                                      [            ]
                                      [ 0  0  0  0 ]

                               [   m                      ]
                               [ - -   0   0       0      ]
                               [   r                      ]
                               [                          ]
                               [        m                 ]
                               [  0   - -  0       0      ]
                    riem     = [        r                 ]
                        3, 3   [                          ]
                               [  0    0   0       0      ]
                               [                          ]
                               [              2 m - r     ]
                               [  0    0   0  ------- + 1 ]
                               [                 r        ]

                                    [ 0  0  0    0   ]
                                    [                ]
                                    [ 0  0  0    0   ]
                                    [                ]
                         riem     = [            2 m ]
                             3, 4   [ 0  0  0  - --- ]
                                    [             r  ]
                                    [                ]
                                    [ 0  0  0    0   ]

                                [       0        0  0  0 ]
                                [                        ]
                                [       0        0  0  0 ]
                                [                        ]
                     riem     = [       0        0  0  0 ]
                         4, 1   [                        ]
                                [      2                 ]
                                [ m sin (theta)          ]
                                [ -------------  0  0  0 ]
                                [       r                ]

                                [ 0        0        0  0 ]
                                [                        ]
                                [ 0        0        0  0 ]
                                [                        ]
                     riem     = [ 0        0        0  0 ]
                         4, 2   [                        ]
                                [         2              ]
                                [    m sin (theta)       ]
                                [ 0  -------------  0  0 ]
                                [          r             ]

                              [ 0  0          0          0 ]
                              [                            ]
                              [ 0  0          0          0 ]
                              [                            ]
                   riem     = [ 0  0          0          0 ]
                       4, 3   [                            ]
                              [                2           ]
                              [         2 m sin (theta)    ]
                              [ 0  0  - ---------------  0 ]
                              [                r           ]

                 [        2                                             ]
                 [   m sin (theta)                                      ]
                 [ - -------------         0                0         0 ]
                 [         r                                            ]
                 [                                                      ]
                 [                         2                            ]
                 [                    m sin (theta)                     ]
      riem     = [        0         - -------------         0         0 ]
          4, 4   [                          r                           ]
                 [                                                      ]
                 [                                          2           ]
                 [                                   2 m sin (theta)    ]
                 [        0                0         ---------------  0 ]
                 [                                          r           ]
                 [                                                      ]
                 [        0                0                0         0 ]

(%o5)                                done

@end example
@end deffn

@deffn {Function} deleten (@var{L}, @var{n})
Returns a new list consisting of @var{L} with the @var{n}'th element
deleted.
@end deffn

@subsection Variables used by @code{ctensor}


@defvr {Option variable} dim
Default value: 4

An option in the @code{ctensor} (component tensor)
package.  @code{dim} is the dimension of the manifold with the
default 4. The command @code{dim: n} will reset the dimension to any other
value @code{n}.

@end defvr

@defvr {Option variable} diagmetric
Default value: @code{false}

An option in the @code{ctensor} (component tensor)
package.  If @code{diagmetric} is @code{true} special routines compute
all geometrical objects (which contain the metric tensor explicitly)
by taking into consideration the diagonality of the metric. Reduced
run times will, of course, result. Note: this option is set
automatically by @code{csetup} if a diagonal metric is specified.

@end defvr

@defvr {Option variable} ctrgsimp

Causes trigonometric simplifications to be used when tensors are computed. Presently,
@code{ctrgsimp} affects only computations involving a moving frame.

@end defvr

@defvr {Option variable} cframe_flag

Causes computations to be performed relative to a moving frame as opposed to
a holonomic metric. The frame is defined by the inverse frame array @code{fri}
and the frame metric @code{lfg}. For computations using a Cartesian frame,
@code{lfg} should be the unit matrix of the appropriate dimension; for
computations in a Lorentz frame, @code{lfg} should have the appropriate
signature.

@end defvr

@defvr {Option variable} ctorsion_flag

Causes the contortion tensor to be included in the computation of the
connection coefficients. The contortion tensor itself is computed by
@code{contortion} from the user-supplied tensor @code{tr}.

@end defvr

@defvr {Option variable} cnonmet_flag

Causes the nonmetricity coefficients to be included in the computation of
the connection coefficients. The nonmetricity coefficients are computed
from the user-supplied nonmetricity vector @code{nm} by the function
@code{nonmetricity}.

@end defvr

@defvr {Option variable} ctayswitch

If set to @code{true}, causes some @code{ctensor} computations to be carried out using
Taylor-series expansions. Presently, @code{christof}, @code{ricci},
@code{uricci}, @code{einstein}, and @code{weyl} take into account this
setting.

@end defvr

@defvr {Option variable} ctayvar

Variable used for Taylor-series expansion if @code{ctayswitch} is set to
@code{true}.

@end defvr

@defvr {Option variable} ctaypov

Maximum power used in Taylor-series expansion when @code{ctayswitch} is
set to @code{true}.

@end defvr

@defvr {Option variable} ctaypt

Point around which Taylor-series expansion is carried out when
@code{ctayswitch} is set to @code{true}.

@end defvr

@defvr {System variable} gdet

The determinant of the metric tensor @code{lg}. Computed by @code{cmetric} when
@code{cframe_flag} is set to @code{false}.

@end defvr

@defvr {Option variable} ratchristof

Causes rational simplification to be applied by @code{christof}.

@end defvr

@defvr {Option variable} rateinstein
Default value: @code{true}

If @code{true} rational simplification will be
performed on the non-zero components of Einstein tensors; if
@code{ratfac} is @code{true} then the components will also be factored.

@end defvr
@defvr {Option variable} ratriemann
Default value: @code{true}

One of the switches which controls
simplification of Riemann tensors; if @code{true}, then rational
simplification will be done; if @code{ratfac} is @code{true} then each of the
components will also be factored.

@end defvr

@defvr {Option variable} ratweyl
Default value: @code{true}

If @code{true}, this switch causes the @code{weyl} function
to apply rational simplification to the values of the Weyl tensor. If
@code{ratfac} is @code{true}, then the components will also be factored.
@end defvr

@defvr {Variable} lfg
The covariant frame metric. By default, it is initialized to the 4-dimensional Lorentz frame with signature (+,+,+,-). Used when @code{cframe_flag} is @code{true}.
@end defvr

@defvr {Variable} ufg
The inverse frame metric. Computed from @code{lfg} when @code{cmetric} is called while @code{cframe_flag} is set to @code{true}.
@end defvr

@defvr {Variable} riem
The (3,1) Riemann tensor. Computed when the function @code{riemann} is invoked. For information about index ordering, see the description of @code{riemann}.

if @code{cframe_flag} is @code{true}, @code{riem} is computed from the covariant Riemann-tensor @code{lriem}.

@end defvr

@defvr {Variable} lriem

The covariant Riemann tensor. Computed by @code{lriemann}.

@end defvr

@defvr {Variable} uriem

The contravariant Riemann tensor. Computed by @code{uriemann}.

@end defvr

@defvr {Variable} ric

The mixed Ricci-tensor. Computed by @code{ricci}.

@end defvr

@defvr {Variable} uric

The contravariant Ricci-tensor. Computed by @code{uricci}.

@end defvr

@defvr {Variable} lg

The metric tensor. This tensor must be specified (as a @code{dim} by @code{dim} matrix)
before other computations can be performed.

@end defvr

@defvr {Variable} ug

The inverse of the metric tensor. Computed by @code{cmetric}.

@end defvr

@defvr {Variable} weyl

The Weyl tensor. Computed by @code{weyl}.

@end defvr

@defvr {Variable} fb

Frame bracket coefficients, as computed by @code{frame_bracket}.

@end defvr

@defvr {Variable} kinvariant

The Kretchmann invariant. Computed by @code{rinvariant}.

@end defvr

@defvr {Variable} np

A Newman-Penrose null tetrad. Computed by @code{nptetrad}.

@end defvr

@defvr {Variable} npi

The raised-index Newman-Penrose null tetrad. Computed by @code{nptetrad}.
Defined as @code{ug.np}. The product @code{np.transpose(npi)} is constant:

@example
(%i39) trigsimp(np.transpose(npi));
                              [  0   - 1  0  0 ]
                              [                ]
                              [ - 1   0   0  0 ]
(%o39)                        [                ]
                              [  0    0   0  1 ]
                              [                ]
                              [  0    0   1  0 ]
@end example

@end defvr

@defvr {Variable} tr

User-supplied rank-3 tensor representing torsion. Used by @code{contortion}.
@end defvr

@defvr {Variable} kt

The contortion tensor, computed from @code{tr} by @code{contortion}.
@end defvr

@defvr {Variable} nm

User-supplied nonmetricity vector. Used by @code{nonmetricity}.
@end defvr

@defvr {Variable} nmc

The nonmetricity coefficients, computed from @code{nm} by @code{nonmetricity}.

@end defvr

@defvr {System variable} tensorkill

Variable indicating if the tensor package has been initialized. Set and used by
@code{csetup}, reset by @code{init_ctensor}.

@end defvr

@defvr {Option variable} ct_coords
Default value: @code{[]}

An option in the @code{ctensor} (component tensor)
package.  @code{ct_coords} contains a list of coordinates.
While normally defined when the function @code{csetup} is called,
one may redefine the coordinates with the assignment
@code{ct_coords: [j1, j2, ..., jn]} where the j's are the new coordinate names.
See also @code{csetup}.

@end defvr

@subsection Reserved names

The following names are used internally by the @code{ctensor} package and
should not be redefined:

@example
  Name         Description
  ---------------------------------------
  _lg()        Evaluates to lfg if frame metric used, lg otherwise
  _ug()        Evaluates to ufg if frame metric used, ug otherwise
  cleanup()    Removes items drom the deindex list
  contract4()  Used by psi()
  filemet()    Used by csetup() when reading the metric from a file
  findde1()    Used by findde()
  findde2()    Used by findde()
  findde3()    Used by findde()
  kdelt()      Kronecker-delta (not generalized)
  newmet()     Used by csetup() for setting up a metric interactively
  setflags()   Used by init_ctensor()
  readvalue()
  resimp()
  sermet()     Used by csetup() for entering a metric as Taylor-series
  txyzsum()
  tmetric()    Frame metric, used by cmetric() when cframe_flag:true
  triemann()   Riemann-tensor in frame base, used when cframe_flag:true
  tricci()     Ricci-tensor in frame base, used when cframe_flag:true
  trrc()       Ricci rotation coefficients, used by christof()
  yesp()
@end example


@subsection Changes

In November, 2004, the @code{ctensor} package was extensively rewritten.
Many functions and variables have been renamed in order to make the
package compatible with the commercial version of Macsyma.


@example
  New Name     Old Name        Description
  --------------------------------------------------------------------------
  ctaylor()    DLGTAYLOR()     Taylor-series expansion of an expression
  lgeod[]      EM              Geodesic equations
  ein[]        G[]             Mixed Einstein-tensor
  ric[]        LR[]            Mixed Ricci-tensor
  ricci()      LRICCICOM()     Compute the mixed Ricci-tensor
  ctaypov      MINP            Maximum power in Taylor-series expansion
  cgeodesic()  MOTION          Compute geodesic equations
  ct_coords    OMEGA           Metric coordinates
  ctayvar      PARAM           Taylor-series expansion variable
  lriem[]      R[]             Covariant Riemann-tensor
  uriemann()   RAISERIEMANN()  Compute the contravariant Riemann-tensor
  ratriemann   RATRIEMAN       Rational simplification of the Riemann-tensor
  uric[]       RICCI[]         Contravariant Ricci-tensor
  uricci()     RICCICOM()      Compute the contravariant Ricci-tensor
  cmetric()    SETMETRIC()     Set up the metric
  ctaypt       TAYPT           Point for Taylor-series expansion
  ctayswitch   TAYSWITCH       Taylor-series setting switch
  csetup()     TSETUP()        Start interactive setup session
  ctransform() TTRANSFORM()    Interactive coordinate transformation
  uriem[]      UR[]            Contravariant Riemann-tensor
  weyl[]       W[]             (3,1) Weyl-tensor

@end example