capytaine.tools.prony_decomposition module

Prony decomposition: tool to approximate a function as a sum of exponentials. Used in particular in the finite depth Green function.

capytaine.tools.prony_decomposition.error_exponential_decomposition(X, F, a, lamda)[source]

Compare exponential decomposition defined by the coefficients a and lamda to the reference values in F.

Parameters:
  • X (1D array) – sampling points

  • F (1D array (same size as X)) – reference values

  • a (1D array) – coefficients of the exponentials

  • lamda (1D array (same size as a)) – growth rate of the exponentials

Returns:

error – mean square error of the decomposition

Return type:

float

capytaine.tools.prony_decomposition.exponential_decomposition(X, F, m)[source]

Use Prony’s method to approximate the sampled real function F=f(X) as a sum of m exponential functions x → Σ a_i exp(lamda_i x).

Parameters:
  • X (1D array) – sampling points.

  • F (1D array (same size as X)) – values of the function to approximate at the points of x.

  • m (integer) – number of exponential functions

Returns:

  • a (1D array (size m)) – coefficients of the exponentials

  • lamda (1D array (size m)) – growth rate of the exponentials