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

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

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