Search code examples
pythonmatlabmathphysicsspherical-coordinate

Vector orientation in spherical coordinates


I am trying to characterize the angular deviation of a set of 3D Cartesian vectors V = {v_i} from a fixed z-axis. V is constructed by discretely sampling a complex physical system so it suffers from noise, sparse sampling, etc. If we work in spherical coordinates, I define the azimuthal angle as "phi" and the altitude or polar angle from the z-axis as "theta" (the "physics" convention described here).

I am most interested the angle theta between the elements of V and the z-axis, so I have constructed an area-normalized histogram P_approx(theta) with a 1 degree bin-width across a theta range from 0 to 180 degrees which serves as an approximation of the true probability distribution P(theta). P_approx(theta) is peaked between 0 and 180 and falls toward zero at theta = 0 and theta = 180. A theta-only histogram is desirable since the system should show azimuthal symmetry and summing over all values of phi improves the statistics of the resulting histogram.

I am reluctant to use P_approx(theta) to characterize the angular behavior in my system since orientations near theta = 90 are favored relative to orientations near theta = 0 and theta = 180 (more surface area of the unit sphere when integrating along phi). For example, if the vector evenly samples the upper hemisphere of a unit sphere (0 < theta < 90, 0 < phi < 360), the P(theta) will still be peaked. This is misleading.

Does anyone know of a more physically-insightful method to characterize the angular preferences of the dataset V?


Solution

  • As far as I understand, you are interested in the density, not the integral (as you do it now).

    To be more clear: you integrate for the histogram over phi (0 < phi < 360) and put the result in the propper histogram bin. To get the density, you can just devide by the surface area of the cone you are integrating for that special bin. To be more precise, you integrate over something like a hollow (thin walled) cone, so you should actually devide by the volume of this hollow cone.