User:AboutFace 22/sandbox

3.1. Spherical Harmonics

In order to be able to represent a function on a sphere in a rotation invariant manner, we utilize the mathematical notion of spherical harmonics to describe the way that rotations act on a spherical function. The theory of spherical harmonics says that any smooth enough spherical function $$\mathfrak{f}(\theta,\phi)$$ can be decomposed as the sum of its harmonics:

where degree $$l$$ and order $$m$$ and

Normalization factor for trigonometric functions $$sin/cos$$ does not depend on index $$m$$ and is:

$$\mathcal{N}_{sin/cos} = \sqrt {\frac{\pi}{2}}$$ Thus to normalize a trigonometric function the factor will be the inverse of this:

$$\sqrt{\frac{2}{\pi}} cos(m x)$$ for instance

Normalization factor $$\mathrm{N}$$ in formula [2] is defined below and

and

Fourier transform component:

Legendre transform:

and discrete form of Gauss-Legendre transform:

Angles $$\theta_j$$ and $$w_j$$ in formula [7] above are abscissas and weights for Gauss-Legendre Integration given elsewhere, e.g in Ref {5}

$$\bullet$$   ALTERNATIVE EXPRESSION OF COEFFICIENTS:

Assuming

we can rewrite the expression (8) as


 * FOURIER SERIES Ref {6}

$$\bullet$$  DISCRETE FOURIER TRANSFORM

Forward Transform:

Inverse Transform:

or assuming that we have calculated coefficients

$$f_m(\theta) = a_m cos(m\phi) + i b_m sin(m\phi)$$ in [5], the function $$s(\phi)$$ can be restored as:

$$s(\phi) = \frac{a_0}{2} + \sum^{\infty}_{m=0}[a_m cos(m\phi) + b_m sin(m\phi)]$$

where $$a_m$$ and $$b_m$$ are real and imaginary components correspondingly to the Fourier transform of the periodic function $$s(x)$$.

$$\bullet$$   WAVELENGTH AND OTHERS  Ref {8}

Wavelength of $$Y_l^m$$ in meridional direction $$ \Rrightarrow \lambda(l) = \frac{2\pi}{l + \frac{1}{2}}~$$ Does not depend on $$m$$

It is possible to show that to resolve an object with a certain angular diameter on the retina the system should have Spherical Harmonics whose half of the wavelength in the meridional direction (ALP) and parallel direction (Trigonometric functions) be roughly equal to the angular diameter of the object. The above formula shows that for a visual recognition device with maximum acuity to match the maximum human resolution of 1.0 arc min should have $$l$$ = 21,600. This amount of index $$l$$ will give us the whole period. We need to match the half-period to the the angular size of the outside object. That will give us $$l$$ = 10,800. Since this small object resolution might be considered at the end of the capacity of the system, we may divide this number by at least 5. This will give us the final value of $$l$$ = 2,160. Computing Associated Legendre Polynomials with such high degrees is possible with the existing normalized recurrence formulas. With the distance from the North Pole of 2-sphere large, the approximations with trigonometric functions $$sin$$ and $$cos$$ will work perfectly.

$$~$$

There are $$2l + 1$$ linearly independent eigenfunctions per $$l:~\nabla_1^2Y_l^m = -l(l+1)Y_l^m$$

$$Re~Y^m_l$$ vanishes on $$2m$$ meridians and $$l-m$$ parallels; $$Im~Y_l^m$$ is the same but rotated around axis $$\mathcal{Z}$$ Those are the roots of $$P_l^m$$ and $$cos m\phi$$ and $$sin m\phi$$.

Also: $$Y^{-m}_l = (-1)^m (Y_l^m)^*$$

$$\bullet$$ PERIODICITY OF TRIGONOMETRIC FUNCTIONS

$$\bullet$$  INTERVAL CHANGE

An integral over [a, b] must be changed into an integral over [−1, 1] before applying the Gaussian quadrature rule. This change of interval can be done in the following way:

