An app to compute the coefficients of a function development in a spherical harmonics convergent series
This program computes the coefficients of a function development in a spherical harmonics convergent series, by using a standard mathematical algorithm.
When running the program, you have simply to input the generic shape of the equation and the values of m and l and the coefficients will be calculated.
Some program features:
- Can calculate coefficients for any generic function, entered by the user during the program running.
- coefficients are expressed as complex numbers.
- It works well for each negative or positive value of m, with very good accuracy until m < 5. For higher m values, the accuracy gradually decrease.
NOTE: equations are displayed in green color in order to be correctly visualized in both normal and dark mode.
Output example (terminal graphics has been produced using osmanip
):
NOTE: inserted functions are plotted only in the case in which they are 1D (i.e. only one of the two angles is present in their expression) since the
osmanip
library at the moment doesn't feature 2D plotting.
The software is and will stay free, but if you want to support me with a donation it would be really appreciated!
If you want to use this software please cite it following this citation template file.
- Linux
- Ubuntu (tested)
- MacOS
Steps to be reproduced:
1) Download one of the releases of the repository or clone the main branch.
2) Unzip and enter the downloaded repository directory.
3) Install all the prerequisites:
./script/install_dependencies.sh
Prerequisites list:
- A
g++
compiler. - C++17 standard.
exprtk
library.osmanip
library.arsenalgear
library.
Optional (only for developers)
- Valgrind and Cppcheck.
- Clang formatter.
- A terminal supporting ANSI escape sequences.
4) Compile:
make main
NOTE: to compile test code run
make tests
.
5) Run the main program:
./bin/main
NOTE: to run test code run
./bin/tests
.
Extra documentation is available in the doc folder:
- Algorithm explanation and physical background: contains information about the mathematical and physical explanation related to the coefficients computation and a detailed description of the used algorithm.
- Contributing: contains information about how to contribute to this project.
- Extra scripts: contains extra documentation about the other scripts.
Code documentation is generated using Doxygen and can be accessed here.
When running the program, some options are displayed:
Available options:
1. Display the single value of a f(m,l) coefficient.
2. Display all the values of f(m,l) coefficients from m to 0 and from l to 0.
3. Quit the program.
Option choice:
The first one is used to compute a single value of the coefficient for a certain m and l.
The second one is used, instead, to compute all the values of from m to 0 and from l to 0.
Third option explanation is trivial.
When one of the options has been chosen, an output like this will be displayed:
Option choice: 1
Enter the f(th,phi) equation shape (avoid backspaces):
You can enter the function shape and the values of m and l. For example:
Enter the f(th,phi) equation shape (avoid backspaces): 3*cos(th)+pow(sin(phi),5)
Enter the value of m: 2
Enter the value of l: 3
and the final result is displayed with both real and imaginary parts:
f(2,3) = 0.0546019 + -0.00160564i
Gianluca Bianco |
Adam_T |
patlefort |
myermo |