
(*This file has the Cayley-Menger determinant*)

Clear[d12,d13,d14,d23,d24,d34];
Clear[h,XX,YY,SOL];
XX={{0,d12,d13,d14},{d12,0,d23,d24},{d13,d23,0,d34},{d14,d24,d34,0}};

YY=Table[Table[h,{4}],{4}]-h IdentityMatrix[4];

cm[X_]:=(
a=X[[1,2]] X[[1,2]];
b=X[[1,3]] X[[1,3]];
c=X[[1,4]] X[[1,4]];
d=X[[2,3]] X[[2,3]];
e=X[[2,4]] X[[2,4]];
f=X[[3,4]] X[[3,4]];
mm={{0,1,1,1,1},{1,0,a,b,c},{1,a,0,d,e},{1,b,d,0,f},{1,c,e,f,0}};
Det[mm])

(*The directional derivative is obtained as follows:

1. Compute x0=cm[XX+YY].
2. Compute x1=D[x0,h];
3. Set h=0, and then take Expand[x1]
*)