Applying the Gaussian quadrature rule then results in the following approximation:

I use this formula to integrate along the meridians. $$x_i$$ and $$w_i$$ are abscissas and weights given in Ref {5}.


 * SUBSPACES AND ROTATIONS Ref {7}

The key property of this decomposition is that if we restrict to some frequency $$\mathfrak{l}$$, and define the subspace of functions:

then:


 * $$V_l$$ is a Representation For the Rotation Group: For any function $$\mathfrak{f}$$ $${\in}V_l$$ and any rotation R, we have R($$\mathfrak{f}$$) $${\in}V_l$$

This can also be expressed in the following manner: if $$\pi_l$$ is the projection onto the subspace $$V_l$$ then $$\pi_l$$ commutes with rotations:


 * $$V_l$$ is Irreducible $$V_l$$ cannot be further decomposed as a direct sum $$V_l$$ = $$V{_l^i}$$⊕$$V{_l^j}$$ where $$V{_l^i}$$ and $$V{_l^j}$$ are also (nontrivial) representation of rotation group.

The first property presents a way for decomposing spherical functions into rotation in variant components, while the second property guarantees that, in a linear sense, this decomposition is optimal

3.2 Rotation Invariant Descriptors

Using the properties of spherical harmonics and the observation that rotation of the spherical harmonics does not change its $$L_2$$-norm we represents the energies of the spherical function f (θ,φ) as:

where $$\mathfrak{f}_l$$ are frequency components of $$\mathfrak{f}$$:

Parseval's theorem for Spherical Harmonics expansion gives Ref {8}:

$$\parallel f \parallel = \sum_{l=0}^\infty \Biggl[\sum_{m=-l}^l \left | c_l^m \right |^2 \Biggr]$$

The term in square brackets gives a power spectrum of $$f$$ as a function of reciprocal wavelength or wavenumber ($$l$$ is sometimes call the spherical wavenumber).

This representation has the property that it is independent of the orientation of the spherical function and therefore constitute a computable invariant. To see this we let R be any rotation and we have:


 * = $$\{ {\parallel\mathrm{R}\pi_0(f)\parallel,\parallel\mathrm{R}\pi_1(f)\parallel,....} \}$$


 * = $$\{ {\parallel\pi_0(f)\parallel,\parallel\pi_1(f)\parallel,....} \}$$


 * =  $$SH(\mathfrak{f})$$

The following is from the Wikipedia article on Spherical Harmonics (with my comments as well):

While computing invariants it may be necessary to take into account the contribution of expansion coefficients with negative m index). This contribution is not linear and cannot simply be discounted. On the other hand you may consider dropping some subset of indices m across the whole range of $$-l<m<+l$$, for instance you can drop even or odd m's or to drop two or three in a row and then use the next one. The only rule must apply: it has to be uniform for negative and positive m's.

You can use Stirling approximation to compute large factorials or you can reduce the fraction by noticing that the fraction with factorials will be equal to


 * POWER SPECTRUM IN SIGNAL PROCESSING

The total power of a function $$\mathfrak{f}$$ is defined in the signal processing literature as the integral of the function squared, divided by the area of its domain. Using the orthonormality properties of the real unit-power spherical harmonic functions, it is straightforward to verify that the total power of a function defined on the unit sphere is related to its spectral coefficients by a generalization of Parseval's theorem:

where

is defined as the angular power spectrum. In a similar manner, one can define the cross-power of two functions as

where

As one can see the previous paragraph is directly related to our two perspectives. Those "total powers of a function" split in ribbons in the vector space with the same degree $$l$$ are in fact the invariants we must use.


 * NORMALIZATION (LEGENDRE POLYNOMIALS FIRST):


 * NORMALIZATION (ASSOCIATED LEGENDRE POLYNOMIALS):

