Origin for each line in src/metric2calc.red from check-in 5ce5316a33:

5ce5316a33 2021-03-01    1: % calculation of metric tensor (2-dim space-time)
5ce5316a33 2021-03-01    2: 
5ce5316a33 2021-03-01    3: off echo;
5ce5316a33 2021-03-01    4: on revpri;
5ce5316a33 2021-03-01    5: n:=2;
5ce5316a33 2021-03-01    6: 
5ce5316a33 2021-03-01    7: operator x$
5ce5316a33 2021-03-01    8: x(0):=t; x(1):=lambda0;
5ce5316a33 2021-03-01    9: 
5ce5316a33 2021-03-01   10: % metric
5ce5316a33 2021-03-01   11: array g(n,n)$
5ce5316a33 2021-03-01   12: 
5ce5316a33 2021-03-01   13: % rules
5ce5316a33 2021-03-01   14: trig1:={sin(~x)^2=>(1-cos(x)^2)}$ let trig1$
5ce5316a33 2021-03-01   15: 
5ce5316a33 2021-03-01   16: % procedures
5ce5316a33 2021-03-01   17: procedure scalprod(a,b); 
5ce5316a33 2021-03-01   18: begin integer n;
5ce5316a33 2021-03-01   19: n:=first(length(a))-1; 
5ce5316a33 2021-03-01   20: result:=for i:=0:n-1 sum a(i)*b(i);
5ce5316a33 2021-03-01   21: return result 
5ce5316a33 2021-03-01   22: end;
5ce5316a33 2021-03-01   23: 
5ce5316a33 2021-03-01   24: procedure showmatrix(mm);
5ce5316a33 2021-03-01   25: begin integer m,n;l:=length(mm);m:=first(l)-1;n:=second(l)-1;
5ce5316a33 2021-03-01   26: matrix hhm(m,n);
5ce5316a33 2021-03-01   27: for i:=0:m-1 do for j:=0:n-1 do hhm(i+1,j+1):=mm(i,j);
5ce5316a33 2021-03-01   28: write hhm end;
5ce5316a33 2021-03-01   29: 
5ce5316a33 2021-03-01   30: procedure showvector(vv);
5ce5316a33 2021-03-01   31: begin integer n;n:=first(length(vv))-1;
5ce5316a33 2021-03-01   32: matrix hhv(n,1);
5ce5316a33 2021-03-01   33: for i:=0:n-1 do hhv(i+1,1):=vv(i);
5ce5316a33 2021-03-01   34: write hhv end;
5ce5316a33 2021-03-01   35: 
5ce5316a33 2021-03-01   36: array f(n+1), dfdt(n+1), dfdl(n+1)$
5ce5316a33 2021-03-01   37: 
5ce5316a33 2021-03-01   38: % current radius
5ce5316a33 2021-03-01   39: a:=a0*sqrt(1-t^2);
5ce5316a33 2021-03-01   40: 
5ce5316a33 2021-03-01   41: % surface of hyper sphere in t and lambda
5ce5316a33 2021-03-01   42: 
5ce5316a33 2021-03-01   43: f(0):=a*cos(lambda0);
5ce5316a33 2021-03-01   44: f(1):=a*sin(lambda0);
5ce5316a33 2021-03-01   45: f(2):=a0*t;
5ce5316a33 2021-03-01   46: 
5ce5316a33 2021-03-01   47: for i:=0:n do dfdt(i):=df(f(i),x(0));
5ce5316a33 2021-03-01   48: for i:=0:n do dfdl(i):=df(f(i),x(1));
5ce5316a33 2021-03-01   49: 
5ce5316a33 2021-03-01   50: g(0,0):=scalprod(dfdt,dfdt)$
5ce5316a33 2021-03-01   51: g(0,1):=scalprod(dfdt,dfdl)$
5ce5316a33 2021-03-01   52: g(1,0):=scalprod(dfdl,dfdt)$
5ce5316a33 2021-03-01   53: g(1,1):=scalprod(dfdl,dfdl)$
5ce5316a33 2021-03-01   54: 
5ce5316a33 2021-03-01   55: write "f = "; showvector(f);
5ce5316a33 2021-03-01   56: write "df/dt = "; showvector(dfdt);
5ce5316a33 2021-03-01   57: write "df/dl = "; showvector(dfdl);
5ce5316a33 2021-03-01   58: write "g = "; showmatrix(g);
5ce5316a33 2021-03-01   59: 
5ce5316a33 2021-03-01   60: off revpri;
5ce5316a33 2021-03-01   61: on echo;
5ce5316a33 2021-03-01   62: end;

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