{'fraction_non_alphanumeric': 0.03236788068734465, 'fraction_numerical': 0.010050794336971793, 'mean_word_length': 4.209429978888107, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Decay Rate Distributions of Disordered Slabs and Application to Random Lasers

We compute the distribution of the decay rates (also referred to as residues) of the eigenstates of a disordered slab from a numerical model. From the results of the numerical simulations, we are able to find simple analytical formulae that describe those results well. This is possible for samples both in the diffusive and in the localised regime. As example of a possible application, we investigate the lasing threshold of random lasers.


I. INTRODUCTION
A very successful approach to describe disordered materials is supplied by random-matrix theory, see Refs. 1,2 for reviews. While one can put the beginning of randommatrix theory at Wigner's surmise for describing the scattering spectra of heavy atomic nuclei, 3 its theoretical foundations were laid only much later. 4 It was very successfully applied to electronic transport in disordered wires and mesoscopic quantum dots, and recently these methods have been adopted to model (quantum) transport of optical radiation in media with spatially fluctuating dielectric constant. 5,6,7,8 In the theoretical treatment of disordered materials, two particular geometries are of special importance, namely the disordered slab and the chaotic cavity (see Fig. 1). The principal difference between the geometries is easily explained: A chaotic cavity is an object in which the dynamics is chaotic due to the shape of the cavity or due to scatterers placed at random positions. The size of the opening is small compared to the total surface area of the cavity. Particles (electrons, photons) are then "trapped" inside the structure for a time that is long enough to ergodically explore the entire cavity. In a disordered slab, particles cannot be trapped that efficiently. They can no longer explore the entire volume ergodically but they still stay long enough to explore the entire cross-section of the sample, thus still making a random-matrix description possible. In order to call this geometry a "wire" or a "waveguide" its length should be much larger than its width. To be able to apply the theory only the much weaker criterion that the length is sufficiently larger than the mean-free path of the medium has to be fulfilled.
Two different aspects are of special important in the theory of disordered media, namely transport properties and resonances. The transport properties (moments of the eigenvalues of the transmission and reflection matrices) are known for the disordered slab in the limit that it is wide, 9 for the chaotic cavity with an opening that is so small that only one or two modes can propagate through it, 10,11 or a chaotic cavity with a wide opening. 6 Less is known about the poles of such systems. (The eigenvalues of the Hamiltonian correspond to poles of the scattering matrix, and these show up as resonances in a scattering experiment. Hence the somewhat inconsistent nomenclature.) The beginning of random-matrix theory can be put at the moment when Wigner surmised the eigenvalue distribution for a closed chaotic cavity. 1,3, 12 Here we are interested in open systems, where the eigenvalues acquire an imaginary part. (The imaginary part is referred to as residue.) It determines the decay rate of the (quasi-)eigenstate of the system. For chaotic cavities with broken time-reversal symmetry, the decay rate distribution is known analytically for an opening of arbitrary size. 13 The distribution for the more important case of preserved time-reversal symmetry 35 is not known but can be approximated by a cavity with broken symmetry and an opening of half the real size.
Information on the residues of a disordered slab is very limited, and only the scaling behaviour of the large residue-tail in the localised regime was determined recently. 14,15 This deficiency is felt especially strong in the random-laser community since the location of the residues gives the lasing threshold of an optical system, and most experimental setups resemble a disordered slab much more than they resemble a cavity. This paper fills this gap by presenting the results of numerical simulations. The quality of the numerical decay rate distributions is good enough that it allows us to arrive at analytical formulae for the distribution function, including its dependence on the parameters of the system. The idea to use high-quality simulations to arrive at formulae is not completely new as the distribution of the scattering strengths of chaotic cavities was found in the same way. 6 This paper is organised as follows: First, we introduce the Anderson Hamiltonian used the describe the disordered slab. In Sec. III we show how the eigenvalues of that Hamiltonian can be computed in a efficient numerical way. Depending on the length of the slab, it can be in either the diffusive or in the localised regime. We will analyse the decay rate distributions for both regimes separately, first in Sec. V for the diffusive and then in Sec. VI for the localised regime. Until that point all results are completely general and can be applied to electronic and photonic systems. In Sec. VII we specialise on the lasing threshold in amplifying disordered media. We distinguish between the diffusive and the localised regimes (Secs. VII A and VII B). We conclude in Sec. VIII.

II. ANDERSON HAMILTONIAN FOR A DISORDERED SLAB
We consider a two-dimensional slab of length L and width N . The slab is described by an Anderson-type lattice Hamiltonian with spacing 1. In the Anderson model, transport is modelled by nearest-neighbour hopping between lattice sites. Without loss of generality we can set the hopping rate to 1. With a spatially varying potential P (x, y) the Hamiltonian becomes H (x,y),(x,y−1) = 1 (y > 1) (1f) All other elements are zero. x runs from 1 to N , and y from 1 to L. The real part E of the eigenvalues of H in the limit of large N and L is confined to the interval [−4; 4]. (If the average of P (x, y) is nonzero, the interval is simply shifted by that average. If P (x, y) is fluctuating as a function of x and y -like it does for a disordered medium -the interval becomes a bit wider.) For electronic systems, E gives the energy of the eigenstate, and Eq. (1) hence describes a slab with a conduction band of width 8. For photonic systems, the real part of the eigenvalue gives the eigenfrequency. For both systems, the imaginary part γ of the eigenvalue gives the decay rate of the eigenstate. (Actually not γ but rather γ/2 is the decay rate but for the ease of notation we will continue to refer to γ simply as the decay rate.) κ in Eq. (1b) quantifies the strength of the coupling between the slab and the outside. 13 Using the units introduced above, κ has the value sin 2 k where k is the wavevector at the energy at which particles are injected respectively emitted. This quantity is proportional to the velocity of the particle perpendicular to the interface. In the centre of the band sin k = 1 whereas at the edges sin k = 0.
If κ is chosen to be constant (i. e. not to depend on energy) ideal outcoupling can be described only for one H = FIG. 2: The Hamiltonian H has a band structure. The thin lines contain matrix elements that are mostly 1, the diagonal is filled with complex numbers, and all other elements are zero. The entire matrix is symmetric but non-Hermitian (since there are complex elements on the diagonal). specific value of the energy. We will do this since otherwise solving the Hamiltonian no longer is a standard eigenvalue problem, and set κ ≡ 1, hence modelling ideal coupling at the centre of the band. 36 Working at the centre of the conduction bands offers the advantage that the width N of the sample is identical to the number N of propagating modes, and thus allows the describe the largest number of propagating modes for given size of the Hamiltonian (i. e. given numerical work). It is possible to include energy dependent coupling terms 16 but it should be stressed that a constant κ is more efficient and gives completely correct results as long as only eigenvalues near the respective energy are considered. We set κ = 1, meaning ideal coupling at the centre of the conduction band.
It should be stressed that -even though we are modelling a two-dimensional system -the results are valid for three-dimensional systems as long as L > ∼ N . A particle that is injected into the slab ergodically explores the entire cross-section of the sample before being emitted again, and hence loose its memory of which sites are "connected" by hopping terms. The sites can then be re-arranged, e. g. in a three-dimensional structure. Only for very short samples, L < ∼ N , this is not possible but for such samples already applying the Anderson model (i.e. only allowing nearest-neighbour hopping) is very questionable. The only "real" restriction that can limit the application of our results to certain photonic threedimensional systems is that particles can leave the sample only at the front and at the back -and not through the "sides".
In the formulation of Eq. (1) the matrix H has double indices but these are easily removed by considering H nn ′ with n = x + (y − 1)N . (It would not make sense to set n = y + (x − 1)L since usually L ≫ N , and we want to work with a band matrix that is as small as possible.) This results is a matrix of the form as depicted in Fig. 2. It is a banded LN × LN matrix with band width 2N + 1. Also within the band most elements are zero (since usually N ≫ 1). The matrix is symmetric but non-Hermitian as there are complex numbers on the diagonal.
The model (1) has been widely used since an efficient way to compute the transmission through such a slab is known. 17 The method of recursive Greens functions allows to compute the entire scattering matrix, hence all linear transport properties, in a time of order O(LN 3 ) and with only minimal storage requirements O(N 2 ). No explicit reference to the Hamiltonian H is made, so that eigenvalues cannot be computed by this method.

III. COMPUTING EIGENVALUES OF SYMMETRIC COMPLEX NON-HERMITIAN BANDED MATRICES
Since the Hamiltonian H from Eq. (1) is both banded and sparse one might be tempted to use an eigensolver for sparse matrices to compute the eigenvalues of Eq. (1). A sparse eigenvalue routine needs to be able to solve the equation for the unknown vector x for arbitrary µ and y. In particular, the eigensolver needs to set µ close to an eigenvalue of H so that the matrix H − µ½ is ill-conditioned. A numerical solution of Eq.
(2) is then difficult and very expensive. Furthermore, only one eigenvalue is found at a time, and control of which eigenvalue the algorithm will converge to is difficult. (Algorithms for sparse matrices always use inverse iteration so that the corresponding eigenvector will be returned without additional effort but the eigenvector is of no use for us.) Using an algorithm for banded matrices is thus the better alternative.
There exist a number of algorithms for real symmetric or complex Hermitian band matrices. Both problems are characterised by real eigenvalues, so that they are conceptually identical. Only one algorithm for computing an eigenvalue (plus the corresponding eigenvector) of a general complex band matrix has been published. 18 It uses inverse iteration, so it is of limited use here.
We thus had to implement our own eigenvalue solver. The eigenrepresentation of H in terms of the diagonal matrix Λ = diag(λ 1 , . . . , λ N ) of the eigenvalues λ i of A and the matrix U of eigenvectors is ( We now observe that for symmetric, that includes complex symmetric, H it is always possible to chose eigenvectors such that U U T = ½. If U would be a real matrix, one would call U orthogonal but since it is complex there is no special name for the property U U T = ½.
Algorithms for diagonalising a real symmetric matrix A implicitly decompose A as with the matrix D of eigenvalues of A. It is therefore possible to adapt such an algorithm for our needs. Most algorithms for banded matrices first reduce A to tridiagonal form A ′ by transformations of the form A ′ = Q ′ AQ ′T , and we will adopt this strategy. (A matrix is called tridiagonal if only the diagonal and its neighbouring elements are nonzero. If A would be real, the transformation A → A ′ would be called a similarity transformation.) For a band matrix this is possible in an efficient way since it is not necessary to compute (and thus store) the full matrices Q ′ , and by annihilating the elements of the matrix A in a clever order, the band structure is kept intact in all steps. 19,20 The reduction of the complex matrix H to tridiagonal shape is done by straight-forward adaptation of this algorithm from real to complex numbers, where care needs to be taken that the dot product x · y = i x i y i is used and not the dot product x · y = i x i y i normally used for complex vectors. (The overbar marks the complex conjugate.) To compute the eigenvalues of the tridiagonal matrix for the real symmetric or complex Hermitian case, methods that isolate eigenvalues in disjunct intervals are used ("divide and conquer" and similar methods 21 ). Such methods work for both of these cases as all eigenvalues are real and can thus be ordered. This no longer is possible here as the eigenvalues are complex. We therefore use the QR respectively QL method. 22 For an K × K banded matrix with band width W the time needed to compute the eigenvalues increases as O(K 2 W ) whereas the storage requirements increase as O(KW ). In terms of the dimensions L and N of the disordered slab, this means that the time increases as O(L 2 N 3 ) and the storage space as O(LN 2 ). For given computational resources, both scalings impose an upper limit on the system size that can feasible be treated. For typical values of the ratio L and N , and for "realistic" computer equipment, the time limit is reached somewhat earlier than the memory limit. 37 With respect to a similar algorithm for full matrices one wins a factor L (usually of order several hundred) for both time and memory by using the banded algorithm, thus allowing to treat system that could not be treated otherwise. Still, the work presented in this paper is a big numerical challenge. To arrive at the results, of the order of 100000 hours of cpu time on fast PC's were needed.

IV. NUMERICAL SIMULATIONS
Disorder is modelled by assigning random values to P (x, y). It is assumed that those random numbers are uniformly distributed in the interval [−w; w] so that w measures the amount of disorder.
We only consider eigenvalues near the centre of the conduction band as the assumption of ideal coupling is only valid there. For numerical reasons it is essential that the centre of the conduction band is at E = 0, i.e. one is not allowed to add an offset to P (x, y). 38 We hence chose a window [−d; d] and only include eigenvalues in the further analyses when their real part is inside that window. If the window is too large, systematic errors are introduced while too small a window leads to bad statistics. As can be seen from Fig. 3, for of d = 0.1 the distribution function already agrees with the distribution function for d = 0.01 but has much better statistics. d = 0.5 and d = 1.0 gives significant systematic deviations. For this reason, all results presented in this paper assume a window with d = 0.1.
The formulation of the model in Sec. II is in terms of generic units. Contact with a microscopic model or an experiment is best made in terms of the mean free path. It can be computed from the length-dependence of the transmission probability T through the sample. In the diffusive regime, l < ∼ L ≪ N l, it is given by 1 The mean free path can be computed by fitting T (L) to this functional form.
The transmission probability has been computed using the method of recursive Green's functions 17 for variable disorder strength w. As Fig. 4 shows, the numerically computed mean free path l is for the range of w in question in very good approximation given by (Computed for each value of w from 50 samples with L = 2, 4, . . . , 98, 100 and N = 50.) In the following, we will no longer make explicit reference to w but rather give the more intuitive mean-free path l.

V. DIFFUSIVE REGIME
For a sample length L with l < ∼ L ≪ N l the sample is said to be in the diffusive regime. It is immediately obvious that the diffusive regime can only be observed in sufficiently wide samples, N ≫ 1.
For chaotic cavities with broken time-reversal symmetry an analytical result for the decay rate distribution has  been given by Fyodorov and Sommers. 13 We start from their result and rescale it, (7) P(y) is normalised to one and in our scaling is for all M > 1 peaked near a value of y of order 1. In the original formulation for a chaotic cavity, M is the number of modes propagating through the opening of the cavity.
In the following we will argue that the decay rate distribution P (g) can be written in the form (7) as with some scaling factor γ 0 and some effective number of modes M = N . In Fig. 5 a comparison between the analytical suggestion and a simulation is given, and the agreement is striking. The horizontal axis has been plotted logarithmically since this results in both the differences between the P (y) for different N becoming easier to recognise and in giving a more prominent place to the small-γ tail of P (γ). In most applications, including the random laser discussed later in this paper, one is much more interested in small γ than in large γ.
The results of the simulations are fitted "by eye" against the functional form (7), resulting in one pair of values for γ 0 and M for each set of parameters. Especially at very small γ, there are sometimes numerical errors that introduce artifacts into the numerical histogram so that using an automatic fitting algorithm is not feasible. (Usually we computed 500-1500 realisations for each parameter set.) From our simulations, we find that the scaling factor γ 0 only depends on the length L of the sample and its mean free path l but not on its width N , and seems to be given by As Fig. 6 shows, the agreement between the result of the numerical simulations and Eq. (9) is good, and all major deviations are for small L where universal scaling is expected to be worse than for larger L. The model equations set the speed of propagation to 1 but it is obvious that for some other choice for the propagation speed c one has to change Eq. (9) to γ 0 = 2cl/L 2 . While the determination of γ 0 is very precise, there is a somewhat larger error involved in determining M by fitting the analytical form to the results of numerical simulations. First, we only fitted against integer M , though in principle a generalisation of Eq. (7) to noninteger M is possible, see Eq. (25). Secondly, if M > ∼ 25, the difference between P (y) for M and for M + 1 becomes too small to tell with certainty which of these two values describes the numerical result better. Thirdly and finally, even with 500-1500 samples for each set of parameter val-  ues, there are still some fluctuations in the numerically computed histogram for the decay rate distribution that in some cases make the decision on the right M a bit difficult. Considering all of this, one should allow for an error of 1 for M , and even of 2 for M > ∼ 25. We have computed M for a series of samples with increasing length for three different widths N . As Fig. 7 shows, the effective number M of modes is well approximated by The agreement between this suggested analytical form and the numerical simulation becomes better as the width N of the sample is increased. From the simulations it is obvious that the functional form Eq. (10) is correct but there still is the (small) possibility that the factor 6 might need to be replaced by a slightly smaller value. To answer this question with certainty, we would need to increase both L and N significantly. Unfortunately, such simulations are outside the present time and memory constraints. Equations (7-10) give a good description of the decay rate distribution of a disordered slab in the diffusive regime, provided the slab is sufficiently wide. Since the transversal length scales are set by microscopic quantities (wave length of the light for optical systems, Fermi wave length for electronic systems), all macroscopic objects are "wide".

VI. LOCALISED REGIME
If the length L of a disorder medium is increased, the phenomenon of localisation sets in once L > ∼ N l (see One should note that this is not identical to fitting the transmission to T (L) ∝ exp(−L/ξ) since the large sample-to-sample fluctuations of T (L) in the localised regime would give a value for ξ that is off by a factor 4. The localisation length can also be computed analytically from the mean-free path using the DPMK equation, with the result 23,24,25,26,27,28 and agrees well with our numerical results. It is generally accepted that the distribution of the decay rates γ (at least for small γ) in the localised regime is log-normal, i. e., ln γ is distributed according to a Gaussian distribution. Recent interest has rather been in the large-γ tail which was shown to follow a power-law. 14,15 In a log-normal distribution, most of the weight lies in the right tail, so those papers give a sufficient description for most of the eigenmodes. In the context of applications to random lasers we are, however, interested in the small decay rate tail, hence in the log-normal distribution.
To our knowledge, there is only a single paper by Titov and Fyodorov that gives explicit expressions for the parameters of that log-normal distribution. 14 However, their analytical results are for a somewhat different system so it is difficult to tell whether they agree or disagree with our findings. We will return to this aspect at the end of this section. First, we want to present the results of our numerical simulations.
Using the log-normal ansatz, the distribution of the decay rates γ is The numerically computed histograms indeed follow this form, see Fig. 8, except for the large-γ tail -as already mentioned above but this deviation is only seen in a loglog plot. Fig. (9) shows in the left the numerically computed γ 0 as a function of L for N = 15. Also displayed is the localisation length ξ computed numerically from the transmission, being in good agreement with the analytical prediction (12). The quality of the data is good enough to say with confidence that γ 0 decays exponentially with a length scale that is somewhat larger than ξ. Fig. (9) shows in the right the value of γ 0 also for two other values of N , and all three cases are well-described by introducing a numerical fitting factor a, It is known that working at the centre of the conduction band when in the localised regime can introduce certain artefacts, especially in analytical approaches. Among other, the localisation length at the band centre can differ by approximately 10 % from the value outside the centre. 29 We have defined ξ based on the transmission through the sample (at an energy corresponding to the band centre), and in transmission resonances at all energies can contribute. A numerical prefactor a that differs by about 10 % from 1 thus does not come as a complete surprise.
We still need to compute the proportionality factor appearing in Eq. (14). For this purpose we need to plot the ratio of the numerically computed γ 0 and the right-hand side of Eq. (14) for different values of N . We did this for L = 71.55 l. Since this is a very expensive operation, we have computed a large number of samples only for N = 10, 15, 20 so that their statistics is better than for the other values of N . An estimate of the error for these "better" data points has been included in the figure. This allows us to conclude that It should be noted that this equation contains two numerical coefficients, and there is no obvious reason why they should be identical. Still, we find that they both are approximately a = 1.12. Re-introducing "physical units" into Eq. (15) is a bit more difficult than it was for Eq. (9) where it was obvious that one simply has to multiply by the velocity of propagation c. Here one has to multiply by c/∆ where ∆ is the perpendicular grid spacing. Due to the assumption of one propagating mode per (lateral) grid point made in Sec. II, ∆ is not arbitrary but has a well-defined physical meaning. For the electronic case, ∆ = π/k F with k F the wave vector at the Fermi level, and for the photonic case ∆ = 2λ/π with λ the wave length of the light (hence c/∆ = 1/(4ν)).
Determining the width σ of the distribution is more difficult since we can only use the left wing of the distribution -the right wing eventually turns into a powerlaw tail and thus no longer follows a log-normal distribution. Once again, we have accumulated more data for N = 10, 15, 20 so that some indication of the error is possible for those three data points.
From our data, we propose the formula where a = 1.12 has the same value as in Eq. (15). As Fig. 10 shows, there clearly is no disagreement between the numerical data and Eq. (16). However, please remember that the 2 3 should be thought of as a fitting factor that might not be exactly 2/3 but perhaps rather 0.67 or some other numerical factor.
Since the distribution is log-normal only for not too large γ (remember the power-law tail for large γ) the normalisation is nontrivial [P (γ) is not normalised to 1 any longer!] and cannot be computed from γ 0 and σ. The constant a in Eq. (13) is directly equal to the height of the peak of the numerically computed P (γ). Since the total area underneath the numerically computed P (y) (and hence its normalisation) is dominated by the large-γ tail, a has a relatively large error. Taking all the available data, the most likely value is This value has been determined from a large number of simulations that for space reasons cannot be presented here. Unfortunately the quality of the data is not good enough to decide whether an additional prefactor a = 1.12 should appear. At the present it is not possible to tell whether our results agree with the ones put forward by Titov and Fyodorov. 14 In particular, they arrive at whereas our finding (15) was γ 0 ∝ exp(−L/1.12ξ). There are two obvious differences between the model used by them and the model employed by us. First, for numerical reasons we work at the centre of the conduction band while they work near (but sufficiently far away from) the band edges. This might explain the factor a = 1.12 that we have to introduce. Secondly and probably more importantly, they consider a system of length L ′ that is closed at one end whereas our systems have length L and are open at both ends. It is obvious that a half-closed system of length L ′ corresponds to an open system of length L > L ′ . Eq. (18) suggests that those two systems could be mapped into each other by setting L ≈ 3L ′ but there is no further evidence to support this claim.

VII. LASING THRESHOLD OF A RANDOM LASER
A random laser is a laser where the necessary feedback is not due to mirrors at the ends of the laser but due to random scattering inside the medium. 6,30,31 We model the random laser as a disordered slab containing a dye that is able to amplify the radiation in a certain frequency interval with rate 1/τ a . The lasing threshold is the amplification rate at which the intensity of the emitted radiation diverges in a linear model. If saturation effects are included, the emitted intensity increases abruptly but finitely at crossing the lasing threshold.
The lasing threshold is given by the value of the smallest decay rate of all eigenmodes in the amplification window. 32 (Remember that γ actually is twice the decay rate. On the other hand, also 1/τ a enters the relevant formulae only with a prefactor 1/2. γ thus indeed gives the necessary amplification rate 1/τ a .) This is easily understood since this simply means that in the mode with the smallest decay rate the photons are created faster by amplification than they can leave the sample (=decay). It, however, also follows from a complete quantum mechanical analysis. 8,33 The distribution of the decay rate has been computed in this paper. A certain number K of modes will be in the frequency window where amplification is possible. The lasing threshold is given by the smallest γ of these K modes. In a simple picture that is valid once K ≫ 1 we can assume that the K different γ's are distributed independently according to P (γ). 32 The distributionP (γ) of the smallest mode and hence of the lasing threshold then becomesP For K = 1, the distributionP (γ) of the lasing threshold is not longer identical to the distribution P (γ) of the decay rate of each individual mode. In particular, not only the precise form of these two distribution will be different, but also the "typical" value of the lasing threshold can be different from the "typical" decay rate γ 0 . Interestingly, for chaotic cavities in the diffusive regime it was found that the latter two quantities differ only insignificantly 33,34 which might seem counter-intuitive. A slab geometry is more "complicated" in that the scaling K ∝ N "tries" to lower the lasing threshold with increasing N .
For K ≫ 1 the distributionP (γ) is sharply peaked around its maximum. The position γ m of the maximum is given by the solution of the equation dP (y m )/dγ m = 0, hence Eq. (20) depends on P (γ) which in turn depends on the dimensions L and N of the system. In assuming that the number of propagating modes is equal to the width N of the sample we already have made the assumption that the width (and hence also the length) is measured in units of λ/2. (The "2" accounts for polarisation.) The total number of modes in the sample thus is LN . We assume that a fraction f of them is inside the amplification window of the dye, hence K = f N L. For simplicity we neglect complications as the shape of the mode profile. (It is easily incorporated into the numerics and we refrain from doing this just to prevent having to introduce even more parameters.) f depends only on the chemical properties of the dye and not on the dimensions of the sample.
In the following we will show how to compute the most likely lasing threshold for samples in both the diffusive and in the localised regime.

A. Lasing threshold in the diffusive regime
The change of the lasing threshold with increasing system size is influenced by a subtle interplay between L and N in determining the distribution P (γ) and in determining the number K = f N L of total modes.
If K ≫ 1 the lasing mode has a decay rate in the low-γ tail of P (γ) (i.e. γ < γ 0 or y < 1). The weight of this tail is and goes to zero as M becomes larger. For M → ∞ the tail disappears completely, as is already obvious from the asymptotic form of the distribution, P M→∞ (y) = 0 (y < 1) 1/y 2 (y ≥ 1) (22) With increasing N and hence increasing M , the probability that a given mode has a small y thus decreases rapidly. On the other hand, we are interested in the smallest decay rate out of K modes, and K increases linearly with N . This are two counter-acting effects, and it is not obvious which of these two is stronger. The effect of an increase of the system size L, on the contrary, is obvious. First, the average decay rate γ 0 decreases according to Eq. (9). Secondly, M decreases from Eq. (10), leading to even smaller values for γ of the lasing mode.
There have been some analytical attempts to compute the lasing threshold for a chaotic cavity 33,34 . For large M , the small-y tail of Eq. (7) was approximated by This allows to arrive at scaling laws of the lasing threshold for variable M at fixed K. Unfortunately, the difference between two counter-acting effects of an increase in N are so small that Eq. (23) is a bit too crude for our needs.
We thus have to revert to a numerical procedure. Eq. (7) can be rewritten using the incomplete Gamma function Γ(a, 0) reduces to the well-known Gamma function Γ(a). For numerical reasons it is advisable to introduce the regularised Gamma function Q(a, x) = Γ(a, x)/Γ(a). Fast numerical algorithms to compute Q(a, x) exist. [Please note that in the literature the definitions of the regularised Gamma function sometimes disagree in that our Q(a, x) is denoted as 1 − Q(a, x).] Now we can express Eq. (7) and its derivative and integral as so that Eq. (20) can be evaluated efficiently.
B. Lasing threshold in the localised regime From Eq. (13) we directly arrive at A further simplification is not possible, and we did not manage to find suitable approximations. Also for the localised regime we thus are restricted to a numerical evaluation.

C. Numerical results
The lasing threshold is computed numerically from Eq. (20), using the formulae from Secs. VII A and VII B. Into the formulae presented there, we have to insert the correct dependence of the γ 0 , M , σ, etc. on L and N that was presented earlier in this paper. Despite this complication the numerical calculation is straight forward as Eq. (20) possesses a single root only. Since this root has a change of sign, it is easily found numerically. Fig. 11 shows the results for both the diffusive and the localised regimes, for both f = 0.1 l and f = 0.001 l.
(The mean-free path appears as a factor since the figure is in units L/l and not L.) The formulae found in this paper are valid deep in the diffusive regime respectively deep in the localised regime. Near the cross over, hence near the line L ≈ N l, this condition is not fulfilled. The numerical values near the diagonal line in Fig. 11 should thus be viewed with caution.
As can be seen from the figure, in the diffusive regime with N ≫ L/l the lasing threshold becomes almost independent of the width N of the sample (for sufficiently large N ), and the most likely value of the lasing threshold is about hence the value given by Eq. (9). This means that even though K ≫ 1, P (y) for y < 1 is already so small that it dominates over the large value of K. Differences between this simple approximation and the precise numerical result appear for finite N , with the size of this difference depending on f . However, for designing experiments it is obvious from the results presented here that the only feasible way to lower the lasing threshold of a random laser in the diffusive regime is increasing its length, not modifying its width. As Fig. 11 shows, also in the localised regime there is only a small dependence on f . This means that in a lognormal distribution the weight of the left tail is so small that unless K is exponentially large γ m cannot become much smaller than the position γ 0 of the peak of the distribution. The difference to the diffusive regime is that the lasing threshold can be lowered efficiently not only by increasing the length but also decreasing the width N and hence driving the system farther into localisation.
It is no surprise that samples in the localised regime generally have a lower lasing threshold than samples in the diffusive regime. We have shown that also the diffusive samples can have an "acceptably small" lasing threshold as it is trivial to make them very long (since there is no need to care much about their width). For both the diffusive and the localised regime, the typical decay rates of a single mode are comparable to the lasing threshold.

VIII. CONCLUSIONS
We have numerically computed the distributions of the residues (or decay rates) of a disordered slab. The slab has length L, mean free path l, width respectively crosssectional area N (N is given as number of propagating channels) and velocity of propagation c. We were able to "guess" simple analytical formulae that are able to describe the numerical results well.
For a sample in the diffusive regime (L < ∼ N l) we found in Eqs. (7-10) where Γ(a, x) is the incomplete Gamma function. The agreement between the numerical results and the proposed formulae is good, and there is the possibility that Eq. (28) might become exact in the limit L/l ≫ N ≫ 1. However, there is only numerical and no analytical evidence to back this claim. For a sample in the localised regime (L > ∼ N l) with localisation length ξ = (N + 1)l/2 we found in Sec. VI The quality of the simulations results in the localised regime is somewhat less than in the diffusive regime. For this reason, Eq. (29) should be understood as an approximate fit only, and it very probably differs from the exact relation, especially outside the band centre. These results can be applied to both electronic and photonic systems. For photonic systems we have shown that under realistic assumptions the lasing threshold of a random laser is close to γ 0 both in the diffusive and in the localised regime. Eqs. (28) and (29) thus not only give the distribution of the decay rate of each individual mode but also a good estimate of the lasing threshold, i. e. the smallest decay rate of a large number of modes.