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 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086
|
@c RECOMMEND REVISE TEXT THROUGHOUT TO LOSE NOTION OF TIME RELATIVE TO PRESENT
@c LOOK FOR "NOW", "OLD", "NEW", "RECENT", "EARLIER", DATES
@c RERUN EXAMPLES WITH ADDT'L WHITESPACE IN INPUT TO AID LEGIBILITY
@menu
* Introduction to itensor::
* Definitions for itensor::
@end menu
@node Introduction to itensor, Definitions for itensor, itensor, itensor
@section Introduction to itensor
Maxima implements symbolic tensor manipulation of two distinct types:
component tensor manipulation (@code{ctensor} package) and indicial tensor manipulation (@code{itensor} package).
Nota bene: Please see the note on 'new tensor notation' below.
Component tensor manipulation means that geometrical tensor
objects are represented as arrays or matrices. Tensor operations such
as contraction or covariant differentiation are carried out by
actually summing over repeated (dummy) indices with @code{do} statements.
That is, one explicitly performs operations on the appropriate tensor
components stored in an array or matrix.
Indicial tensor manipulation is implemented by representing
tensors as functions of their covariant, contravariant and derivative
indices. Tensor operations such as contraction or covariant
differentiation are performed by manipulating the indices themselves
rather than the components to which they correspond.
These two approaches to the treatment of differential, algebraic and
analytic processes in the context of Riemannian geometry have various
advantages and disadvantages which reveal themselves only through the
particular nature and difficulty of the user's problem. However, one
should keep in mind the following characteristics of the two
implementations:
The representation of tensors and tensor operations explicitly in
terms of their components makes @code{ctensor} easy to use. Specification of
the metric and the computation of the induced tensors and invariants
is straightforward. Although all of Maxima's powerful simplification
capacity is at hand, a complex metric with intricate functional and
coordinate dependencies can easily lead to expressions whose size is
excessive and whose structure is hidden. In addition, many calculations
involve intermediate expressions which swell causing programs to
terminate before completion. Through experience, a user can avoid
many of these difficulties.
Because of the special way in which tensors and tensor operations
are represented in terms of symbolic operations on their indices,
expressions which in the component representation would be
unmanageable can sometimes be greatly simplified by using the special
routines for symmetrical objects in @code{itensor}. In this way the structure
of a large expression may be more transparent. On the other hand, because
of the the special indicial representation in @code{itensor}, in some cases the
user may find difficulty with the specification of the metric, function
definition, and the evaluation of differentiated "indexed" objects.
@subsection New tensor notation
Until now, the @code{itensor} package in Maxima has used a notation that sometimes
led to incorrect index ordering. Consider the following, for instance:
@example
(%i2) imetric(g);
(%o2) done
(%i3) ishow(g([],[j,k])*g([],[i,l])*a([i,j],[]))$
i l j k
(%t3) g g a
i j
(%i4) ishow(contract(%))$
k l
(%t4) a
@end example
This result is incorrect unless @code{a} happens to be a symmetric tensor.
The reason why this happens is that although @code{itensor} correctly maintains
the order within the set of covariant and contravariant indices, once an
index is raised or lowered, its position relative to the other set of
indices is lost.
To avoid this problem, a new notation has been developed that remains fully
compatible with the existing notation and can be used interchangeably. In
this notation, contravariant indices are inserted in the appropriate
positions in the covariant index list, but with a minus sign prepended.
Functions like @code{contract} and @code{ishow} are now aware of this
new index notation and can process tensors appropriately.
In this new notation, the previous example yields a correct result:
@example
(%i5) ishow(g([-j,-k],[])*g([-i,-l],[])*a([i,j],[]))$
i l j k
(%t5) g a g
i j
(%i6) ishow(contract(%))$
l k
(%t6) a
@end example
Presently, the only code that makes use of this notation is the @code{lc2kdt}
function. Through this notation, it achieves consistent results as it
applies the metric tensor to resolve Levi-Civita symbols without resorting
to numeric indices.
Since this code is brand new, it probably contains bugs. While it has been
tested to make sure that it doesn't break anything using the "old" tensor
notation, there is a considerable chance that "new" tensors will fail to
interoperate with certain functions or features. These bugs will be fixed
as they are encountered... until then, caveat emptor!
@subsection Indicial tensor manipulation
The indicial tensor manipulation package may be loaded by
@code{load(itensor)}. Demos are also available: try @code{demo(tensor)}.
In @code{itensor} a tensor is represented as an "indexed object" . This is a
function of 3 groups of indices which represent the covariant,
contravariant and derivative indices. The covariant indices are
specified by a list as the first argument to the indexed object, and
the contravariant indices by a list as the second argument. If the
indexed object lacks either of these groups of indices then the empty
list @code{[]} is given as the corresponding argument. Thus, @code{g([a,b],[c])}
represents an indexed object called @code{g} which has two covariant indices
@code{(a,b)}, one contravariant index (@code{c}) and no derivative indices.
The derivative indices, if they are present, are appended as
additional arguments to the symbolic function representing the tensor.
They can be explicitly specified by the user or be created in the
process of differentiation with respect to some coordinate variable.
Since ordinary differentiation is commutative, the derivative indices
are sorted alphanumerically, unless @code{iframe_flag} is set to @code{true},
indicating that a frame metric is being used. This canonical ordering makes it
possible for Maxima to recognize that, for example, @code{t([a],[b],i,j)} is
the same as @code{t([a],[b],j,i)}. Differentiation of an indexed object with
respect to some coordinate whose index does not appear as an argument
to the indexed object would normally yield zero. This is because
Maxima would not know that the tensor represented by the indexed
object might depend implicitly on the corresponding coordinate. By
modifying the existing Maxima function @code{diff} in @code{itensor}, Maxima now
assumes that all indexed objects depend on any variable of
differentiation unless otherwise stated. This makes it possible for
the summation convention to be extended to derivative indices. It
should be noted that @code{itensor} does not possess the capabilities of
raising derivative indices, and so they are always treated as
covariant.
The following functions are available in the tensor package for
manipulating indexed objects. At present, with respect to the
simplification routines, it is assumed that indexed objects do not
by default possess symmetry properties. This can be overridden by
setting the variable @code{allsym[false]} to @code{true}, which will
result in treating all indexed objects completely symmetric in their
lists of covariant indices and symmetric in their lists of
contravariant indices.
The @code{itensor} package generally treats tensors as opaque objects. Tensorial
equations are manipulated based on algebraic rules, specifically symmetry
and contraction rules. In addition, the @code{itensor} package understands
covariant differentiation, curvature, and torsion. Calculations can be
performed relative to a metric of moving frame, depending on the setting
of the @code{iframe_flag} variable.
A sample session below demonstrates how to load the @code{itensor} package,
specify the name of the metric, and perform some simple calculations.
@example
(%i1) load(itensor);
(%o1) /share/tensor/itensor.lisp
(%i2) imetric(g);
(%o2) done
(%i3) components(g([i,j],[]),p([i,j],[])*e([],[]))$
(%i4) ishow(g([k,l],[]))$
(%t4) e p
k l
(%i5) ishow(diff(v([i],[]),t))$
(%t5) 0
(%i6) depends(v,t);
(%o6) [v(t)]
(%i7) ishow(diff(v([i],[]),t))$
d
(%t7) -- (v )
dt i
(%i8) ishow(idiff(v([i],[]),j))$
(%t8) v
i,j
(%i9) ishow(extdiff(v([i],[]),j))$
(%t9) v - v
j,i i,j
-----------
2
(%i10) ishow(liediff(v,w([i],[])))$
%3 %3
(%t10) v w + v w
i,%3 ,i %3
(%i11) ishow(covdiff(v([i],[]),j))$
%4
(%t11) v - v ichr2
i,j %4 i j
(%i12) ishow(ev(%,ichr2))$
%4 %5
(%t12) v - g v (e p + e p - e p - e p
i,j %4 j %5,i ,i j %5 i j,%5 ,%5 i j
+ e p + e p )/2
i %5,j ,j i %5
(%i13) iframe_flag:true;
(%o13) true
(%i14) ishow(covdiff(v([i],[]),j))$
%6
(%t14) v - v icc2
i,j %6 i j
(%i15) ishow(ev(%,icc2))$
%6
(%t15) v - v ifc2
i,j %6 i j
(%i16) ishow(radcan(ev(%,ifc2,ifc1)))$
%6 %8 %6 %8
(%t16) - (ifg v ifb + ifg v ifb - 2 v
%6 j %8 i %6 i j %8 i,j
%6 %8
- ifg v ifb )/2
%6 %8 i j
(%i17) ishow(canform(s([i,j],[])-s([j,i])))$
(%t17) s - s
i j j i
(%i18) decsym(s,2,0,[sym(all)],[]);
(%o18) done
(%i19) ishow(canform(s([i,j],[])-s([j,i])))$
(%t19) 0
(%i20) ishow(canform(a([i,j],[])+a([j,i])))$
(%t20) a + a
j i i j
(%i21) decsym(a,2,0,[anti(all)],[]);
(%o21) done
(%i22) ishow(canform(a([i,j],[])+a([j,i])))$
(%t22) 0
@end example
@c end concepts itensor
@node Definitions for itensor, , Introduction to itensor, itensor
@section Definitions for itensor
@subsection Managing indexed objects
@deffn {Function} entertensor (@var{name})
is a function which, by prompting, allows one to create an indexed
object called @var{name} with any number of tensorial and derivative
indices. Either a single index or a list of indices (which may be
null) is acceptable input (see the example under @code{covdiff}).
@end deffn
@deffn {Function} changename (@var{old}, @var{new}, @var{expr})
will change the name of all indexed objects called @var{old} to @var{new}
in @var{expr}. @var{old} may be either a symbol or a list of the form
@code{[@var{name}, @var{m}, @var{n}]} in which case only those indexed objects called
@var{name} with @var{m} covariant and @var{n} contravariant indices will be
renamed to @var{new}.
@end deffn
@deffn {Function} listoftens
Lists all tensors in a tensorial expression, complete with their indices. E.g.,
@example
(%i6) ishow(a([i,j],[k])*b([u],[],v)+c([x,y],[])*d([],[])*e)$
k
(%t6) d e c + a b
x y i j u,v
(%i7) ishow(listoftens(%))$
k
(%t7) [a , b , c , d]
i j u,v x y
@end example
@end deffn
@deffn {Function} ishow (@var{expr})
displays @var{expr} with the indexed objects in it shown having their
covariant indices as subscripts and contravariant indices as
superscripts. The derivative indices are displayed as subscripts,
separated from the covariant indices by a comma (see the examples
throughout this document).
@end deffn
@deffn {Function} indices (@var{expr})
Returns a list of two elements. The first is a list of the free
indices in @var{expr} (those that occur only once). The second is the
list of the dummy indices in @var{expr} (those that occur exactly twice)
as the following example demonstrates.
@example
(%i1) load(itensor);
(%o1) /share/tensor/itensor.lisp
(%i2) ishow(a([i,j],[k,l],m,n)*b([k,o],[j,m,p],q,r))$
k l j m p
(%t2) a b
i j,m n k o,q r
(%i3) indices(%);
(%o3) [[l, p, i, n, o, q, r], [k, j, m]]
@end example
A tensor product containing the same index more than twice is syntactically
illegal. @code{indices} attempts to deal with these expressions in a
reasonable manner; however, when it is called to operate upon such an
illegal expression, its behavior should be considered undefined.
@end deffn
@deffn {Function} rename (@var{expr})
@deffnx {Function} rename (@var{expr}, @var{count})
Returns an expression equivalent to @var{expr} but with the dummy indices
in each term chosen from the set @code{[%1, %2,...]}, if the optional second
argument is omitted. Otherwise, the dummy indices are indexed
beginning at the value of @var{count}. Each dummy index in a product
will be different. For a sum, @code{rename} will operate upon each term in
the sum resetting the counter with each term. In this way @code{rename} can
serve as a tensorial simplifier. In addition, the indices will be
sorted alphanumerically (if @code{allsym} is @code{true}) with respect to
covariant or contravariant indices depending upon the value of @code{flipflag}.
If @code{flipflag} is @code{false} then the indices will be renamed according
to the order of the contravariant indices. If @code{flipflag} is @code{true}
the renaming will occur according to the order of the covariant
indices. It often happens that the combined effect of the two renamings will
reduce an expression more than either one by itself.
@example
(%i1) load(itensor);
(%o1) /share/tensor/itensor.lisp
(%i2) allsym:true;
(%o2) true
(%i3) g([],[%4,%5])*g([],[%6,%7])*ichr2([%1,%4],[%3])*
ichr2([%2,%3],[u])*ichr2([%5,%6],[%1])*ichr2([%7,r],[%2])-
g([],[%4,%5])*g([],[%6,%7])*ichr2([%1,%2],[u])*
ichr2([%3,%5],[%1])*ichr2([%4,%6],[%3])*ichr2([%7,r],[%2]),noeval$
(%i4) expr:ishow(%)$
%4 %5 %6 %7 %3 u %1 %2
(%t4) g g ichr2 ichr2 ichr2 ichr2
%1 %4 %2 %3 %5 %6 %7 r
%4 %5 %6 %7 u %1 %3 %2
- g g ichr2 ichr2 ichr2 ichr2
%1 %2 %3 %5 %4 %6 %7 r
(%i5) flipflag:true;
(%o5) true
(%i6) ishow(rename(expr))$
%2 %5 %6 %7 %4 u %1 %3
(%t6) g g ichr2 ichr2 ichr2 ichr2
%1 %2 %3 %4 %5 %6 %7 r
%4 %5 %6 %7 u %1 %3 %2
- g g ichr2 ichr2 ichr2 ichr2
%1 %2 %3 %4 %5 %6 %7 r
(%i7) flipflag:false;
(%o7) false
(%i8) rename(%th(2));
(%o8) 0
(%i9) ishow(rename(expr))$
%1 %2 %3 %4 %5 %6 %7 u
(%t9) g g ichr2 ichr2 ichr2 ichr2
%1 %6 %2 %3 %4 r %5 %7
%1 %2 %3 %4 %6 %5 %7 u
- g g ichr2 ichr2 ichr2 ichr2
%1 %3 %2 %6 %4 r %5 %7
@end example
@end deffn
@defvr {Option variable} flipflag
Default: @code{false}. If @code{false} then the indices will be
renamed according to the order of the contravariant indices,
otherwise according to the order of the covariant indices.
If @code{flipflag} is @code{false} then @code{rename} forms a list
of the contravariant indices as they are encountered from left to right
(if @code{true} then of the covariant indices). The first dummy
index in the list is renamed to @code{%1}, the next to @code{%2}, etc.
Then sorting occurs after the @code{rename}-ing (see the example
under @code{rename}).
@end defvr
@deffn {Function} defcon (@var{tensor_1})
@deffnx {Function} defcon (@var{tensor_1}, @var{tensor_2}, @var{tensor_3})
gives @var{tensor_1} the property that the
contraction of a product of @var{tensor_1} and @var{tensor_2} results in @var{tensor_3}
with the appropriate indices. If only one argument, @var{tensor_1}, is
given, then the contraction of the product of @var{tensor_1} with any indexed
object having the appropriate indices (say @code{my_tensor}) will yield an
indexed object with that name, i.e. @code{my_tensor}, and with a new set of
indices reflecting the contractions performed.
For example, if @code{imetric:g}, then @code{defcon(g)} will implement the
raising and lowering of indices through contraction with the metric
tensor.
More than one @code{defcon} can be given for the same indexed object; the
latest one given which applies in a particular contraction will be
used.
@code{contractions} is a list of those indexed objects which have been given
contraction properties with @code{defcon}.
@end deffn
@deffn {Function} remcon (@var{tensor_1}, ..., @var{tensor_n})
@deffnx {Function} remcon (all)
removes all the contraction properties
from the @var{tensor_1}, ..., @var{tensor_n}). @code{remcon(all)} removes all contraction
properties from all indexed objects.
@end deffn
@deffn {Function} contract (@var{expr})
Carries out the tensorial contractions in @var{expr} which may be any
combination of sums and products. This function uses the information
given to the @code{defcon} function. For best results, @code{expr}
should be fully expanded. @code{ratexpand} is the fastest way to expand
products and powers of sums if there are no variables in the denominators
of the terms. The @code{gcd} switch should be @code{false} if GCD
cancellations are unnecessary.
@end deffn
@deffn {Function} indexed_tensor (@var{tensor})
Must be executed before assigning components to a @var{tensor} for which
a built in value already exists as with @code{ichr1}, @code{ichr2},
@code{icurvature}. See the example under @code{icurvature}.
@end deffn
@deffn {Function} components (@var{tensor}, @var{expr})
permits one to assign an indicial value to an expression
@var{expr} giving the values of the components of @var{tensor}. These
are automatically substituted for the tensor whenever it occurs with
all of its indices. The tensor must be of the form @code{t([...],[...])}
where either list may be empty. @var{expr} can be any indexed expression
involving other objects with the same free indices as @var{tensor}. When
used to assign values to the metric tensor wherein the components
contain dummy indices one must be careful to define these indices to
avoid the generation of multiple dummy indices. Removal of this
assignment is given to the function @code{remcomps}.
It is important to keep in mind that @code{components} cares only about
the valence of a tensor, not about any particular index ordering. Thus
assigning components to, say, @code{x([i,-j],[])}, @code{x([-j,i],[])}, or
@code{x([i],[j])} all produce the same result, namely components being
assigned to a tensor named @code{x} with valence @code{(1,1)}.
Components can be assigned to an indexed expression in four ways, two
of which involve the use of the @code{components} command:
1) As an indexed expression. For instance:
@example
(%i2) components(g([],[i,j]),e([],[i])*p([],[j]))$
(%i3) ishow(g([],[i,j]))$
i j
(%t3) e p
@end example
2) As a matrix:
@example
(%i6) components(g([i,j],[]),lg);
(%o6) done
(%i7) ishow(g([i,j],[]))$
(%t7) g
i j
(%i8) g([3,3],[]);
(%o8) 1
(%i9) g([4,4],[]);
(%o9) - 1
@end example
3) As a function. You can use a Maxima function to specify the
components of a tensor based on its indices. For instance, the following
code assigns @code{kdelta} to @code{h} if @code{h} has the same number
of covariant and contravariant indices and no derivative indices, and
@code{g} otherwise:
@example
(%i4) h(l1,l2,[l3]):=if length(l1)=length(l2) and length(l3)=0
then kdelta(l1,l2) else apply(g,append([l1,l2], l3))$
(%i5) ishow(h([i],[j]))$
j
(%t5) kdelta
i
(%i6) ishow(h([i,j],[k],l))$
k
(%t6) g
i j,l
@end example
4) Using Maxima's pattern matching capabilities, specifically the
@code{defrule} and @code{applyb1} commands:
@example
(%i1) load(itensor);
(%o1) /share/tensor/itensor.lisp
(%i2) matchdeclare(l1,listp);
(%o2) done
(%i3) defrule(r1,m(l1,[]),(i1:idummy(),
g([l1[1],l1[2]],[])*q([i1],[])*e([],[i1])))$
(%i4) defrule(r2,m([],l1),(i1:idummy(),
w([],[l1[1],l1[2]])*e([i1],[])*q([],[i1])))$
(%i5) ishow(m([i,n],[])*m([],[i,m]))$
i m
(%t5) m m
i n
(%i6) ishow(rename(applyb1(%,r1,r2)))$
%1 %2 %3 m
(%t6) e q w q e g
%1 %2 %3 n
@end example
@end deffn
@deffn {Function} remcomps (@var{tensor})
Unbinds all values from @var{tensor} which were assigned with the
@code{components} function.
@end deffn
@c NEED LIST OF ARGUMENTS HERE
@deffn {Function} showcomps (@var{tensor})
Shows component assignments of a tensor, as made using the @code{components}
command. This function can be particularly useful when a matrix is assigned
to an indicial tensor using @code{components}, as demonstrated by the
following example:
@example
(%i1) load(ctensor);
(%o1) /share/tensor/ctensor.mac
(%i2) load(itensor);
(%o2) /share/tensor/itensor.lisp
(%i3) lg:matrix([sqrt(r/(r-2*m)),0,0,0],[0,r,0,0],
[0,0,sin(theta)*r,0],[0,0,0,sqrt((r-2*m)/r)]);
[ r ]
[ sqrt(-------) 0 0 0 ]
[ r - 2 m ]
[ ]
[ 0 r 0 0 ]
(%o3) [ ]
[ 0 0 r sin(theta) 0 ]
[ ]
[ r - 2 m ]
[ 0 0 0 sqrt(-------) ]
[ r ]
(%i4) components(g([i,j],[]),lg);
(%o4) done
(%i5) showcomps(g([i,j],[]));
[ r ]
[ sqrt(-------) 0 0 0 ]
[ r - 2 m ]
[ ]
[ 0 r 0 0 ]
(%t5) g = [ ]
i j [ 0 0 r sin(theta) 0 ]
[ ]
[ r - 2 m ]
[ 0 0 0 sqrt(-------) ]
[ r ]
(%o5) false
@end example
The @code{showcomps} command can also display components of a tensor of
rank higher than 2.
@end deffn
@deffn {Function} idummy ()
Increments @code{icounter} and returns as its value an index of the form
@code{%n} where n is a positive integer. This guarantees that dummy indices
which are needed in forming expressions will not conflict with indices
already in use (see the example under @code{indices}).
@end deffn
@defvr {Option variable} idummyx
Default value: @code{%}
Is the prefix for dummy indices (see the example under @code{indices}).
@end defvr
@defvr {Option variable} icounter
Default value: @code{1}
Determines the numerical suffix to be used in
generating the next dummy index in the tensor package. The prefix is
determined by the option @code{idummy} (default: @code{%}).
@end defvr
@deffn {Function} kdelta (@var{L1}, @var{L2})
is the generalized Kronecker delta function defined in
the @code{itensor} package with @var{L1} the list of covariant indices and @var{L2}
the list of contravariant indices. @code{kdelta([i],[j])} returns the ordinary
Kronecker delta. The command @code{ev(@var{expr},kdelta)} causes the evaluation of
an expression containing @code{kdelta([],[])} to the dimension of the
manifold.
In what amounts to an abuse of this notation, @code{itensor} also allows
@code{kdelta} to have 2 covariant and no contravariant, or 2 contravariant
and no covariant indices, in effect providing a co(ntra)variant "unit matrix"
capability. This is strictly considered a programming aid and not meant to
imply that @code{kdelta([i,j],[])} is a valid tensorial object.
@end deffn
@deffn {Function} kdels (@var{L1}, @var{L2})
Symmetricized Kronecker delta, used in some calculations. For instance:
@example
(%i1) load(itensor);
(%o1) /share/tensor/itensor.lisp
(%i2) kdelta([1,2],[2,1]);
(%o2) - 1
(%i3) kdels([1,2],[2,1]);
(%o3) 1
(%i4) ishow(kdelta([a,b],[c,d]))$
c d d c
(%t4) kdelta kdelta - kdelta kdelta
a b a b
(%i4) ishow(kdels([a,b],[c,d]))$
c d d c
(%t4) kdelta kdelta + kdelta kdelta
a b a b
@end example
@end deffn
@deffn {Function} levi_civita (@var{L})
is the permutation (or Levi-Civita) tensor which yields 1 if
the list @var{L} consists of an even permutation of integers, -1 if it
consists of an odd permutation, and 0 if some indices in @var{L} are
repeated.
@end deffn
@deffn {Function} lc2kdt (@var{expr})
Simplifies expressions containing the Levi-Civita symbol, converting these
to Kronecker-delta expressions when possible. The main difference between
this function and simply evaluating the Levi-Civita symbol is that direct
evaluation often results in Kronecker expressions containing numerical
indices. This is often undesirable as it prevents further simplification.
The @code{lc2kdt} function avoids this problem, yielding expressions that
are more easily simplified with @code{rename} or @code{contract}.
@example
(%i1) load(itensor);
(%o1) /share/tensor/itensor.lisp
(%i2) expr:ishow('levi_civita([],[i,j])*'levi_civita([k,l],[])*a([j],[k]))$
i j k
(%t2) levi_civita a levi_civita
j k l
(%i3) ishow(ev(expr,levi_civita))$
i j k 1 2
(%t3) kdelta a kdelta
1 2 j k l
(%i4) ishow(ev(%,kdelta))$
i j j i k
(%t4) (kdelta kdelta - kdelta kdelta ) a
1 2 1 2 j
1 2 2 1
(kdelta kdelta - kdelta kdelta )
k l k l
(%i5) ishow(lc2kdt(expr))$
k i j k j i
(%t5) a kdelta kdelta - a kdelta kdelta
j k l j k l
(%i6) ishow(contract(expand(%)))$
i i
(%t6) a - a kdelta
l l
@end example
The @code{lc2kdt} function sometimes makes use of the metric tensor.
If the metric tensor was not defined previously with @code{imetric},
this results in an error.
@example
(%i7) expr:ishow('levi_civita([],[i,j])*'levi_civita([],[k,l])*a([j,k],[]))$
i j k l
(%t7) levi_civita levi_civita a
j k
(%i8) ishow(lc2kdt(expr))$
Maxima encountered a Lisp error:
Error in $IMETRIC [or a callee]:
$IMETRIC [or a callee] requires less than two arguments.
Automatically continuing.
To reenable the Lisp debugger set *debugger-hook* to nil.
(%i9) imetric(g);
(%o9) done
(%i10) ishow(lc2kdt(expr))$
%3 i k %4 j l %3 i l %4 j k
(%t10) (g kdelta g kdelta - g kdelta g kdelta ) a
%3 %4 %3 %4 j k
(%i11) ishow(contract(expand(%)))$
l i l i
(%t11) a - a g
@end example
@end deffn
@c HMM, WHICH CATEGORY DOES THIS FALL INTO -- FUNCTION, VARIABLE, OTHER ??
@deffn {Function} lc_l
Simplification rule used for expressions containing the unevaluated Levi-Civita
symbol (@code{levi_civita}). Along with @code{lc_u}, it can be used to simplify
many expressions more efficiently than the evaluation of @code{levi_civita}.
For example:
@example
(%i1) load(itensor);
(%o1) /share/tensor/itensor.lisp
(%i2) el1:ishow('levi_civita([i,j,k],[])*a([],[i])*a([],[j]))$
i j
(%t2) a a levi_civita
i j k
(%i3) el2:ishow('levi_civita([],[i,j,k])*a([i])*a([j]))$
i j k
(%t3) levi_civita a a
i j
(%i4) ishow(canform(contract(expand(applyb1(el1,lc_l,lc_u)))))$
(%t4) 0
(%i5) ishow(canform(contract(expand(applyb1(el2,lc_l,lc_u)))))$
(%t5) 0
@end example
@end deffn
@c HMM, WHICH CATEGORY DOES THIS FALL INTO -- FUNCTION, VARIABLE, OTHER ??
@deffn {Function} lc_u
Simplification rule used for expressions containing the unevaluated Levi-Civita
symbol (@code{levi_civita}). Along with @code{lc_u}, it can be used to simplify
many expressions more efficiently than the evaluation of @code{levi_civita}.
For details, see @code{lc_l}.
@end deffn
@deffn {Function} canten (@var{expr})
Simplifies @var{expr} by renaming (see @code{rename})
and permuting dummy indices. @code{rename} is restricted to sums of tensor
products in which no derivatives are present. As such it is limited
and should only be used if @code{canform} is not capable of carrying out the
required simplification.
The @code{canten} function returns a mathematically correct result only
if its argument is an expression that is fully symmetric in its indices.
For this reason, @code{canten} returns an error if @code{allsym} is not
set to @code{true}.
@end deffn
@deffn {Function} concan (@var{expr})
Similar to @code{canten} but also performs index contraction.
@end deffn
@subsection Tensor symmetries
@defvr {Option variable} allsym
Default: @code{false}. if @code{true} then all indexed objects
are assumed symmetric in all of their covariant and contravariant
indices. If @code{false} then no symmetries of any kind are assumed
in these indices. Derivative indices are always taken to be symmetric
unless @code{iframe_flag} is set to @code{true}.
@end defvr
@deffn {Function} decsym (@var{tensor}, @var{m}, @var{n}, [@var{cov_1}, @var{cov_2}, ...], [@var{contr_1}, @var{contr_2}, ...])
Declares symmetry properties for @var{tensor} of @var{m} covariant and
@var{n} contravariant indices. The @var{cov_i} and @var{contr_i} are
pseudofunctions expressing symmetry relations among the covariant and
contravariant indices respectively. These are of the form
@code{symoper(@var{index_1}, @var{index_2},...)} where @code{symoper} is one of
@code{sym}, @code{anti} or @code{cyc} and the @var{index_i} are integers
indicating the position of the index in the @var{tensor}. This will
declare @var{tensor} to be symmetric, antisymmetric or cyclic respectively
in the @var{index_i}. @code{symoper(all)} is also an allowable form which
indicates all indices obey the symmetry condition. For example, given an
object @code{b} with 5 covariant indices,
@code{decsym(b,5,3,[sym(1,2),anti(3,4)],[cyc(all)])} declares @code{b}
symmetric in its first and second and antisymmetric in its third and
fourth covariant indices, and cyclic in all of its contravariant indices.
Either list of symmetry declarations may be null. The function which
performs the simplifications is @code{canform} as the example below
illustrates.
@example
(%i1) load(itensor);
(%o1) /share/tensor/itensor.lisp
(%i2) expr:contract(expand(a([i1,j1,k1],[])*kdels([i,j,k],[i1,j1,k1])))$
(%i3) ishow(expr)$
(%t3) a + a + a + a + a + a
k j i k i j j k i j i k i k j i j k
(%i4) decsym(a,3,0,[sym(all)],[]);
(%o4) done
(%i5) ishow(canform(expr))$
(%t5) 6 a
i j k
(%i6) remsym(a,3,0);
(%o6) done
(%i7) decsym(a,3,0,[anti(all)],[]);
(%o7) done
(%i8) ishow(canform(expr))$
(%t8) 0
(%i9) remsym(a,3,0);
(%o9) done
(%i10) decsym(a,3,0,[cyc(all)],[]);
(%o10) done
(%i11) ishow(canform(expr))$
(%t11) 3 a + 3 a
i k j i j k
(%i12) dispsym(a,3,0);
(%o12) [[cyc, [[1, 2, 3]], []]]
@end example
@end deffn
@deffn {Function} remsym (@var{tensor}, @var{m}, @var{n})
Removes all symmetry properties from @var{tensor} which has @var{m}
covariant indices and @var{n} contravariant indices.
@end deffn
@deffn {Function} canform (@var{expr})
Simplifies @var{expr} by renaming dummy
indices and reordering all indices as dictated by symmetry conditions
imposed on them. If @code{allsym} is @code{true} then all indices are assumed
symmetric, otherwise symmetry information provided by @code{decsym}
declarations will be used. The dummy indices are renamed in the same
manner as in the @code{rename} function. When @code{canform} is applied to a large
expression the calculation may take a considerable amount of time.
This time can be shortened by calling @code{rename} on the expression first.
Also see the example under @code{decsym}. Note: @code{canform} may not be able to
reduce an expression completely to its simplest form although it will
always return a mathematically correct result.
@end deffn
@subsection Indicial tensor calculus
@deffn {Function} diff (@var{expr}, @var{v_1}, [@var{n_1}, [@var{v_2}, @var{n_2}] ...])
is the usual Maxima differentiation function which has been expanded
in its abilities for @code{itensor}. It takes the derivative of @var{expr} with
respect to @var{v_1} @var{n_1} times, with respect to @var{v_2} @var{n_2}
times, etc. For the tensor package, the function has been modified so
that the @var{v_i} may be integers from 1 up to the value of the variable
@code{dim}. This will cause the differentiation to be carried out with
respect to the @var{v_i}th member of the list @code{vect_coords}. If
@code{vect_coords} is bound to an atomic variable, then that variable
subscripted by @var{v_i} will be used for the variable of
differentiation. This permits an array of coordinate names or
subscripted names like @code{x[1]}, @code{x[2]}, ... to be used.
@end deffn
@deffn {Function} idiff (@var{expr}, @var{v_1}, [@var{n_1}, [@var{v_2}, @var{n_2}] ...])
Indicial differentiation. Unlike @code{diff}, which differentiates
with respect to an independent variable, @code{idiff)} can be used
to differentiate with respect to a coordinate. For an indexed object,
this amounts to appending the @var{v_i} as derivative indices.
Subsequently, derivative indices will be sorted, unless @code{iframe_flag}
is set to @code{true}.
@code{idiff} can also differentiate the determinant of the metric
tensor. Thus, if @code{imetric} has been bound to @code{G} then
@code{idiff(determinant(g),k)} will return
@code{2*determinant(g)*ichr2([%i,k],[%i])} where the dummy index @code{%i}
is chosen appropriately.
@end deffn
@deffn {Function} liediff (@var{v}, @var{ten})
Computes the Lie-derivative of the tensorial expression @var{ten} with
respect to the vector field @var{v}. @var{ten} should be any indexed
tensor expression; @var{v} should be the name (without indices) of a vector
field. For example:
@example
(%i1) load(itensor);
(%o1) /share/tensor/itensor.lisp
(%i2) ishow(liediff(v,a([i,j],[])*b([],[k],l)))$
k %2 %2 %2
(%t2) b (v a + v a + v a )
,l i j,%2 ,j i %2 ,i %2 j
%1 k %1 k %1 k
+ (v b - b v + v b ) a
,%1 l ,l ,%1 ,l ,%1 i j
@end example
@end deffn
@deffn {Function} rediff (@var{ten})
Evaluates all occurrences of the @code{idiff} command in the tensorial
expression @var{ten}.
@end deffn
@deffn {Function} undiff (@var{expr})
Returns an expression equivalent to @var{expr} but with all derivatives
of indexed objects replaced by the noun form of the @code{idiff} function. Its
arguments would yield that indexed object if the differentiation were
carried out. This is useful when it is desired to replace a
differentiated indexed object with some function definition resulting
in @var{expr} and then carry out the differentiation by saying
@code{ev(@var{expr}, idiff)}.
@end deffn
@deffn {Function} evundiff (@var{expr})
Equivalent to the execution of @code{undiff}, followed by @code{ev} and
@code{rediff}.
The point of this operation is to easily evalute expressions that cannot
be directly evaluated in derivative form. For instance, the following
causes an error:
@example
(%i1) load(itensor);
(%o1) /share/tensor/itensor.lisp
(%i2) icurvature([i,j,k],[l],m);
Maxima encountered a Lisp error:
Error in $ICURVATURE [or a callee]:
$ICURVATURE [or a callee] requires less than three arguments.
Automatically continuing.
To reenable the Lisp debugger set *debugger-hook* to nil.
@end example
However, if @code{icurvature} is entered in noun form, it can be evaluated
using @code{evundiff}:
@example
(%i3) ishow('icurvature([i,j,k],[l],m))$
l
(%t3) icurvature
i j k,m
(%i4) ishow(evundiff(%))$
l l %1 l %1
(%t4) - ichr2 - ichr2 ichr2 - ichr2 ichr2
i k,j m %1 j i k,m %1 j,m i k
l l %1 l %1
+ ichr2 + ichr2 ichr2 + ichr2 ichr2
i j,k m %1 k i j,m %1 k,m i j
@end example
Note: In earlier versions of Maxima, derivative forms of the
Christoffel-symbols also could not be evaluated. This has been fixed now,
so @code{evundiff} is no longer necessary for expressions like this:
@example
(%i5) imetric(g);
(%o5) done
(%i6) ishow(ichr2([i,j],[k],l))$
k %3
g (g - g + g )
j %3,i l i j,%3 l i %3,j l
(%t6) -----------------------------------------
2
k %3
g (g - g + g )
,l j %3,i i j,%3 i %3,j
+ -----------------------------------
2
@end example
@end deffn
@deffn {Function} flush (@var{expr}, @var{tensor_1}, @var{tensor_2}, ...)
Set to zero, in
@var{expr}, all occurrences of the @var{tensor_i} that have no derivative indices.
@end deffn
@deffn {Function} flushd (@var{expr}, @var{tensor_1}, @var{tensor_2}, ...)
Set to zero, in
@var{expr}, all occurrences of the @var{tensor_i} that have derivative indices.
@end deffn
@deffn {Function} flushnd (@var{expr}, @var{tensor}, @var{n})
Set to zero, in @var{expr}, all
occurrences of the differentiated object @var{tensor} that have @var{n} or more
derivative indices as the following example demonstrates.
@example
(%i1) load(itensor);
(%o1) /share/tensor/itensor.lisp
(%i2) ishow(a([i],[J,r],k,r)+a([i],[j,r,s],k,r,s))$
J r j r s
(%t2) a + a
i,k r i,k r s
(%i3) ishow(flushnd(%,a,3))$
J r
(%t3) a
i,k r
@end example
@end deffn
@deffn {Function} coord (@var{tensor_1}, @var{tensor_2}, ...)
Gives @var{tensor_i} the coordinate differentiation property that the
derivative of contravariant vector whose name is one of the
@var{tensor_i} yields a Kronecker delta. For example, if @code{coord(x)} has
been done then @code{idiff(x([],[i]),j)} gives @code{kdelta([i],[j])}.
@code{coord} is a list of all indexed objects having this property.
@end deffn
@deffn {Function} remcoord (@var{tensor_1}, @var{tensor_2}, ...)
@deffnx {Function} remcoord (all)
Removes the coordinate differentiation property from the @code{tensor_i}
that was established by the function @code{coord}. @code{remcoord(all)}
removes this property from all indexed objects.
@end deffn
@deffn {Function} makebox (@var{expr})
Display @var{expr} in the same manner as @code{show}; however,
any tensor d'Alembertian occurring in @var{expr} will be indicated using the
symbol @code{[]}. For example, @code{[]p([m],[n])} represents
@code{g([],[i,j])*p([m],[n],i,j)}.
@end deffn
@deffn {Function} conmetderiv (@var{expr}, @var{tensor})
Simplifies expressions containing ordinary derivatives of
both covariant and contravariant forms of the metric tensor (the
current restriction). For example, @code{conmetderiv} can relate the
derivative of the contravariant metric tensor with the Christoffel
symbols as seen from the following:
@example
(%i1) load(itensor);
(%o1) /share/tensor/itensor.lisp
(%i2) ishow(g([],[a,b],c))$
a b
(%t2) g
,c
(%i3) ishow(conmetderiv(%,g))$
%1 b a %1 a b
(%t3) - g ichr2 - g ichr2
%1 c %1 c
@end example
@end deffn
@deffn {Function} simpmetderiv (@var{expr})
@deffnx {Function} simpmetderiv (@var{expr}[, @var{stop}])
Simplifies expressions containing products of the derivatives of the
metric tensor. Specifically, @code{simpmetderiv} recognizes two identities:
@example
ab ab ab a
g g + g g = (g g ) = (kdelta ) = 0
,d bc bc,d bc ,d c ,d
@end example
hence
@example
ab ab
g g = - g g
,d bc bc,d
@end example
and
@example
ab ab
g g = g g
,j ab,i ,i ab,j
@end example
which follows from the symmetries of the Christoffel symbols.
The @code{simpmetderiv} function takes one optional parameter which, when
present, causes the function to stop after the first successful
substitution in a product expression. The @code{simpmetderiv} function
also makes use of the global variable @var{flipflag} which determines
how to apply a ``canonical'' ordering to the product indices.
Put together, these capabilities can be used to achieve powerful
simplifications that are difficult or impossible to accomplish otherwise.
This is demonstrated through the following example that explicitly uses the
partial simplification features of @code{simpmetderiv} to obtain a
contractible expression:
@example
(%i1) load(itensor);
(%o1) /share/tensor/itensor.lisp
(%i2) imetric(g);
(%o2) done
(%i3) ishow(g([],[a,b])*g([],[b,c])*g([a,b],[],d)*g([b,c],[],e))$
a b b c
(%t3) g g g g
a b,d b c,e
(%i4) ishow(canform(%))$
errexp1 has improper indices
-- an error. Quitting. To debug this try debugmode(true);
(%i5) ishow(simpmetderiv(%))$
a b b c
(%t5) g g g g
a b,d b c,e
(%i6) flipflag:not flipflag;
(%o6) true
(%i7) ishow(simpmetderiv(%th(2)))$
a b b c
(%t7) g g g g
,d ,e a b b c
(%i8) flipflag:not flipflag;
(%o8) false
(%i9) ishow(simpmetderiv(%th(2),stop))$
a b b c
(%t9) - g g g g
,e a b,d b c
(%i10) ishow(contract(%))$
b c
(%t10) - g g
,e c b,d
@end example
See also @code{weyl.dem} for an example that uses @code{simpmetderiv}
and @code{conmetderiv} together to simplify contractions of the Weyl tensor.
@end deffn
@deffn {Function} flush1deriv (@var{expr}, @var{tensor})
Set to zero, in @code{expr}, all occurrences of @code{tensor} that have
exactly one derivative index.
@end deffn
@subsection Tensors in curved spaces
@deffn {Function} imetric (@var{g})
@deffnx {System variable} imetric
Specifies the metric by assigning the variable @code{imetric:@var{g}} in
addition, the contraction properties of the metric @var{g} are set up by
executing the commands @code{defcon(@var{g}),defcon(@var{g},@var{g},kdelta)}.
The variable @code{imetric} (unbound by default), is bound to the metric, assigned by
the @code{imetric(@var{g})} command.
@end deffn
@deffn {Function} idim (@var{n})
Sets the dimensions of the metric. Also initializes the antisymmetry
properties of the Levi-Civita symbols for the given dimension.
@end deffn
@deffn {Function} ichr1 ([@var{i}, @var{j}, @var{k}])
Yields the Christoffel symbol of the first kind via the
definition
@example
(g + g - g )/2 .
ik,j jk,i ij,k
@end example
@noindent
To evaluate the Christoffel symbols for a particular metric, the
variable @code{imetric} must be assigned a name as in the example under @code{chr2}.
@end deffn
@deffn {Function} ichr2 ([@var{i}, @var{j}], [@var{k}])
Yields the Christoffel symbol of the second kind
defined by the relation
@example
ks
ichr2([i,j],[k]) = g (g + g - g )/2
is,j js,i ij,s
@end example
@end deffn
@deffn {Function} icurvature ([@var{i}, @var{j}, @var{k}], [@var{h}])
Yields the Riemann
curvature tensor in terms of the Christoffel symbols of the second
kind (@code{ichr2}). The following notation is used:
@example
h h h %1 h
icurvature = - ichr2 - ichr2 ichr2 + ichr2
i j k i k,j %1 j i k i j,k
h %1
+ ichr2 ichr2
%1 k i j
@end example
@end deffn
@deffn {Function} covdiff (@var{expr}, @var{v_1}, @var{v_2}, ...)
Yields the covariant derivative of @var{expr} with
respect to the variables @var{v_i} in terms of the Christoffel symbols of the
second kind (@code{ichr2}). In order to evaluate these, one should use
@code{ev(@var{expr},ichr2)}.
@example
(%i1) load(itensor);
(%o1) /share/tensor/itensor.lisp
(%i2) entertensor()$
Enter tensor name: a;
Enter a list of the covariant indices: [i,j];
Enter a list of the contravariant indices: [k];
Enter a list of the derivative indices: [];
k
(%t2) a
i j
(%i3) ishow(covdiff(%,s))$
k %1 k %1 k k %1
(%t3) - a ichr2 - a ichr2 + a + ichr2 a
i %1 j s %1 j i s i j,s %1 s i j
(%i4) imetric:g;
(%o4) g
(%i5) ishow(ev(%th(2),ichr2))$
%1 %4 k
g a (g - g + g )
i %1 s %4,j j s,%4 j %4,s
(%t5) - ------------------------------------------
2
%1 %3 k
g a (g - g + g )
%1 j s %3,i i s,%3 i %3,s
- ------------------------------------------
2
k %2 %1
g a (g - g + g )
i j s %2,%1 %1 s,%2 %1 %2,s k
+ ------------------------------------------- + a
2 i j,s
(%i6)
@end example
@end deffn
@deffn {Function} lorentz_gauge (@var{expr})
Imposes the Lorentz condition by substituting 0 for all
indexed objects in @var{expr} that have a derivative index identical to a
contravariant index.
@end deffn
@deffn {Function} igeodesic_coords (@var{expr}, @var{name})
Causes undifferentiated Christoffel symbols and
first derivatives of the metric tensor vanish in @var{expr}. The @var{name}
in the @code{igeodesic_coords} function refers to the metric @var{name}
(if it appears in @var{expr}) while the connection coefficients must be
called with the names @code{ichr1} and/or @code{ichr2}. The following example
demonstrates the verification of the cyclic identity satisfied by the Riemann
curvature tensor using the @code{igeodesic_coords} function.
@example
(%i1) load(itensor);
(%o1) /share/tensor/itensor.lisp
(%i2) ishow(icurvature([r,s,t],[u]))$
u u %1 u u %1
(%t2) - ichr2 - ichr2 ichr2 + ichr2 + ichr2 ichr2
r t,s %1 s r t r s,t %1 t r s
(%i3) ishow(igeodesic_coords(%,ichr2))$
u u
(%t3) ichr2 - ichr2
r s,t r t,s
(%i4) ishow(igeodesic_coords(icurvature([r,s,t],[u]),ichr2)+
igeodesic_coords(icurvature([s,t,r],[u]),ichr2)+
igeodesic_coords(icurvature([t,r,s],[u]),ichr2))$
u u u u u
(%t4) - ichr2 + ichr2 + ichr2 - ichr2 - ichr2
t s,r t r,s s t,r s r,t r t,s
u
+ ichr2
r s,t
(%i5) canform(%);
(%o5) 0
@end example
@end deffn
@subsection Moving frames
Maxima now has the ability to perform calculations using moving frames.
These can be orthonormal frames (tetrads, vielbeins) or an arbitrary frame.
To use frames, you must first set @code{iframe_flag} to @code{true}. This
causes the Christoffel-symbols, @code{ichr1} and @code{ichr2}, to be replaced
by the more general frame connection coefficients @code{icc1} and @code{icc2}
in calculations. Speficially, the behavior of @code{covdiff} and
@code{icurvature} is changed.
The frame is defined by two tensors: the inverse frame field (@code{ifri},
the dual basis tetrad),
and the frame metric @code{ifg}. The frame metric is the identity matrix for
orthonormal frames, or the Lorentz metric for orthonormal frames in Minkowski
spacetime. The inverse frame field defines the frame base (unit vectors).
Contraction properties are defined for the frame field and the frame metric.
When @code{iframe_flag} is true, many @code{itensor} expressions use the frame
metric @code{ifg} instead of the metric defined by @code{imetric} for
raising and lowerind indices.
IMPORTANT: Setting the variable @code{iframe_flag} to @code{true} does NOT
undefine the contraction properties of a metric defined by a call to
@code{defcon} or @code{imetric}. If a frame field is used, it is best to
define the metric by assigning its name to the variable @code{imetric}
and NOT invoke the @code{imetric} function.
Maxima uses these two tensors to define the frame coefficients (@code{ifc1}
and @code{ifc2}) which form part of the connection coefficients (@code{icc1}
and @code{icc2}), as the following example demonstrates:
@example
(%i1) load(itensor);
(%o1) /share/tensor/itensor.lisp
(%i2) iframe_flag:true;
(%o2) true
(%i3) ishow(covdiff(v([],[i]),j))$
i i %1
(%t3) v + icc2 v
,j %1 j
(%i4) ishow(ev(%,icc2))$
%1 i i i
(%t4) v (ifc2 + ichr2 ) + v
%1 j %1 j ,j
(%i5) ishow(ev(%,ifc2))$
%1 i %2
v ifg (ifb - ifb + ifb )
j %2 %1 %2 %1 j %1 j %2 i
(%t5) -------------------------------------------------- + v
2 ,j
(%i6) ishow(ifb([a,b,c]))$
%5 %4
(%t6) ifr ifr (ifri - ifri )
a b c %4,%5 c %5,%4
@end example
An alternate method is used to compute the frame bracket (@code{ifb}) if
the @code{iframe_bracket_form} flag is set to @code{false}:
@example
(%i8) block([iframe_bracket_form:false],ishow(ifb([a,b,c])))$
%7 %6 %6 %7
(%t8) (ifr ifr - ifr ifr ) ifri
a b,%7 a,%7 b c %6
@end example
@deffn {Function} iframes ()
Since in this version of Maxima, contraction identities for @code{ifr} and
@code{ifri} are always defined, as is the frame bracket (@code{ifb}), this
function does nothing.
@end deffn
@defvr {Variable} ifb
The frame bracket. The contribution of the frame metric to the connection
coefficients is expressed using the frame bracket:
@example
- ifb + ifb + ifb
c a b b c a a b c
ifc1 = --------------------------------
abc 2
@end example
The frame bracket itself is defined in terms of the frame field and frame
metric. Two alternate methods of computation are used depending on the
value of @code{frame_bracket_form}. If true (the default) or if the
@code{itorsion_flag} is @code{true}:
@example
d e f
ifb = ifr ifr (ifri - ifri - ifri itr )
abc b c a d,e a e,d a f d e
@end example
Otherwise:
@example
e d d e
ifb = (ifr ifr - ifr ifr ) ifri
abc b c,e b,e c a d
@end example
@end defvr
@defvr {Variable} icc1
Connection coefficients of the first kind. In @code{itensor}, defined as
@example
icc1 = ichr1 - ikt1 - inmc1
abc abc abc abc
@end example
In this expression, if @code{iframe_flag} is true, the Christoffel-symbol
@code{ichr1} is replaced with the frame connection coefficient @code{ifc1}.
If @code{itorsion_flag} is @code{false}, @code{ikt1}
will be omitted. It is also omitted if a frame base is used, as the
torsion is already calculated as part of the frame bracket.
Lastly, of @code{inonmet_flag} is @code{false},
@code{inmc1} will not be present.
@end defvr
@defvr {Variable} icc2
Connection coefficients of the second kind. In @code{itensor}, defined as
@example
c c c c
icc2 = ichr2 - ikt2 - inmc2
ab ab ab ab
@end example
In this expression, if @code{iframe_flag} is true, the Christoffel-symbol
@code{ichr2} is replaced with the frame connection coefficient @code{ifc2}.
If @code{itorsion_flag} is @code{false}, @code{ikt2}
will be omitted. It is also omitted if a frame base is used, as the
torsion is already calculated as part of the frame bracket.
Lastly, of @code{inonmet_flag} is @code{false},
@code{inmc2} will not be present.
@end defvr
@defvr {Variable} ifc1
Frame coefficient of the first kind (also known as Ricci-rotation
coefficients.) This tensor represents the contribution
of the frame metric to the connection coefficient of the first kind. Defined
as:
@example
- ifb + ifb + ifb
c a b b c a a b c
ifc1 = --------------------------------
abc 2
@end example
@end defvr
@defvr {Variable} ifc2
Frame coefficient of the first kind. This tensor represents the contribution
of the frame metric to the connection coefficient of the first kind. Defined
as a permutation of the frame bracket (@code{ifb}) with the appropriate
indices raised and lowered as necessary:
@example
c cd
ifc2 = ifg ifc1
ab abd
@end example
@end defvr
@defvr {Variable} ifr
The frame field. Contracts with the inverse frame field (@code{ifri}) to
form the frame metric (@code{ifg}).
@end defvr
@defvr {Variable} ifri
The inverse frame field. Specifies the frame base (dual basis vectors). Along
with the frame metric, it forms the basis of all calculations based on
frames.
@end defvr
@defvr {Variable} ifg
The frame metric. Defaults to @code{kdelta}, but can be changed using
@code{components}.
@end defvr
@defvr {Variable} ifgi
The inverse frame metric. Contracts with the frame metric (@code{ifg})
to @code{kdelta}.
@end defvr
@defvr {Option variable} iframe_bracket_form
Default value: @code{true}
Specifies how the frame bracket (@code{ifb}) is computed.
@end defvr
@subsection Torsion and nonmetricity
Maxima can now take into account torsion and nonmetricity. When the flag
@code{itorsion_flag} is set to @code{true}, the contribution of torsion
is added to the connection coefficients. Similarly, when the flag
@code{inonmet_flag} is true, nonmetricity components are included.
@defvr {Variable} inm
The nonmetricity vector. Conformal nonmetricity is defined through the
covariant derivative of the metric tensor. Normally zero, the metric
tensor's covariant derivative will evaluate to the following when
@code{inonmet_flag} is set to @code{true}:
@example
g =- g inm
ij;k ij k
@end example
@end defvr
@defvr {Variable} inmc1
Covariant permutation of the nonmetricity vector components. Defined as
@example
g inm - inm g - g inm
ab c a bc ac b
inmc1 = ------------------------------
abc 2
@end example
(Substitute @code{ifg} in place of @code{g} if a frame metric is used.)
@end defvr
@defvr {Variable} inmc2
Contravariant permutation of the nonmetricity vector components. Used
in the connection coefficients if @code{inonmet_flag} is @code{true}. Defined
as:
@example
c c cd
-inm kdelta - kdelta inm + g inm g
c a b a b d ab
inmc2 = -------------------------------------------
ab 2
@end example
(Substitute @code{ifg} in place of @code{g} if a frame metric is used.)
@end defvr
@defvr {Variable} ikt1
Covariant permutation of the torsion tensor (also known as contorsion).
Defined as:
@example
d d d
-g itr - g itr - itr g
ad cb bd ca ab cd
ikt1 = ----------------------------------
abc 2
@end example
(Substitute @code{ifg} in place of @code{g} if a frame metric is used.)
@end defvr
@defvr {Variable} ikt2
Contravariant permutation of the torsion tensor (also known as contorsion).
Defined as:
@example
c cd
ikt2 = g ikt1
ab abd
@end example
(Substitute @code{ifg} in place of @code{g} if a frame metric is used.)
@end defvr
@defvr {Variable} itr
The torsion tensor. For a metric with torsion, repeated covariant
differentiation on a scalar function will not commute, as demonstrated
by the following example:
@example
(%i1) load(itensor);
(%o1) /share/tensor/itensor.lisp
(%i2) imetric:g;
(%o2) g
(%i3) covdiff(covdiff(f([],[]),i),j)-covdiff(covdiff(f([],[]),j),i)$
(%i4) ishow(%)$
%4 %2
(%t4) f ichr2 - f ichr2
,%4 j i ,%2 i j
(%i5) canform(%);
(%o5) 0
(%i6) itorsion_flag:true;
(%o6) true
(%i7) covdiff(covdiff(f([],[]),i),j)-covdiff(covdiff(f([],[]),j),i)$
(%i8) ishow(%)$
%8 %6
(%t8) f icc2 - f icc2 - f + f
,%8 j i ,%6 i j ,j i ,i j
(%i9) ishow(canform(%))$
%1 %1
(%t9) f icc2 - f icc2
,%1 j i ,%1 i j
(%i10) ishow(canform(ev(%,icc2)))$
%1 %1
(%t10) f ikt2 - f ikt2
,%1 i j ,%1 j i
(%i11) ishow(canform(ev(%,ikt2)))$
%2 %1 %2 %1
(%t11) f g ikt1 - f g ikt1
,%2 i j %1 ,%2 j i %1
(%i12) ishow(factor(canform(rename(expand(ev(%,ikt1))))))$
%3 %2 %1 %1
f g g (itr - itr )
,%3 %2 %1 j i i j
(%t12) ------------------------------------
2
(%i13) decsym(itr,2,1,[anti(all)],[]);
(%o13) done
(%i14) defcon(g,g,kdelta);
(%o14) done
(%i15) subst(g,nounify(g),%th(3))$
(%i16) ishow(canform(contract(%)))$
%1
(%t16) - f itr
,%1 i j
@end example
@end defvr
@subsection Exterior algebra
The @code{itensor} package can perform operations on totally antisymmetric
covariant tensor fields. A totally antisymmetric tensor field of rank
(0,L) corresponds with a differential L-form. On these objects, a
multiplication operation known as the exterior product, or wedge product,
is defined.
Unfortunately, not all authors agree on the definition of the wedge
product. Some authors prefer a definition that corresponds with the
notion of antisymmetrization: in these works, the wedge product of
two vector fields, for instance, would be defined as
@example
a a - a a
i j j i
a /\ a = -----------
i j 2
@end example
More generally, the product of a p-form and a q-form would be defined as
@example
1 k1..kp l1..lq
A /\ B = ------ D A B
i1..ip j1..jq (p+q)! i1..ip j1..jq k1..kp l1..lq
@end example
where @code{D} stands for the Kronecker-delta.
Other authors, however, prefer a ``geometric'' definition that corresponds
with the notion of the volume element:
@example
a /\ a = a a - a a
i j i j j i
@end example
and, in the general case
@example
1 k1..kp l1..lq
A /\ B = ----- D A B
i1..ip j1..jq p! q! i1..ip j1..jq k1..kp l1..lq
@end example
Since @code{itensor} is a tensor algebra package, the first of these two
definitions appears to be the more natural one. Many applications, however,
utilize the second definition. To resolve this dilemma, a flag has been
implemented that controls the behavior of the wedge product: if
@code{igeowedge_flag} is @code{false} (the default), the first, "tensorial"
definition is used, otherwise the second, "geometric" definition will
be applied.
@defvr {Operator} ~
The wedge product operator is denoted by the tilde @code{~}. This is
a binary operator. Its arguments should be expressions involving scalars,
covariant tensors of rank one, or covariant tensors of rank @code{l} that
have been declared antisymmetric in all covariant indices.
The behavior of the wedge product operator is controlled by the
@code{igeowedge_flag} flag, as in the following example:
@example
(%i1) load(itensor);
(%o1) /share/tensor/itensor.lisp
(%i2) ishow(a([i])~b([j]))$
a b - b a
i j i j
(%t2) -------------
2
(%i3) decsym(a,2,0,[anti(all)],[]);
(%o3) done
(%i4) ishow(a([i,j])~b([k]))$
a b + b a - a b
i j k i j k i k j
(%t4) ---------------------------
3
(%i5) igeowedge_flag:true;
(%o5) true
(%i6) ishow(a([i])~b([j]))$
(%t6) a b - b a
i j i j
(%i7) ishow(a([i,j])~b([k]))$
(%t7) a b + b a - a b
i j k i j k i k j
@end example
@end defvr
@defvr {Operator} |
The vertical bar @code{|} denotes the "contraction with a vector" binary
operation. When a totally antisymmetric covariant tensor is contracted
with a contravariant vector, the result is the same regardless which index
was used for the contraction. Thus, it is possible to define the
contraction operation in an index-free manner.
In the @code{itensor} package, contraction with a vector is always carried out
with respect to the first index in the literal sorting order. This ensures
better simplification of expressions involving the @code{|} operator. For instance:
@example
(%i1) load(itensor);
(%o1) /share/tensor/itensor.lisp
(%i2) decsym(a,2,0,[anti(all)],[]);
(%o2) done
(%i3) ishow(a([i,j],[])|v)$
%1
(%t3) v a
%1 j
(%i4) ishow(a([j,i],[])|v)$
%1
(%t4) - v a
%1 j
@end example
Note that it is essential that the tensors used with the @code{|} operator be
declared totally antisymmetric in their covariant indices. Otherwise,
the results will be incorrect.
@end defvr
@deffn {Function} extdiff (@var{expr}, @var{i})
Computes the exterior derivative of @var{expr} with respect to the index
@var{i}. The exterior derivative is formally defined as the wedge
product of the partial derivative operator and a differential form. As
such, this operation is also controlled by the setting of @code{igeowedge_flag}.
For instance:
@example
(%i1) load(itensor);
(%o1) /share/tensor/itensor.lisp
(%i2) ishow(extdiff(v([i]),j))$
v - v
j,i i,j
(%t2) -----------
2
(%i3) decsym(a,2,0,[anti(all)],[]);
(%o3) done
(%i4) ishow(extdiff(a([i,j]),k))$
a - a + a
j k,i i k,j i j,k
(%t4) ------------------------
3
(%i5) igeowedge_flag:true;
(%o5) true
(%i6) ishow(extdiff(v([i]),j))$
(%t6) v - v
j,i i,j
(%i7) ishow(extdiff(a([i,j]),k))$
(%t7) a - a + a
j k,i i k,j i j,k
@end example
@end deffn
@deffn {Function} hodge (@var{expr})
Compute the Hodge-dual of @var{expr}. For instance:
@example
(%i1) load(itensor);
(%o1) /share/tensor/itensor.lisp
(%i2) imetric(g);
(%o2) done
(%i3) idim(4);
(%o3) done
(%i4) icounter:100;
(%o4) 100
(%i5) decsym(A,3,0,[anti(all)],[])$
(%i6) ishow(A([i,j,k],[]))$
(%t6) A
i j k
(%i7) ishow(canform(hodge(%)))$
%1 %2 %3 %4
levi_civita g A
%1 %102 %2 %3 %4
(%t7) -----------------------------------------
6
(%i8) ishow(canform(hodge(%)))$
%1 %2 %3 %8 %4 %5 %6 %7
(%t8) levi_civita levi_civita g g
%1 %106 %2 %107
g g A /6
%3 %108 %4 %8 %5 %6 %7
(%i9) lc2kdt(%)$
(%i10) %,kdelta$
(%i11) ishow(canform(contract(expand(%))))$
(%t11) - A
%106 %107 %108
@end example
@end deffn
@defvr {Option variable} igeowedge_flag
Default value: @code{false}
Controls the behavior of the wedge product and exterior derivative. When
set to @code{false} (the default), the notion of differential forms will
correspond with that of a totally antisymmetric covariant tensor field.
When set to @code{true}, differential forms will agree with the notion
of the volume element.
@end defvr
@subsection Exporting TeX expressions
The @code{itensor} package provides limited support for exporting tensor
expressions to TeX. Since @code{itensor} expressions appear as function calls,
the regular Maxima @code{tex} command will not produce the expected
output. You can try instead the @code{tentex} command, which attempts
to translate tensor expressions into appropriately indexed TeX objects.
@deffn {Function} tentex (@var{expr})
To use the @code{tentex} function, you must first load @code{tentex},
as in the following example:
@example
(%i1) load(itensor);
(%o1) /share/tensor/itensor.lisp
(%i2) load(tentex);
(%o2) /share/tensor/tentex.lisp
(%i3) idummyx:m;
(%o3) m
(%i4) ishow(icurvature([j,k,l],[i]))$
m1 i m1 i i i
(%t4) ichr2 ichr2 - ichr2 ichr2 - ichr2 + ichr2
j k m1 l j l m1 k j l,k j k,l
(%i5) tentex(%)$
$$\Gamma_@{j\,k@}^@{m_1@}\,\Gamma_@{l\,m_1@}^@{i@}-\Gamma_@{j\,l@}^@{m_1@}\,
\Gamma_@{k\,m_1@}^@{i@}-\Gamma_@{j\,l,k@}^@{i@}+\Gamma_@{j\,k,l@}^@{i@}$$
@end example
Note the use of the @code{idummyx} assignment, to avoid the appearance
of the percent sign in the TeX expression, which may lead to compile errors.
NB: This version of the @code{tentex} function is somewhat experimental.
@end deffn
@subsection Interfacing with ctensor
The @code{itensor} package has the ability to generate Maxima code that can
then be executed in the context of the @code{ctensor} package. The function that performs
this task is @code{ic_convert}.
@deffn {Function} ic_convert (@var{eqn})
Converts the @code{itensor} equation @var{eqn} to a @code{ctensor} assignment statement.
Implied sums over dummy indices are made explicit while indexed
objects are transformed into arrays (the array subscripts are in the
order of covariant followed by contravariant indices of the indexed
objects). The derivative of an indexed object will be replaced by the
noun form of @code{diff} taken with respect to @code{ct_coords} subscripted
by the derivative index. The Christoffel symbols @code{ichr1} and @code{ichr2}
will be translated to @code{lcs} and @code{mcs}, respectively and if
@code{metricconvert} is @code{true} then all occurrences of the metric
with two covariant (contravariant) indices will be renamed to @code{lg}
(@code{ug}). In addition, @code{do} loops will be introduced summing over
all free indices so that the
transformed assignment statement can be evaluated by just doing
@code{ev}. The following examples demonstrate the features of this
function.
@example
(%i1) load(itensor);
(%o1) /share/tensor/itensor.lisp
(%i2) eqn:ishow(t([i,j],[k])=f([],[])*g([l,m],[])*a([],[m],j)*b([i],[l,k]))$
k m l k
(%t2) t = f a b g
i j ,j i l m
(%i3) ic_convert(eqn);
(%o3) for i thru dim do (for j thru dim
do (for k thru dim do t : f sum(sum(diff(a , ct_coords ) b
i, j, k m j i, l, k
g , l, 1, dim), m, 1, dim)))
l, m
(%i4) imetric(g);
(%o4) done
(%i5) metricconvert:true;
(%o5) true
(%i6) ic_convert(eqn);
(%o6) for i thru dim do (for j thru dim
do (for k thru dim do t : f sum(sum(diff(a , ct_coords ) b
i, j, k m j i, l, k
lg , l, 1, dim), m, 1, dim)))
l, m
@end example
@end deffn
@subsection Reserved words
The following Maxima words are used by the @code{itensor} package internally and
should not be redefined:
@c REFORMAT THIS TABLE USING TEXINFO MARKUP
@example
Keyword Comments
------------------------------------------
indices2() Internal version of indices()
conti Lists contravariant indices
covi Lists covariant indices of a indexed object
deri Lists derivative indices of an indexed object
name Returns the name of an indexed object
concan
irpmon
lc0
_lc2kdt0
_lcprod
_extlc
@end example
|