I have a few questions concerning orthonormality of Associated Legendre Polynomials (ALP). I want to stress the word orthonormality as opposed to simply orthogonality. The reason for that is computational. It is a well known fact that when ALP with large indices $$l$$ & $$m$$ are computed the functional values grow in magnitude to the point that the exponents overflow. Double precision is required and in some cases even quadruple precision is needed. The normalization diminishes the absolute values of the functions considerably but not universally. I want to make sure that I understand normalization correctly. Wikipedia article on ALP gives two formulas.

Thus the normalization factor here will be:

Where &delta;k, &#8467; is the Kronecker delta.

I call it normalization in respect to $$l$$

For my task it is more important to normalize in respect to $$m$$. It is given by this formula:

The normalization factor for each subspace with a given $$l$$ but differing $$m$$ should be this:


 * NORMALIZATION IN ACOUSTICS:


 * NORMALIZATION IN QUANTUM MECHANICS:

which are orthonormal:

The $$\pi$$ in the formula [31] signifies normlalization for trigonometric $$ e^{im\phi}$$ part

$$\bullet$$ NORMALIZATION PER keisan.casio CALCULATOR


 * NORMALIZED ASSOCIATED LEGENDRE POLYNOMIALS WITH NEGATIVE M

Multiplying both sides by normalization coefficients:

we get:


 * CONVENIENT FORMULAS:



Taking into account that 0! = 1 the normalization factors in both $$P_l^l(x)$$ and $$P_{l+1}^{l+1}(x)$$ should be

Multiplying both sides of the equation [40] we get:

where polynomials are normalized.



The next formula ([43]) is easily derived from [40] by saying $$n = l+1$$:

Likewise multiplying the expression [40] by it's appropriate normalization coefficients $$~N_l^l~$$ [38] and:

we get:

[45] is implemented as highOrder_ALP_LeqM_Norm. Matches Belousov's values.



where

depending on $$n$$ being even or odd


 * RECURRENCES:



MOVING UP ALONG INCREASING $$l$$ with $$m=0$$ (non-associated Legendre polynomials)

To normalize [48] we need to multiply both sides with three normalization coefficients:

The result is :



MOVING ALONG INCREASING INDEXES $$m$$ TO THE RIGHT (INCREASING INDEX $$m$$ AND CONSTANT INDEX $$l$$)

Take a Wikipedia formula (second in the column)

is modified by saying $$n = m+1$$ (rechecked 11/20/16):

The result is (Moving along indices M to the right, in the direction of increasing index M):

Formula [52] checked again on 12/09/17

Multiplying both sides of the equation [52] by normalization factors

and simplifying we get:

or simplifying again:

where $$\hat{P} $$ is a normalized Associated Legendre Polynomial (normalized in respect to $$l$$)

NORMALIZATION OF EXPRESSION [52] IN RESPECT TO $$m$$:

where $$\hat{P}^m_l(x)$$ is an Associated Legendre Polynomial degree $$l$$ and order $$m$$ normalized in respect to $$m$$



MOVING ALONG INDEXES $$m$$ TO THE LEFT (IN THE DIRECTION OF DECREASING INDEXES $$m$$) :

Again taking as a source the Wikipedia formula (second formula from the top of the column)

We substitute $$n = m - 1; m = n + 1;  m + 1 = n + 2$$ and after a simple transformation we get:

$$$$[58] is verified on 12/10/2017

To normalize we multiply all three terms sequentially by normalization factors:

As a result we have :

FORMULA 60 IS INCORRECT

The following formula taken from Ref {3}

$$u = sin \theta;~t = cos\theta$$

$$j = 2$$ for $$m = 0$$ and $$j = 1$$ for $$m > 0~$$ using

$$g_l^m = \frac{2(m + 1)}{\sqrt{(l-m)(l + m + 1)}}$$ and

$$h_l^m = \sqrt{\frac{(l + m + 2)(l - m - 1)}{(l - m)(l + m + 1)}}$$ we get:

