# fit_with_sum_of_exp¶

tenpy.tools.fit.fit_with_sum_of_exp(f, n, N=50)[source]

Approximate a decaying function f with a sum of exponentials.

MPOs can naturally represent long-range interactions with an exponential decay. A common technique for other (e.g. powerlaw) long-range interactions is to approximate them by sums of exponentials and to include them into the MPOs. This funciton allows to do that.

The algorithm/implementation follows the appendix of [murg2010].

Parameters
• f (function) – Decaying function to be approximated. Needs to accept a 1D numpy array x

• n (int) – Number of exponentials to be used.

• N (int) – Number of points at which to evaluate/fit f; we evaluate and fit f at the points x = np.arange(1, N+1).

Returns

lambdas, prefactors – Such that $$f(k) \approx \sum_i x_i \lambda_i^k$$ for (integer) 1 <= k <= N. The function sum_of_exp() evaluates this for given x.

Return type

1D arrays