;Program to see what the dimensionless determinant of the jacobian of the magnetic field looks like with various parameters. Works wellwith a histogram
zeta = 0
c = 0.777342 ; typical value of c
n = 1000000L
n1 = randomn(seed,n)
n2 = randomn(seed,n)
n3 = randomn(seed,n)
n4 = randomn(seed,n)
n5 = randomn(seed,n)
wc = 100 ; alfven wave frequency can be changed to see how many values are left for a given frequency
gdet = ( 1/4.)*(((sqrt(1-c^2)*n5 + c*zeta)^3) + ( (1-c^2)*((n3^2 + n4^2) -0.5*(n1^2 +n2^2)*(sqrt(1-c^2)*n5 + c*zeta)) ) + (1-c^2)*(sqrt(2)*n2*n3*n4 + (1/sqrt(2))*(n3^2 - n4^2)*n1)) ; dimensionless determinant
gdet = abs(gdet)
bp = exp(-0.5*(zeta)^2)/(sqrt(2)*(pi)^(1.5))*gdet ; dimensionless G
print, mean(bp)
for i = 0L,n-1 do begin
if gdet[i] lt wc then gdet[i] = gdet[i] else gdet[i] = 0
endfor
gdt = mean(gdet*exp(-0.5*(zeta)^2)/(sqrt(2)*(pi)^(1.5))) ; corrected dimensionless G
print, gdt
end