Origin for each line in src/metric2d.red from check-in c1ddb4c814:

c1ddb4c814 2021-03-01 jeff@gridfini: % Calculations concerning the special metric of Dieter Egger
c1ddb4c814 2021-03-01 jeff@gridfini: % Small and capital letters are treated as being equivalent
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % Dimension of space-time
c1ddb4c814 2021-03-01 jeff@gridfini: n:=2;
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % turn off extra echoes
c1ddb4c814 2021-03-01 jeff@gridfini: off echo;
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % smaller exponents first
c1ddb4c814 2021-03-01 jeff@gridfini: on revpri;
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % Coordinates
c1ddb4c814 2021-03-01 jeff@gridfini: OPERATOR X$
c1ddb4c814 2021-03-01 jeff@gridfini: X(0):=t$
c1ddb4c814 2021-03-01 jeff@gridfini: X(1):=lambda0$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % lambda0 depends on t
c1ddb4c814 2021-03-01 jeff@gridfini: DEPEND lambda0,t$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % Rules
c1ddb4c814 2021-03-01 jeff@gridfini: trig1:={sin(~x)^2=>(1-cos(x)^2)}$
c1ddb4c814 2021-03-01 jeff@gridfini: let trig1$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % Procedures
c1ddb4c814 2021-03-01 jeff@gridfini: procedure kovab(aa,bb); begin
c1ddb4c814 2021-03-01 jeff@gridfini: 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)$
c1ddb4c814 2021-03-01 jeff@gridfini: end;
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: procedure showMatrix(mm); begin
c1ddb4c814 2021-03-01 jeff@gridfini: MATRIX hh(n,n)$
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO FOR J:=0:n-1 DO hh(I+1,J+1):=mm(I,J)$
c1ddb4c814 2021-03-01 jeff@gridfini: write hh;
c1ddb4c814 2021-03-01 jeff@gridfini: end;
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: procedure showVector(vv); begin
c1ddb4c814 2021-03-01 jeff@gridfini: MATRIX hh(n,1)$
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO hh(I+1,1):=vv(I)$
c1ddb4c814 2021-03-01 jeff@gridfini: write hh;
c1ddb4c814 2021-03-01 jeff@gridfini: end;
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % Vectors (1-dim arrays start with index 0)
c1ddb4c814 2021-03-01 jeff@gridfini: ARRAY U(n), V(n), LV(n), B(n), LB(n), BG(n)$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % Arrays (2-dim arrays start with indices (0,0))
c1ddb4c814 2021-03-01 jeff@gridfini: ARRAY G(n,n), GINV(n,n), CHRIST(n,n,n), RIEM(n,n,n,n), RICCI(n,n), EINST(n,n)$
c1ddb4c814 2021-03-01 jeff@gridfini: ARRAY UKV(n,n)$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % Calculations
c1ddb4c814 2021-03-01 jeff@gridfini: % optionally set maximum radius to 1
c1ddb4c814 2021-03-01 jeff@gridfini: % a0:=1$
c1ddb4c814 2021-03-01 jeff@gridfini: % or leave it open
c1ddb4c814 2021-03-01 jeff@gridfini: a:=a0*sqrt(1-t^2)$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % Place
c1ddb4c814 2021-03-01 jeff@gridfini: u(0):=a0*asin(t)$
c1ddb4c814 2021-03-01 jeff@gridfini: u(1):=a*lambda0$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % Metric (cellar indices, covariant, default is zero)
c1ddb4c814 2021-03-01 jeff@gridfini: G(0,0):=a0^2/(1-t^2)$
c1ddb4c814 2021-03-01 jeff@gridfini: G(1,1):=a0^2*(1-t^2)$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % Inverse Metric (roof indices, contravariant)
c1ddb4c814 2021-03-01 jeff@gridfini: MATRIX MG(n,n), MGINV(n,n)$
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO FOR J:=0:n-1 DO MG(I+1,J+1):=G(I,J)$
c1ddb4c814 2021-03-01 jeff@gridfini: MGINV:=1/MG$
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO FOR J:=0:n-1 DO GINV(I,J):=MGINV(I+1,J+1)$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % show metric
c1ddb4c814 2021-03-01 jeff@gridfini: write "g = ",mg;
c1ddb4c814 2021-03-01 jeff@gridfini: write "ginv = ",mginv;
c1ddb4c814 2021-03-01 jeff@gridfini: write "g*ginv = ",mg*mginv;
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % Christoffel symbols
c1ddb4c814 2021-03-01 jeff@gridfini: 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)));
c1ddb4c814 2021-03-01 jeff@gridfini:   
c1ddb4c814 2021-03-01 jeff@gridfini: % curvature tensor
c1ddb4c814 2021-03-01 jeff@gridfini: 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)$
c1ddb4c814 2021-03-01 jeff@gridfini:  
c1ddb4c814 2021-03-01 jeff@gridfini: % Ricci tensor
c1ddb4c814 2021-03-01 jeff@gridfini: 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)$
c1ddb4c814 2021-03-01 jeff@gridfini: write "ricci = "; showMatrix(ricci);
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % curvature scalar
c1ddb4c814 2021-03-01 jeff@gridfini: R:=FOR I:=0:n-1 SUM FOR J:=0:n-1 SUM GINV(I,J)*RICCI(I,J)$
c1ddb4c814 2021-03-01 jeff@gridfini: write "curvature scalar r = ",r;
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % Einstein tensor
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO FOR J:=0:n-1 DO EINST(I,J):=RICCI(I,J)-R/2*G(I,J)$
c1ddb4c814 2021-03-01 jeff@gridfini: write "einstein = "; showMatrix(einst);
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % show place
c1ddb4c814 2021-03-01 jeff@gridfini: write "place u = "; showVector(u);
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % covariant derivative of place u
c1ddb4c814 2021-03-01 jeff@gridfini: kovab(ukv,u)$
c1ddb4c814 2021-03-01 jeff@gridfini: write "cov. deriv. of u = "; showMatrix(ukv);
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % classical velocity
c1ddb4c814 2021-03-01 jeff@gridfini: for k:=0:n-1 do v(k):=df(U(k),X(0))$
c1ddb4c814 2021-03-01 jeff@gridfini: write "v = du/dt = "; showVector(v);
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % local velocity with respect to (x0,x1)
c1ddb4c814 2021-03-01 jeff@gridfini: for k:=0:n-1 do LV(k):=V(k)/V(0)$
c1ddb4c814 2021-03-01 jeff@gridfini: write "lv = dx1/dx0 = "; showVector(lv);
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % max. velocity
c1ddb4c814 2021-03-01 jeff@gridfini: Array vmax(n)$
c1ddb4c814 2021-03-01 jeff@gridfini: svmax:=a0/sqrt(1-t^2)$
c1ddb4c814 2021-03-01 jeff@gridfini: for i:=0:n-1 do vmax(i):=svmax$
c1ddb4c814 2021-03-01 jeff@gridfini: svmaxq:=svmax*svmax$
c1ddb4c814 2021-03-01 jeff@gridfini: write "max. velocity = ",svmax;
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % equation of motion
c1ddb4c814 2021-03-01 jeff@gridfini: 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)$
c1ddb4c814 2021-03-01 jeff@gridfini: write "equation of motion = "; showVector(bg);
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % local acceleration wrt (x0,x1)
c1ddb4c814 2021-03-01 jeff@gridfini: for k:=0:n-1 do LB(k) :=1/V(0)*df(lv(k),x(0))$
c1ddb4c814 2021-03-01 jeff@gridfini: write "la = dlv/dx0 * 1/v0 = "; showVector(lb);
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: %--------------------------------------------------------------
c1ddb4c814 2021-03-01 jeff@gridfini: % write results to file
c1ddb4c814 2021-03-01 jeff@gridfini: OUT "metric2d_results.txt";
c1ddb4c814 2021-03-01 jeff@gridfini: off echo;
c1ddb4c814 2021-03-01 jeff@gridfini: off nat;
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % Metric
c1ddb4c814 2021-03-01 jeff@gridfini: write "metric = ";
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO FOR J:=0:n-1 DO WRITE "(",I,",",J,") = ", G(I,J)$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % Inverse Metric
c1ddb4c814 2021-03-01 jeff@gridfini: WRITE "inverse metric = ";
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO FOR J:=0:n-1 DO WRITE "(",I,",",J,") = ", GINV(I,J)$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % Christoffel symbols
c1ddb4c814 2021-03-01 jeff@gridfini: write "christoffel symbols = ";
c1ddb4c814 2021-03-01 jeff@gridfini: 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)$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % curvature tensor
c1ddb4c814 2021-03-01 jeff@gridfini: write "curvature tensor = ";
c1ddb4c814 2021-03-01 jeff@gridfini: 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)$
c1ddb4c814 2021-03-01 jeff@gridfini:   
c1ddb4c814 2021-03-01 jeff@gridfini: % Ricci tensor
c1ddb4c814 2021-03-01 jeff@gridfini: write "ricci tensor = ";
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO FOR J:=0:n-1 DO WRITE "(",I,",",J,") = ", RICCI(I,J)$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % curvature scalar
c1ddb4c814 2021-03-01 jeff@gridfini: write "curvature scalar = ",R$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % Einstein tensor
c1ddb4c814 2021-03-01 jeff@gridfini: write "einstein tensor = ";
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO FOR J:=0:n-1 DO WRITE "(",I,",",J,") = ",EINST(I,J)$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % place U
c1ddb4c814 2021-03-01 jeff@gridfini: write "place u = ";
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO WRITE "(",I,") = ", U(I)$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % covariant derivative of U
c1ddb4c814 2021-03-01 jeff@gridfini: write "covariant derivative of u = ";
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO FOR J:=0:n-1 DO WRITE "(",I,",",J,") = ",Ukv(I,J)$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % velocity V
c1ddb4c814 2021-03-01 jeff@gridfini: write "velocity v = ";
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO WRITE "(",I,") = ", V(I)$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % local velocity wrt (x0,x1)
c1ddb4c814 2021-03-01 jeff@gridfini: write "local velocity wrt (x0,x1) = ";
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO WRITE "(",I,") = ", LV(I)$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % acceleration
c1ddb4c814 2021-03-01 jeff@gridfini: write "acceleration = ";
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO WRITE "(",I,") = ", B(I)$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % local acceleration wrt (x0,x1)
c1ddb4c814 2021-03-01 jeff@gridfini: write "local acceleration wrt (x0,x1) = ";
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO WRITE "(",I,") = ", LB(I)$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % equation of motion
c1ddb4c814 2021-03-01 jeff@gridfini: write "equation of motion = ";
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO WRITE "(",I,") = ", BG(I)$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % equation of motion 
c1ddb4c814 2021-03-01 jeff@gridfini: on factor;
c1ddb4c814 2021-03-01 jeff@gridfini: write "equation of motion = ";
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO WRITE "(",I,")  =", BG(I)$
c1ddb4c814 2021-03-01 jeff@gridfini: off factor;
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: SHUT "metric2d_results.txt";
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: off revpri;
c1ddb4c814 2021-03-01 jeff@gridfini: on nat;
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: END;
c1ddb4c814 2021-03-01 jeff@gridfini: 

olli-scripts
English Homepage | German Homepage | DL2MIE | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]