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

5ce5316a33 2021-03-01 jeff@gridfini: % calculation of metric tensor (4-dim space-time)
5ce5316a33 2021-03-01 jeff@gridfini: 
5ce5316a33 2021-03-01 jeff@gridfini: off echo;
5ce5316a33 2021-03-01 jeff@gridfini: on revpri;
5ce5316a33 2021-03-01 jeff@gridfini: n:=4;
5ce5316a33 2021-03-01 jeff@gridfini: 
5ce5316a33 2021-03-01 jeff@gridfini: array f(n+1), dfdt(n+1), dfdl0(n+1), dfdl1(n+1), dfdl2(n+1)$
5ce5316a33 2021-03-01 jeff@gridfini: 
5ce5316a33 2021-03-01 jeff@gridfini: array g(n,n)$
5ce5316a33 2021-03-01 jeff@gridfini: 
5ce5316a33 2021-03-01 jeff@gridfini: operator x$
5ce5316a33 2021-03-01 jeff@gridfini: x(0):=t; x(1):=lambda0; x(2):=lambda1; x(3):=lambda2;
5ce5316a33 2021-03-01 jeff@gridfini: 
5ce5316a33 2021-03-01 jeff@gridfini: % rules
5ce5316a33 2021-03-01 jeff@gridfini: trig1:={sin(~x)^2=>(1-cos(x)^2)}$ let trig1$
5ce5316a33 2021-03-01 jeff@gridfini: 
5ce5316a33 2021-03-01 jeff@gridfini: % procedures
5ce5316a33 2021-03-01 jeff@gridfini: procedure scalprod(a,b); begin
5ce5316a33 2021-03-01 jeff@gridfini: integer n; n:=first(length(a))-1; 
5ce5316a33 2021-03-01 jeff@gridfini: result:=for i:=0:n-1 sum a(i)*b(i);
5ce5316a33 2021-03-01 jeff@gridfini: return result end;
5ce5316a33 2021-03-01 jeff@gridfini: 
5ce5316a33 2021-03-01 jeff@gridfini: 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;
5ce5316a33 2021-03-01 jeff@gridfini: 
5ce5316a33 2021-03-01 jeff@gridfini: 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;
5ce5316a33 2021-03-01 jeff@gridfini: 
5ce5316a33 2021-03-01 jeff@gridfini: % current radius
5ce5316a33 2021-03-01 jeff@gridfini: a:=a0*sqrt(1-t^2);
5ce5316a33 2021-03-01 jeff@gridfini: 
5ce5316a33 2021-03-01 jeff@gridfini: % surface of hyper sphere in t and lambda
5ce5316a33 2021-03-01 jeff@gridfini: 
5ce5316a33 2021-03-01 jeff@gridfini: f(0):=a*cos(lambda0)*cos(lambda1)*cos(lambda2);
5ce5316a33 2021-03-01 jeff@gridfini: f(1):=a*cos(lambda0)*cos(lambda1)*sin(lambda2);
5ce5316a33 2021-03-01 jeff@gridfini: f(2):=a*cos(lambda0)*sin(lambda1);
5ce5316a33 2021-03-01 jeff@gridfini: f(3):=a*sin(lambda0);
5ce5316a33 2021-03-01 jeff@gridfini: f(4):=a0*t;
5ce5316a33 2021-03-01 jeff@gridfini: 
5ce5316a33 2021-03-01 jeff@gridfini: for i:=0:n do dfdt(i):=df(f(i),x(0))$
5ce5316a33 2021-03-01 jeff@gridfini: for i:=0:n do dfdl0(i):=df(f(i),x(1))$
5ce5316a33 2021-03-01 jeff@gridfini: for i:=0:n do dfdl1(i):=df(f(i),x(2))$
5ce5316a33 2021-03-01 jeff@gridfini: for i:=0:n do dfdl2(i):=df(f(i),x(3))$
5ce5316a33 2021-03-01 jeff@gridfini: 
5ce5316a33 2021-03-01 jeff@gridfini: g(0,0):=scalprod(dfdt,dfdt)$
5ce5316a33 2021-03-01 jeff@gridfini: g(0,1):=scalprod(dfdt,dfdl0)$
5ce5316a33 2021-03-01 jeff@gridfini: g(0,2):=scalprod(dfdt,dfdl1)$
5ce5316a33 2021-03-01 jeff@gridfini: g(0,3):=scalprod(dfdt,dfdl2)$
5ce5316a33 2021-03-01 jeff@gridfini: 
5ce5316a33 2021-03-01 jeff@gridfini: g(1,0):=scalprod(dfdl0,dfdt)$
5ce5316a33 2021-03-01 jeff@gridfini: g(1,1):=scalprod(dfdl0,dfdl0)$
5ce5316a33 2021-03-01 jeff@gridfini: g(1,2):=scalprod(dfdl0,dfdl1)$
5ce5316a33 2021-03-01 jeff@gridfini: g(1,3):=scalprod(dfdl0,dfdl2)$
5ce5316a33 2021-03-01 jeff@gridfini: 
5ce5316a33 2021-03-01 jeff@gridfini: g(2,0):=scalprod(dfdl1,dfdt)$
5ce5316a33 2021-03-01 jeff@gridfini: g(2,1):=scalprod(dfdl1,dfdl0)$
5ce5316a33 2021-03-01 jeff@gridfini: g(2,2):=scalprod(dfdl1,dfdl1)$
5ce5316a33 2021-03-01 jeff@gridfini: g(1,3):=scalprod(dfdl1,dfdl2)$
5ce5316a33 2021-03-01 jeff@gridfini: 
5ce5316a33 2021-03-01 jeff@gridfini: g(3,0):=scalprod(dfdl2,dfdt)$
5ce5316a33 2021-03-01 jeff@gridfini: g(3,1):=scalprod(dfdl2,dfdl0)$
5ce5316a33 2021-03-01 jeff@gridfini: g(3,2):=scalprod(dfdl2,dfdl1)$
5ce5316a33 2021-03-01 jeff@gridfini: g(3,3):=scalprod(dfdl2,dfdl2)$
5ce5316a33 2021-03-01 jeff@gridfini: 
5ce5316a33 2021-03-01 jeff@gridfini: write "f = "; showvector(f);
5ce5316a33 2021-03-01 jeff@gridfini: write "df/dt = "; showvector(dfdt);
5ce5316a33 2021-03-01 jeff@gridfini: write "g = "; showmatrix(g);
5ce5316a33 2021-03-01 jeff@gridfini: 
5ce5316a33 2021-03-01 jeff@gridfini: off revpri;
5ce5316a33 2021-03-01 jeff@gridfini: on echo;
5ce5316a33 2021-03-01 jeff@gridfini: end;

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