FORMULA 62 IS CORRECT

OBVIOUSLY THERE IS DIFFERENCE IN SIGNS BETWEEN MY DERIVATION AND CLENSHAW'S



Taking the first Wikipedia recurrence formula (also formula [76] here):

saying $$n = l+1$$ and substituting we get:

Recurrence formula (B.8)

The factors to normalize the recurrence [52] are [49], first formula above and:

Applying them to equation [52] we get:



Also recurrence formulas (Wikipedia: Associated Legendre Polynomials; 7th formula from the top of the column):

Assuming $$m=0$$ in formula [55], the value of $$P^{1}_l$$ might be easily calculated

To get normalized polynomials three factors are needed:

Applying them consecutively we eventually get:

Which connects normalized Legendre polynomials we need to apply formula [54] to move along the horizontal row of indexes M from left to right.



Formula

is normalized with sequential multiplication by two normalizing factors derived from [28]:

The result is:

or:



Original Wikipedia formula (the first formula in the column):

assuming $$n = l + 1$$

Multiplying both sides of [76] sequentially by normalization factors:

$$N^m_l = \sqrt{\frac{(2l+1)(l-m)!}{2(l+m)!}};~N^m_{l-1} = \sqrt{\frac{(2l-1)(l-m-1)!}{2(l+m-1)!}};~N^m_{l-2} = \sqrt{\frac{(2l-3)(l-m-2)!}{2(l+m-2)!}}$$

we get:

Ref {3} again:

Substituting:

$$a_l^m = \sqrt{\frac{(2l - 1)(2l + 1)}{(l - m)(l + m)}}$$ and

$$b_l^m = \sqrt{\frac{(2l + 1)(l + m - 1)(l - m + 1)}{(l - m)(l + m)(2l + 3)}}$$



Belousov's formula ([17]):

$$\hat{P}^{~m}_l(cos\theta) = \sqrt{\frac{(2l+1)(l+m-1)(l+m-3)}{(2l-3)(l+m)(l+m-2)}}\hat{P}^{~m-2}_{l-2}(cos\theta) - \sqrt{\frac{(2l+1)(l+m-1)(l-m+1)}{(2l-1)(l+m)(l+m-2)}}cos\theta\hat{P}^{~m-2}_{l-1}(cos\theta)$$



Efficient Spherical Harmonics Transform aimed at pseudo-spectral numerical simulations by Nathanael Schaeffer.

or:

with:



Taking this Wikipedia formula as a basis to compute the first derivative of ALP's:

Multiplying sequentially by two normalization factors [59 - first] and [59 - second] we get




 * INEQUALITY:

After normalization (formula [28]):

$$\max{\left\vert \hat{P}_n^m(x) \right\vert} \le \sqrt{\frac{2l+1}{2}}$$


 * DETERMINANT

Contribution by Quondum in response to my post in Math Section under the heading "DETERMINANT:"

If you want to describe an arc from $$\mathbf{X_1}$$ and $$\mathbf{X_2}$$ can't you just say that:

where s is an arbitrary new parameter that runs from 0 to 1 and R is the radius of the sphere. Then in a cartesian representation $$\mathbf{A_3}(s)$$ describes a secant In through the sphere, and the re scaling projects that path to the surface, hence defining an arc. It will break down if the starting points are exact antipodes, but that case if pretty ill-defined anyway.

This can be extended to the case of a rectangle defined by $$\mathbf{X_1}, \mathbf{X_2}, \mathbf{X_3}, \mathbf{X_4}$$ by introducing a second parameter t:

Assuming that the natural edges of the rectangle are $$\mathbf{X_1}$$ to $$\mathbf{X_2}$$, $$\mathbf{X_2}$$ to $$\mathbf{X_4}$$, $$\mathbf{X_4}$$ to $$\mathbf{X_3}$$, and $$\mathbf{X_3}$$ to $$\mathbf{X_1}$$.

