function [ bx,by,bz ] = mag(x,y,z)
b0=1.;
r=sqrt(power(x,2)+power(y,2)+power(z,2));

bx=-3.*b0*z*x/power(r,5);
by=-3.*b0*z*y/power(r,5);
bz=-b0*(2*power(z,2)-power(x,2)-power(y,2))/power(r,5);
end

