freealg.AlgebraicForm.density#
- AlgebraicForm.density(x=None, eta=0.0002, ac_only=False, plot=False, latex=False, save=False)#
Evaluate spectral density of the fitted spectral curve.
- Parameters:
- xnumpy.array, default=None
Positions where density to be evaluated at. If None, an interval slightly larger than the support interval will be used.
- etafloat, default=2e-4
A small number to be used for approximating the local behavior of atom with a mollifier of scale
eta.- ac_onlybool, default=True
If True, it returns the absolutely-continuous part of density.
- plotbool, default=False
If True, density is plotted.
- latexbool, default=False
If True, the plot is rendered using LaTeX. This option is relevant only if
plot=True.- savebool, default=False
If not False, the plot is saved. If a string is given, it is assumed to the save filename (with the file extension). This option is relevant only if
plot=True.
- Returns:
- rhonumpy.array
Density at locations x.
Notes
In the density plot (assuming plot=True), the solid curve shows the absolutely-continuous part of the spectral density. If the density has atom(s), they are shown as an arrow, where the hight of the arrow is proportional to its mass, and can be read from the right ordinate of the plot.
Examples
>>> # Create a distribution with two bulks >>> from freealg.distributions import CompoundFreePoisson >>> cfp = CompoundFreePoisson(t=[2.0, 5.5], w=[0.75, 0.25], ... lam=0.1) >>> # Create AlgebraicForm and fit the distribution >>> from freealg import AlgebraicForm >>> af = AlgebraicForm(cfp) >>> af.fit(deg_m=3, deg_z=1) >>> # Plot the density of the fitted spectral curve >>> import numpy >>> x = numpy.linspace(0, 8, 1000) >>> rho = af.density(x, plot=True)