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

c1ddb4c814 2021-03-01 jeff@gridfini: % calculation of metric tensor (2-dim space-time)
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: off echo;
c1ddb4c814 2021-03-01 jeff@gridfini: on revpri;
c1ddb4c814 2021-03-01 jeff@gridfini: n:=2;
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: operator x$
c1ddb4c814 2021-03-01 jeff@gridfini: x(0):=t; x(1):=lambda0;
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % metric
c1ddb4c814 2021-03-01 jeff@gridfini: array g(n,n)$
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)}$ let trig1$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % procedures
c1ddb4c814 2021-03-01 jeff@gridfini: procedure scalprod(a,b); 
c1ddb4c814 2021-03-01 jeff@gridfini: begin integer n;
c1ddb4c814 2021-03-01 jeff@gridfini: n:=first(length(a))-1; 
c1ddb4c814 2021-03-01 jeff@gridfini: result:=for i:=0:n-1 sum a(i)*b(i);
c1ddb4c814 2021-03-01 jeff@gridfini: return result 
c1ddb4c814 2021-03-01 jeff@gridfini: end;
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: procedure showmatrix(mm);
c1ddb4c814 2021-03-01 jeff@gridfini: begin integer m,n;l:=length(mm);m:=first(l)-1;n:=second(l)-1;
c1ddb4c814 2021-03-01 jeff@gridfini: matrix hhm(m,n);
c1ddb4c814 2021-03-01 jeff@gridfini: for i:=0:m-1 do for j:=0:n-1 do hhm(i+1,j+1):=mm(i,j);
c1ddb4c814 2021-03-01 jeff@gridfini: write hhm end;
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: procedure showvector(vv);
c1ddb4c814 2021-03-01 jeff@gridfini: begin integer n;n:=first(length(vv))-1;
c1ddb4c814 2021-03-01 jeff@gridfini: matrix hhv(n,1);
c1ddb4c814 2021-03-01 jeff@gridfini: for i:=0:n-1 do hhv(i+1,1):=vv(i);
c1ddb4c814 2021-03-01 jeff@gridfini: write hhv end;
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: array f(n+1), dfdt(n+1), dfdl(n+1)$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % current radius
c1ddb4c814 2021-03-01 jeff@gridfini: a:=a0*sqrt(1-t^2);
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: % surface of hyper sphere in t and lambda
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: f(0):=a*cos(lambda0);
c1ddb4c814 2021-03-01 jeff@gridfini: f(1):=a*sin(lambda0);
c1ddb4c814 2021-03-01 jeff@gridfini: f(2):=a0*t;
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: for i:=0:n do dfdt(i):=df(f(i),x(0));
c1ddb4c814 2021-03-01 jeff@gridfini: for i:=0:n do dfdl(i):=df(f(i),x(1));
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: g(0,0):=scalprod(dfdt,dfdt)$
c1ddb4c814 2021-03-01 jeff@gridfini: g(0,1):=scalprod(dfdt,dfdl)$
c1ddb4c814 2021-03-01 jeff@gridfini: g(1,0):=scalprod(dfdl,dfdt)$
c1ddb4c814 2021-03-01 jeff@gridfini: g(1,1):=scalprod(dfdl,dfdl)$
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: write "f = "; showvector(f);
c1ddb4c814 2021-03-01 jeff@gridfini: write "df/dt = "; showvector(dfdt);
c1ddb4c814 2021-03-01 jeff@gridfini: write "df/dl = "; showvector(dfdl);
c1ddb4c814 2021-03-01 jeff@gridfini: write "g = "; showmatrix(g);
c1ddb4c814 2021-03-01 jeff@gridfini: 
c1ddb4c814 2021-03-01 jeff@gridfini: off revpri;
c1ddb4c814 2021-03-01 jeff@gridfini: on echo;
c1ddb4c814 2021-03-01 jeff@gridfini: end;

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