ronandrevon / pyScatSpheres

GNU General Public License v3.0
1 stars 1 forks source link

improve speed of near field computation #1

Open ronandrevon opened 3 years ago

ronandrevon commented 3 years ago

By implementing spherical harmonics using the legendre polynomials recurrence formula, the speed of the wave function computation should be improved.

kitine commented 3 years ago

Implementation of the spherical harmonics :

Recurrence formula used for the implementation :

formule3 formule2 formule1

Explenation of the implemented matrix

Capture d’écran 2021-08-09 000925

Implementation of the legendre polynomes

Capture d’écran 2021-08-09 001556

Formula used to implement spherical harmonics

Capture d’écran 2021-08-09 001723

Implementation of the spherical harmonics

Capture d’écran 2021-08-09 001609
kitine commented 3 years ago

Verification of the implementation of the spherical harmonics :

Capture d’écran 2021-08-09 005657 Capture d’écran 2021-08-09 005736
kitine commented 3 years ago

Speed test

For the computation of spherical harmonics with l=10, m=[-10;10] Using the recurrence formula : 0.004826784133911133 s Using python's function : 0.16061711311340332 s

For the computation of the total field Using the recurrence formula : 20.19532084465027 s Using python's function : 25.091874837875366 s