Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

JustWhit3/SAFD-algorithm

Repository files navigation

An app to compute the coefficients of a function development in a spherical harmonics convergent series

v1.1 license C++17
code size repo size total lines
codeq doc

Table of contents

Introduction

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!

Buy Me A Coffee

If you want to use this software please cite it following this citation template file.

Supported operating systems

  • Linux
    • Ubuntu (tested)
  • MacOS

Install an run

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:

Optional (only for developers)

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

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.

How to use

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

Credits

Project leaders


Gianluca Bianco

Other contributors


Adam_T

patlefort

myermo

Other contributors with no GitHub account

About

An app to compute the coefficients of a function development in a spherical harmonics convergent series.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published