metric2d.red 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. % Calculations concerning the special metric of Dieter Egger
  2. % Small and capital letters are treated as being equivalent
  3. % Dimension of space-time
  4. n:=2;
  5. % turn off extra echoes
  6. off echo;
  7. % smaller exponents first
  8. on revpri;
  9. % Coordinates
  10. OPERATOR X$
  11. X(0):=t$
  12. X(1):=lambda0$
  13. % lambda0 depends on t
  14. DEPEND lambda0,t$
  15. % Rules
  16. trig1:={sin(~x)^2=>(1-cos(x)^2)}$
  17. let trig1$
  18. % Procedures
  19. procedure kovab(aa,bb); begin
  20. FOR I:=0:n-1 DO FOR J:=0:n-1 DO aa(I,J):=DF(bb(I),X(J))+FOR M:=0:n-1 SUM CHRIST(I,J,M)*bb(M)$
  21. end;
  22. procedure showMatrix(mm); begin
  23. MATRIX hh(n,n)$
  24. FOR I:=0:n-1 DO FOR J:=0:n-1 DO hh(I+1,J+1):=mm(I,J)$
  25. write hh;
  26. end;
  27. procedure showVector(vv); begin
  28. MATRIX hh(n,1)$
  29. FOR I:=0:n-1 DO hh(I+1,1):=vv(I)$
  30. write hh;
  31. end;
  32. % Vectors (1-dim arrays start with index 0)
  33. ARRAY U(n), V(n), LV(n), B(n), LB(n), BG(n)$
  34. % Arrays (2-dim arrays start with indices (0,0))
  35. ARRAY G(n,n), GINV(n,n), CHRIST(n,n,n), RIEM(n,n,n,n), RICCI(n,n), EINST(n,n)$
  36. ARRAY UKV(n,n)$
  37. % Calculations
  38. % optionally set maximum radius to 1
  39. % a0:=1$
  40. % or leave it open
  41. a:=a0*sqrt(1-t^2)$
  42. % Place
  43. u(0):=a0*asin(t)$
  44. u(1):=a*lambda0$
  45. % Metric (cellar indices, covariant, default is zero)
  46. G(0,0):=a0^2/(1-t^2)$
  47. G(1,1):=a0^2*(1-t^2)$
  48. % Inverse Metric (roof indices, contravariant)
  49. MATRIX MG(n,n), MGINV(n,n)$
  50. FOR I:=0:n-1 DO FOR J:=0:n-1 DO MG(I+1,J+1):=G(I,J)$
  51. MGINV:=1/MG$
  52. FOR I:=0:n-1 DO FOR J:=0:n-1 DO GINV(I,J):=MGINV(I+1,J+1)$
  53. % show metric
  54. write "g = ",mg;
  55. write "ginv = ",mginv;
  56. write "g*ginv = ",mg*mginv;
  57. % Christoffel symbols
  58. for k:=0:n-1 do for l:=0:n-1 do for m:=0:n-1 do CHRIST(k,l,m):=for i:=0:n-1 sum GINV(k,i)/2 * (DF(G(m,i),X(l)) + DF(G(l,i),X(m)) - DF(G(m,l),X(i)));
  59. % curvature tensor
  60. for m:=0:n-1 do for i:=0:n-1 do for k:=0:n-1 do for p:=0:n-1 do RIEM(m,i,k,p) :=DF(CHRIST(m,i,k),X(p)) - DF(CHRIST(m,i,p),X(k)) + FOR r:=0:n-1 SUM CHRIST(r,i,k)*CHRIST(m,r,p) - CHRIST(r,i,p)*CHRIST(m,r,k)$
  61. % Ricci tensor
  62. FOR I:=0:n-1 DO FOR J:=0:n-1 DO RICCI(I,J):=FOR M:=0:n-1 SUM RIEM(M,I,J,M)$
  63. write "ricci = "; showMatrix(ricci);
  64. % curvature scalar
  65. R:=FOR I:=0:n-1 SUM FOR J:=0:n-1 SUM GINV(I,J)*RICCI(I,J)$
  66. write "curvature scalar r = ",r;
  67. % Einstein tensor
  68. FOR I:=0:n-1 DO FOR J:=0:n-1 DO EINST(I,J):=RICCI(I,J)-R/2*G(I,J)$
  69. write "einstein = "; showMatrix(einst);
  70. % show place
  71. write "place u = "; showVector(u);
  72. % covariant derivative of place u
  73. kovab(ukv,u)$
  74. write "cov. deriv. of u = "; showMatrix(ukv);
  75. % classical velocity
  76. for k:=0:n-1 do v(k):=df(U(k),X(0))$
  77. write "v = du/dt = "; showVector(v);
  78. % local velocity with respect to (x0,x1)
  79. for k:=0:n-1 do LV(k):=V(k)/V(0)$
  80. write "lv = dx1/dx0 = "; showVector(lv);
  81. % max. velocity
  82. Array vmax(n)$
  83. svmax:=a0/sqrt(1-t^2)$
  84. for i:=0:n-1 do vmax(i):=svmax$
  85. svmaxq:=svmax*svmax$
  86. write "max. velocity = ",svmax;
  87. % equation of motion
  88. for k:=0:n-1 do BG(k):=-for m:=0:n-1 sum for n:=0:n-1 sum CHRIST(k,m,n)* vmax(m)*vmax(n)$
  89. write "equation of motion = "; showVector(bg);
  90. % local acceleration wrt (x0,x1)
  91. for k:=0:n-1 do LB(k) :=1/V(0)*df(lv(k),x(0))$
  92. write "la = dlv/dx0 * 1/v0 = "; showVector(lb);
  93. %--------------------------------------------------------------
  94. % write results to file
  95. OUT "metric2d_results.txt";
  96. off echo;
  97. off nat;
  98. % Metric
  99. write "metric = ";
  100. FOR I:=0:n-1 DO FOR J:=0:n-1 DO WRITE "(",I,",",J,") = ", G(I,J)$
  101. % Inverse Metric
  102. WRITE "inverse metric = ";
  103. FOR I:=0:n-1 DO FOR J:=0:n-1 DO WRITE "(",I,",",J,") = ", GINV(I,J)$
  104. % Christoffel symbols
  105. write "christoffel symbols = ";
  106. FOR K:=0:n-1 DO FOR I:=0:n-1 DO FOR J:=0:n-1 DO WRITE "(",K,",",I,",",J,") = ", CHRIST(K,I,J)$
  107. % curvature tensor
  108. write "curvature tensor = ";
  109. FOR I:=0:n-1 DO FOR J:=0:n-1 DO FOR K:=0:n-1 DO FOR L:=0:n-1 DO WRITE "(",I,",",J,",",K,",",L,") = ", RIEM(I,J,K,L)$
  110. % Ricci tensor
  111. write "ricci tensor = ";
  112. FOR I:=0:n-1 DO FOR J:=0:n-1 DO WRITE "(",I,",",J,") = ", RICCI(I,J)$
  113. % curvature scalar
  114. write "curvature scalar = ",R$
  115. % Einstein tensor
  116. write "einstein tensor = ";
  117. FOR I:=0:n-1 DO FOR J:=0:n-1 DO WRITE "(",I,",",J,") = ",EINST(I,J)$
  118. % place U
  119. write "place u = ";
  120. FOR I:=0:n-1 DO WRITE "(",I,") = ", U(I)$
  121. % covariant derivative of U
  122. write "covariant derivative of u = ";
  123. FOR I:=0:n-1 DO FOR J:=0:n-1 DO WRITE "(",I,",",J,") = ",Ukv(I,J)$
  124. % velocity V
  125. write "velocity v = ";
  126. FOR I:=0:n-1 DO WRITE "(",I,") = ", V(I)$
  127. % local velocity wrt (x0,x1)
  128. write "local velocity wrt (x0,x1) = ";
  129. FOR I:=0:n-1 DO WRITE "(",I,") = ", LV(I)$
  130. % acceleration
  131. write "acceleration = ";
  132. FOR I:=0:n-1 DO WRITE "(",I,") = ", B(I)$
  133. % local acceleration wrt (x0,x1)
  134. write "local acceleration wrt (x0,x1) = ";
  135. FOR I:=0:n-1 DO WRITE "(",I,") = ", LB(I)$
  136. % equation of motion
  137. write "equation of motion = ";
  138. FOR I:=0:n-1 DO WRITE "(",I,") = ", BG(I)$
  139. % equation of motion
  140. on factor;
  141. write "equation of motion = ";
  142. FOR I:=0:n-1 DO WRITE "(",I,") =", BG(I)$
  143. off factor;
  144. SHUT "metric2d_results.txt";
  145. off revpri;
  146. on nat;
  147. END;