It is worth noting that a uniform sampling of s and t, will not uniformly sample the surface of the sphere (especially if the points are far apart), but it is a good starting point. Dragons flight (talk) 19:29, 3 December 2014 (UTC)


 * Take the four vectors to the corners of the rectangle as X1, X2, X3, X4 (in say anticlockwise order).
 * Find the four vectors representing each edge of the rectangle using the cross product: A12 = X1 × X2, A23 = X2 × X3, A34 = X3 × X4, A41 = X4 × X1.
 * Now find the four dot products that I was referring to: d12 = X5 ⋅ A12, d23 = X5 ⋅ A23, etc.
 * When all four are positive (or is it all negative?), X5 is inside the rectangle.


 * INDIVIDUAL ROTATION MATRICES IN 3-D SPACE:

Each rotation is performed in counterclockwise manner, e.g. rotation $$R(\theta_z)$$ is performed with the positive direction of axis Z looking at the observer. The coordinates of each point in xy plane are represented by a column vector. The plane therefore rotates in counter-clockwise direction.


 * Right hand rotation around axis X via angle $$\theta_x$$:


 * Right hand rotation around axis Y via angle $$\theta_y$$


 * Right hand rotation around axis Z via angle $$\theta_z$$

My sequence of rotations is defined as:

where $$R(\theta_x)$$ is performed first


 * CAMERA MATRIX

$$\begin{bmatrix}cos(\theta_y) & 0 & sin(\theta_y)\\cos(\theta_x) & cos (\theta_x) & -sin(\theta_x)cos(\theta_y)\\-cos(\theta_x)sin(\theta_y) & sin(\theta_x) & cos(\theta_x)cos(\theta_y)\end{bmatrix}\begin{bmatrix}cos(\theta_z)&-sin(\theta_z) & 0\\sin(\theta_z)&cos(\theta_z)&0\\0&0&1\end{bmatrix} =$$ $$\begin{bmatrix}cos(\theta_y)cos(\theta_z)&-cos(\theta_y)sin(\theta_z)&sin(\theta_y)\\cos(\theta_x)cos(\theta_z)+cos(\theta_x)sin(\theta_z)&-cos(\theta_x)sin(\theta_z)+cos(\theta_x)cos(\theta_z)&-sin(\theta_x)cos(\theta_y)\\-cos(\theta_x)sin(\theta_y)cos(\theta_z)+sin(\theta_x)sin(\theta_z)&cos(\theta_x)sin(\theta_y)sin(\theta_z)+sin(\theta_x)cos(\theta_z)&cos(\theta_x)cos(\theta_y)\end{bmatrix}$$


 * BIBLIOGRAPHY

{1} Solomon L'vovich Belousov, Tables of Normalized Associated Legendre Polynomials Pergamon Press 1962. $$$$

{2} Dmitrii Alexandrovich Varshalovich, Anatolii Nikolaevich Moskalev, V.K Khersonskii Quantum Theory of Angular Momentum, 1988 World Scientific

{3}    S. A. Holmes W. E. Featherstone. A unified approach to the Clenshaw summation and the recursive computation of very high degree and order normalised associated Legendre functions. Journal of Geodesy, May 2002, Volume 76, Issue 5, pp 279–299

{4} Nathanael Schaeffer Efficient spherical harmonic transforms aimed at pseudospectral numerical simulations STerre, Universit ́e de Grenoble 1, CNRS, F-38041 Grenoble, France

{5} Pavel Holoborodko, Numerical integration. , as archived October 13, 2016;

{6} Fourier Series: Basic Results

{7} Michael Kazhdan, Thomas Funkhouser, and Szymon Rusinkiewicz Rotation Invariant Spherical Harmonic Representation of 3D Shape Descriptors Eurographics Symposium on Geometry Processing (2003) L. Kobbelt, P. Schröder, H. Hoppe (Editors)

{8} Spherical Harmonics