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

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

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