WorksPhysics and Astronomy
Verifying the High-Energy Tail in Bi-Kappa Particle Loading: Three-Dimensional Tests, Velocity Bounds, and Finite Precision
Abstract
The bi-Kappa distribution models anisotropic space-plasma populations with suprathermal power-law tails. Kinetic simulations represent such a population by computational particles, and a loader draws their velocities from the requested bi-Kappa distribution, which we call the target distribution. When is close to 1/2, floating-point underflow can remove the largest draws, and a velocity bound changes the loaded distribution. Published Kappa loaders are usually verified by comparing histograms of the speed or of one velocity component with the analytic distribution. Such comparisons do not examine the direction of the velocity or whether the direction is independent of the speed. We build an anisotropic loader on an established Gamma-ratio construction and examine each of these problems. Near , evaluating the Gamma ratio on a logarithmic scale avoids the loss of draws to underflow in single and double precision down to . When draws outside a bound on each velocity component are discarded and redrawn, a small rejected fraction can accompany a large change in the tail. At and , a bound at 20 times each component's thermal speed rejects a fraction of the draws and lowers the 99.9th-percentile speed by 11%. We test the loaded velocities through their direction and their normalized radius, the length of the velocity after each component is divided by times its thermal speed. The tests used nine values of from 0.51 to 10, including , where the second moments do not exist, with in double precision. At every , tests find the normalized radius out to its 99.999th percentile, the direction, and their joint distribution consistent with the target distribution.
Introduction
Collisionless and weakly collisional space plasmas often depart from Maxwellian velocity distributions. Many contain suprathermal power-law tails that influence particle energy, wave growth, instability thresholds, and transport [1]. Kappa distributions are widely used to model these tails [2, 3]. Their spectral index controls the tail weight. Smaller values give heavier tails, and the Maxwellian limit is recovered as .
Observed velocity distributions can also be anisotropic relative to the local magnetic field. Solar-wind measurements show different parallel and perpendicular widths together with suprathermal tails [4, 5, 6]. The bi-Kappa distribution considered here combines a Kappa tail with separate parallel and perpendicular thermal speeds [7, 8, 9]. It is rotationally symmetric about the magnetic-field direction.
Kinetic simulations approximate a bi-Kappa population with a finite set of computational particles [10, 11, 12]. We use loader for the code that draws velocity samples, applies the physical scales, enforces any requested velocity bound, and rotates the samples into simulation coordinates. We call the bi-Kappa distribution that a user requests the target distribution. If the loaded velocities do not follow the target distribution, the simulation starts from a different distribution than the one intended. An incorrect load can raise the field fluctuations above their expected level [13], and a Kappa load with the wrong velocity-space shape can drive instabilities in a plasma that should be stable [14].
Drawing velocities from a Kappa distribution is harder than drawing them from a Maxwellian, whose components are independent normal variates. The Kappa cumulative distribution function has no elementary inverse, so the inverse-transform method needs a numerical inverse or an approximation. The algebraic tail is heavy, so a rejection sampler needs a proposal density with a tail at least as heavy, and its acceptance rate depends on how closely this proposal fits the target. Several established approaches solve these problems. They include a polar transformation of two uniform variates for one velocity component [15], numerical inverse transforms [16, 17], dedicated rejection samplers [18], and scale mixtures [14, 19, 20]. A scale mixture combines a normal vector with an independent random scale derived from a Gamma variate, so it needs only standard normal and Gamma generators. The Gamma-ratio construction used here belongs to this class and is mathematically equivalent to published constructions [14, 19, 20, 21].
Published Kappa loaders are verified by comparing histograms of the speed, the energy, or one velocity component ity component with the analytic distribution [15, 17, 18, 19, 21], in some cases together with two-dimensional maps of the density [16, 21] or three-dimensional surfaces of constant density [22]. Recent work adds a binned Kullback–Leibler divergence that decreases with sample size [17, 21]. These comparisons are made mostly at . To our knowledge, none of these studies tests the direction of the velocity or whether the direction is independent of the speed, and none applies a hypothesis test.
Building on the Gamma-ratio construction, we ask whether the complete loader, including its anisotropic scaling, its rotation, and any velocity bound, returns the target distribution in finite-precision arithmetic, and, with a bound, the target distribution conditioned on the allowed region. Three effects can change the loaded tail or escape the usual checks.
First, finite precision can alter the high-energy tail. The construction draws the normalized radius , the length of the velocity after each component is divided by times its thermal speed, as a ratio of two Gamma variates. The variate in the denominator has shape parameter . As approaches $1/2$, this variate can underflow to zero in floating point [23, 24], which makes infinite even when the final velocity components would fit in the floating-point format. Zenitani and Nakano [19], whose parameterization by temperature restricts their method to $\kappa > 3/2 ({xref}Sec. II B), avoid a zero denominator by regenerating the Gamma variate, by using a Gamma generator that never returns zero, or by adding an offset of the order of the machine epsilon. Zenitani et al. {citep}[21]` note that for the shape parameter of the denominator variate is at most one, so that a division by zero can occur, and recommend a piecewise rejection method in that range. Near the zeros come from the largest radii, so discarding, redrawing, or offsetting these samples biases the high-energy tail.
Second, a simulation may require bounded particle velocities, for example to exclude superluminal speeds at low [25] or to respect a timestep limit [26]. The bound studied here, which we call a cap, is a hard limit on each velocity component in field-aligned coordinates, whose axes are the magnetic-field direction and two directions perpendicular to it. Any draw outside the cap is discarded and redrawn. The retained draws then follow the capped distribution, which is the target distribution renormalized over the allowed region. The expected rejected fraction equals the probability mass that the cap removes. Section V B shows how much the high-speed tail can change when this fraction is small.
Third, the three-dimensional distribution is not determined by the distributions of the components or of the speed. Drawing the three components independently from their one-dimensional distributions reproduces each component but not the Kappa distribution [14], and a dependence between the speed and the direction can leave the speed distribution unchanged. A test that detects such errors examines the direction and its independence from the speed. At small it also has to reach far into the tail. For the second moments do not exist [1, 27], so only statistics that need no moments are available there.
After the background and related work of Sec. II, the paper has four parts, followed by the scope and limitations of the study (Sec. VII) and a summary.
Probabilistic construction (Sec. III): the radius, the uniform direction, the anisotropic scaling, and the rotation into simulation coordinates that together specify one uncapped draw.
Finite-precision behavior (Sec. IV): the loss of draws near in single and double precision, and a calculation that keeps the radius on a logarithmic scale.
Finite velocity bounds and the loaded distribution (§ 1.4): the distribution of the retained draws, the decay of the rejected fraction with the width of the bound, and the change of a tail percentile.
Validation (Sec. VI): tests of the distribution of , of the direction and its independence from , and of invariance under changes of the thermal speeds and the field direction.
Background and related work
The Kappa and bi-Kappa distributions
We write probability density functions as , with subscripts naming the random variable. Random variables are capitals () and their realizations lowercase ().
The isotropic Kappa distribution in three velocity dimensions is
and its anisotropic generalization is the bi-Kappa distribution. We write it in field-aligned coordinates, in which a velocity has two Cartesian components perpendicular to the magnetic-field direction and one along it, with :
Equation (1) is the special case of Eq. (2). Both are normalized to unity, , for every ; in the denominator requires this lower bound. Abdul and Mace identified the isotropic Kappa distribution with a multivariate Student- distribution [14, 15]. In the same way, Eq. (2) is a centered trivariate Student- distribution with degrees of freedom and scale matrix , and the condition is the condition . As , Eq. (2) converges to the bi-Maxwellian
Normalizability does not imply that all moments exist. The moment of order converges only for [1, 27], that is, for . The second moments therefore exist only for , where
diverging as . For , variance-based verification is unavailable because there is no finite population value to compare with a sample variance, and a population loaded in this range has no finite kinetic temperature in the usual sense. In a nonrelativistic model the algebraic tail also extends to superluminal speeds, and for the superluminal part of the distribution can contribute appreciably to the pressure [25], which is one reason a loader may bound the velocities (§ 1.4).
Parameters, conventions and units
Table I lists the main symbols with their physical meanings, domain, and units. One convention needs stating explicitly because the Kappa literature is not uniform. The parameters and are thermal speeds, not temperatures, and have units of velocity. A common alternative convention writes , which ties to a kinetic temperature but is defined only for [15, 19]. With thermal speeds as parameters, the density of Eq. (2) is normalizable and the Gamma-ratio construction applies for all $\kappa>1/2 ({xref}Sec. III C), as in {citet}Ref. [21]. Scherer et al. {citep}[28]` compare the conventions and give the moments of the Kappa variants in a common parameterization.
Three related distributions
Three related distributions appear in this paper and in the literature it draws on.
The bi-Kappa distribution, Eq. (2), has unbounded support. This is the target distribution throughout.
| Symbol | Meaning | Domain | Units |
| spectral index | — | ||
| perpendicular thermal speed | |||
| parallel thermal speed | |||
| magnetic-field direction | — | ||
| velocity, field-aligned coordinates | |||
| components perpendicular to | |||
| component along | |||
| perpendicular speed | |||
| velocity, simulation coordinates | |||
| normalized velocity, Eq. (7) | — | ||
| normalized radius | — | ||
| squared normalized radius | — | ||
| component-wise cap, Eq. (19) | — | ||
| sample size | — |
Table 1. Symbols, physical meanings, domains, and units. denotes units of velocity. The distribution is normalized to unit probability; a physical number density enters as a multiplicative factor and does not affect sampling.
The capped bi-Kappa distribution, Eq. (20) below, is Eq. (2) conditioned on a component-wise box of half-width thermal speeds, and § 1.4 characterizes it. Its bounded support makes all its moments finite.
The regularized Kappa distribution of Scherer, Fichtner and Lazar [29] multiplies the Kappa density by a smooth exponential cutoff, which makes all moments finite for while keeping the density continuous; its anisotropic form has a cutoff in each direction [30]. Unlike the hard cap of § 1.4, the cutoff is a parameter of the physical model, alongside and the thermal speed, and the standard Kappa distribution is recovered as the cutoff parameter tends to zero [29].
Methods for generating Kappa variates
Published approaches include the following three classes.
Inverse transform. Sampling with requires the quantile function. For the radial variate used here the cumulative distribution function is available in closed form as a regularized incomplete beta function (Sec. III C), but its inverse has no elementary expression, so the method needs a numerical special-function inverse or an approximation. An et al. [16] make this practical in one and two dimensions with Chebyshev interpolation, and Zenitani and Umeda [17] use a -exponential approximation to the Kappa cumulative distribution function.
Acceptance–rejection. The method draws candidates from a proposal density whose scaled version, the envelope, bounds the target, and accepts each candidate with probability equal to the ratio of the target density to the envelope [23]. Tighter envelopes give higher acceptance rates. In a comparison with their polar transformation, Abdul and Mace [15] measured acceptance with a rectangular envelope, while Zenitani [18] reaches – with a Pareto envelope on the same target, quoted for . Zenitani et al. [21] note that acceptance–rejection becomes less efficient in three dimensions when the envelope is poorly matched.
Scale mixtures. A Kappa variate can be written as a normal vector divided by an independent Gamma-type variate, which is the multivariate Student- representation. Abdul and Mace [14] use a normal-over- mixture with the deviate shared across components. Zenitani and Nakano [19] write it as a ratio of Gamma variates. In a later paper [20], they draw a Kappa loss-cone distribution in the same way. Without the loss cone, this distribution is the bi-Kappa distribution, with separate perpendicular and parallel thermal speeds. Zenitani et al. [21] generalize it to the family, a two-parameter family of non-Maxwellian distributions that contains the Kappa distribution as , , and give an explicit anisotropic loader. We use the Gamma-ratio scale mixture for the uncapped loader. In exact arithmetic it returns the target distribution for every (Sec. III), with no parameter that has to be chosen for each , and it is the generator used in particle simulations by Refs. [14, 19, 20, 21]. Each pass through the construction returns one draw, although the Gamma generators it calls may use rejection internally; only the cap of § 1.4 discards draws. The construction gives the radius as an explicit ratio of two Gamma variates, and near the variate in the denominator can underflow to zero; Sec. IV examines this case. The capped distribution of § 1.4 and the tests of Sec. VI do not depend on how the uncapped draws are generated.
Relation to the isotropic problem
Anisotropy does not change the radial sampling problem. As Sec. III B shows, an affine rescaling maps Eq. (2) onto the same dimensionless isotropic core as Eq. (1). The radial distribution is therefore identical in the two cases and depends only on . Anisotropy adds separate perpendicular and parallel scales, and a test has to check each of them. It also adds a rotation from field-aligned into simulation coordinates (Sec. III E). A velocity-space bound is no longer spherically symmetric, so its shape depends on whether it is defined in field-aligned or in simulation coordinates (§ 1.4).
Probabilistic construction
This section derives one draw from the uncapped target distribution, Eq. (2): the anisotropic rescaling, the radial distribution, the direction, and the rotation into simulation coordinates. § 1.4 treats the capped distribution.
Gamma and Beta-prime variates
We write for a unit-scale Gamma variate with shape . If and are independent, their ratio
follows the Beta-prime distribution , with density [23]
where .
Isotropization
In field-aligned coordinates, write the anisotropic rescaling in matrix form as with
so that componentwise , , . Substituting into Eq. (2) reduces the anisotropic quadratic form to an isotropic one:
By the change-of-variables rule for densities, the linear map gives , with
The factor from Eq. (9) cancels the corresponding factors in the prefactor of Eq. (2), giving
which depends on only through and is therefore spherically symmetric. The parameters and do not appear in Eq. (10); their effect is included in the definition of .
For , constant-density surfaces are ellipsoids in physical velocity space, with semi-axes proportional to , , and . Equation (7) divides each coordinate by its scale and maps these ellipsoids to spheres in normalized -space.
The radial distribution
Because Eq. (10) is spherically symmetric, the direction of is uniform on the unit sphere and independent of its length. Let . Passing to spherical coordinates with polar angle contributes the Jacobian , and integrating over the solid angle gives a factor , so the change-of-variables rule yields
For the same rule applies with the scalar Jacobian , so
using . Comparing Eq. (12) with Eq. (6) identifies
so by Eq. (5) the radius can be generated from two Gamma variates, and , as . The requirement for the second shape parameter is the same that makes Eq. (2) normalizable.
Equations (13) and (5) give the construction used by Zenitani and Nakano [19] and the equivalent scale mixture of Abdul and Mace [14]. Without the loss cone, the Kappa loss-cone loader of Ref. [20] combines an equivalent scale mixture with the anisotropic rescaling of Sec. III B. The construction is the , case of the generalized construction in Ref. [21], including its anisotropic rescaling.
The cumulative distribution function of is
with the regularized incomplete beta function.
The direction
A direction uniform on is obtained by drawing and and setting
with components ordered as , so that is the angle between and the field direction. The solid-angle element is . Thus , rather than , must be uniform. A uniform draw of on places too many points near the poles and does not produce the target distribution. The same uniform distribution can be drawn without trigonometric functions by the method of Marsaglia [31], which our implementation uses.
Rotation into simulation coordinates
The steps above give the velocity , with components in field-aligned coordinates. A simulation needs the velocity in its own Cartesian coordinates , in which the field direction generally varies across the domain. We write the velocity in simulation coordinates as .
The rotation requires two unit vectors and that complete to a right-handed orthonormal basis. Start with , let index the largest-magnitude component of , and replace by , so that . Because , this is well conditioned for every field direction. With and ,
For simplicity, our implementation uses for the field direction , so that the two coordinate systems coincide.
Because , the normalized velocity recovered from the returned velocity, , equals , and its length equals the radius of Sec. III C. Which perpendicular direction becomes does not affect the uncapped distribution, because that distribution is rotationally symmetric about . It does set the orientation, in the plane perpendicular to the field, of the component-wise velocity bound of § 1.4. Because and change abruptly when the largest-magnitude component of changes, and between and nearby directions, a bounded load has its allowed box rotated about the field between neighboring field directions.
Algorithm
Collecting Secs. IIIB–IIIE gives the procedure of Fig. 1. In exact arithmetic, Figure 1 returns a velocity whose field-aligned components follow the uncapped density of Eq. (2). We call one pass through lines 1–4 an attempt. Without a cap, each attempt returns one draw. With a cap, an attempt whose velocity lies outside the allowed region is discarded, so the number of attempts can exceed the number of returned draws. Section IV measures the effects of floating-point arithmetic.

Figure 1. One uncapped bi-Kappa draw for and . Lines 1–2 draw the radius (Sec. III C) and line 3 the direction (Sec. III D). Line 4 applies the anisotropic scaling of Eq. (7) and the rotation of Eq. (16). Our implementation evaluates lines 1–2 on a logarithmic scale (Sec. IV). With a finite bound (Sec. V), a draw is kept only if ; otherwise the procedure returns to line 1.
Finite-precision behavior
The radial sampler divides by the Gamma variate . As , the shape parameter approaches zero, and direct floating-point generation of can underflow before the final velocity is formed. The calculation then fails even when every final velocity component would fit in the output floating-point format. Low also gives the target distribution a heavier high-energy tail, so some final velocity components are too large to store at all. Both outcomes occur at large radii, so discarding or redrawing the failed attempts depletes the high-energy tail, which matters in many space plasma applications [3] and can alter wave growth in kinetic plasma models [32]. Unlike an intentional bound (Sec. V), such a failure is not specified in advance, and because it depends on the radius, the retained draws no longer follow the target distribution. We separate the two outcomes and test whether a calculation that keeps the radius on a logarithmic scale removes the first, which is avoidable.
Generating Gamma variates with a small shape parameter is numerically difficult. The standard way to extend a Gamma generator to shapes below one uses the distributional identity , which expresses a Gamma variate of small shape through one of shape , with and [23]. Marsaglia and Tsang extend their generator to small shapes in this way [33], and the default Gamma generator of MATLAB is based on theirs [24]. Generating the variate on a logarithmic scale avoids its underflow [24]. We compare two calculations of the radius that use this identity. The direct calculation forms as a floating-point product and then evaluates
For small the product can round to zero, and is then non-finite before the final velocity components are formed.
The stabilized calculation keeps the logarithmic scale from the Gamma variate to the final velocity components. It never forms . From the same and it evaluates and then
It forms the final velocity components from , where is the scaled and rotated direction of Figure 1. When is representable, each component is . If itself exceeds the largest representable number, each component is instead evaluated as . In exact arithmetic this gives the same radius as Eq. (17).
We tested both calculations in double and single precision at thirteen values, , with , the field along , and no velocity bound. The values 1.49 and 1.5 lie on either side of , where the shape of the denominator variate crosses one, the lower limit of generators such as that of Marsaglia and Tsang [33]. In each attempt the two calculations received the same random variates, so their outcomes can be compared attempt by attempt. Each setting used attempts. Non-finite outputs occurred only for , so Figure 2 shows this range.
Figure 2. Fraction of attempts that returned a non-finite velocity in (a) double and (b) single precision, plotted against , for and the field along . Each marker is measured from attempts without a velocity bound. Settings with no non-finite output cannot be plotted on the logarithmic axis; for them the fraction lies below the dotted line, the one-sided 95% upper bound for zero events in attempts. The grey region is the fraction of draws with a velocity component larger than the largest number the floating-point format can store, which no calculation can return. The dashed line is the probability that the product of the direct calculation rounds to zero, and the direct calculation loses exactly these draws. The losses of the stabilized calculation follow the upper edge of the grey region. The gap between the dashed line and the grey region is the avoidable loss, the draws whose velocity fits the format but whose product rounds to zero.
Figure 2 compares the measured losses with two probabilities, each computed in closed form. The grey region is the probability that the exact velocity has a component larger than the largest number of the floating-point format. It follows from the radial distribution, Eq. (11), and the uniform direction, and we call it the unavoidable loss, because no calculation that returns values in this format can return these draws. The dashed curve is the probability that the floating-point product of the direct calculation rounds to zero.
The dashed curve is the whole loss of the direct calculation. A zero product makes infinite, while a nonzero product keeps below about and every component finite. The direct calculation therefore loses a draw exactly when the product rounds to zero. Its measured losses differ from the dashed curve by less than 0.7% of its value at every with a nonzero loss. The draws of the unavoidable loss are among them. Because is of order one, Eq. (17) gives . A draw with a component too large for double precision has , so its is about , far below the smallest positive number, . The dashed curve therefore lies above the grey region.
In both precisions, the measured losses of the stabilized calculation lie on the upper edge of the grey region at every with a nonzero loss. The stabilized calculation therefore loses only the unavoidable draws. The gap between the dashed curve and the grey region is the avoidable loss. It consists of draws whose exact velocity fits the format but whose product rounds to zero, with radii between about and in double precision. In double precision at , for example, the direct calculation lost of attempts and the stabilized calculation . Both losses are larger in single precision, because its range is narrower. Its largest number is and its smallest positive number , against and in double precision. Close to the loss that remains is set by the format. At , 87% of attempts in double precision and 98% in single precision have a component too large for the format, so few draws can be returned there by any calculation. Any practical cap lies far below the largest number of the format. A capped loader therefore discards and redraws such a draw like any other draw outside the allowed region, and these losses do not change the capped distribution (§ 1.4). Section VI tests the distribution of the stabilized output in double precision for .
Finite velocity bounds and the loaded distribution
This section treats the cap introduced in § 1. Cartwright, Verboncoeur and Birdsall [13] quantified the numerical error of particle loads that include cut-off Maxwellians. A grid-based kinetic code truncates the distribution at the edge of its velocity domain. Its projected moments can match those of the target distribution while the distribution held on the velocity grid does not [34]. We identify the distribution of the retained draws, measure its distance from the target distribution, and quantify the change in the high-speed tail.
The capped distribution
With a finite cap , draws whose components, in units of their thermal speeds, fall outside the box
are discarded and redrawn. The retained draws are distributed as conditioned on , that is, as the bi-Kappa distribution truncated to :
The allowed velocity-space region therefore determines the loaded distribution together with , , and . Every moment of is finite because its support is bounded. Because is a multivariate Student- distribution (Sec. II A), is a multivariate distribution truncated to a rectangle, whose moments have closed forms and software implementations [35, 36, 37]. Moments computed from a capped load are moments of ; for the second moments grow without bound as increases. The bound acts on the field-aligned components, before the rotation of Sec. III E. In the normalized coordinates of Eq. (7) it reduces to , with running over , , and . The thermal speeds cancel, so and the conditional distribution of depend on alone. The capped distribution of retains its dependence on and through the inverse scaling. With and , a draw is retained when . Because the direction is uniform and independent of , we compute by averaging Eq. (14) at this threshold over the distribution of , a one-dimensional numerical quadrature. At and the quadrature gives , and in attempts the capped sampler rejected a fraction , with a standard error of . The quadrature of § 1.4 A gives a rejected fraction below only for . Table II lists both quantities for each .
The effect of a cap depends on the quantity of interest. A bound well above the few thermal speeds that control a resonant instability may have little effect on its linear growth rate [38, 39], whereas a quantity weighted toward the tail depends on the removed particles.
These results apply to the component-wise box of Eq. (19). Because the box is defined in units of each component’s thermal speed, its rejected fraction depends on and alone. A bound on the speed does not have this property. When , its rejected fraction depends on both thermal speeds, and truncation of this kind changes the ratio of the second moments [40, 41].
Rejected fraction and the high-speed tail
The rejected fraction , the probability that a draw is rejected, equals the total-variation distance between the target distribution and the capped distribution,
For every region of velocity space, the probabilities of that region under and under therefore differ by at most . The distance does not, by itself, bound the shift of a tail quantile in velocity units.
For the algebraic bi-Kappa tail considered here, the radial distribution of the target, Eq. (11), has . The rejected fraction therefore decays only algebraically,
with the slowest decay for the heaviest tails. At , a cap at has a rejected fraction of . Because the uncapped second moment does not exist for , we use the 99.9th-percentile speed as a common tail diagnostic across the full range. The left panel of Figure 3 shows the rejected fraction across and , while the right panel shows how the cap changes the 99.9th-percentile speed.
Figure 3. Effect of the component-wise cap on the rejected fraction and the high-speed tail. Left: The rejected fraction , the probability of the target distribution outside the cap, computed by the quadrature of § 1.4 A. Right: The capped-to-uncapped ratio of the 99.9th-percentile speed; values closer to unity indicate better preservation of this percentile. The right-panel points are means over five pairs of capped and uncapped runs, each pair using the same random numbers, with accepted draws per run. Both panels use , six values, six values, and double precision.
At and , a cap at has a rejected fraction of and reduces the 99.9th-percentile speed by 11%. A small rejected fraction therefore does not by itself guarantee that a tail statistic is preserved. For , all caps up to in Table II have a rejected fraction above and lower the 99.9th-percentile speed by more than 8%. At , the quadrature of § 1.4 A gives a rejected fraction below only for . Table II lists both quantities for each .
Validation
Design
For each returned draw we compute the normalized velocity , which undoes the rotation and the anisotropic scaling of Secs. III B and III E. Under the target distribution, has distributed as in Eq. (13), the direction of is uniform on the sphere, and the direction is independent of (Sec. III C). These three properties determine the distribution, so we test them. Beran [42] tests ellipsoidal symmetry by the same reduction to a transformed radius and a direction, and later work develops tests of spherical symmetry and of radial-directional independence [43, 44]. Here the scaling and the radial distribution are known, so the test reduces to counting draws in cells of equal probability (Sec. VI B). Because is computed with the specified thermal speeds and field direction, an error in the loader’s scaling or rotation would also appear as a violation of these properties. None of them requires a finite moment, so the tests apply for .
In runs with identical random numbers and caps from to 100, our capped sampler returned exactly the uncapped draws that lie inside . A capped sample therefore follows Eq. (20) whenever the uncapped sample follows the target, and we test our uncapped sampler, in double precision. We drew samples at nine values, , with and the field along , for which the returned components are the field-aligned components of Sec. III E. The general rotation of Eq. (16) is tested in Sec. VI C. Each was sampled with draws from the Mersenne Twister random-number generator [45], and every test in this section uses these draws. At , 39 of the draws had infinite components; at the other values of no draw had a non-finite component. Under the target distribution, a component exceeds the largest double-precision number with probability at this , the unavoidable loss of Sec. IV for these thermal speeds, so 34 such draws are expected.
Table 2. Rejected fraction of the cap and preservation of the 99.9th-percentile speed. Each entry has the form rejected fraction / ratio. The first number is the rejected fraction, computed by the quadrature of § 1.4 A; the second is the capped-to-uncapped ratio of the 99.9th-percentile speed. A rejected fraction near zero means that the cap removes few draws, and a ratio near unity means that the cap leaves the 99.9th-percentile speed nearly unchanged. Percentile ratios are averaged over five pairs of capped and uncapped runs, each pair using the same random numbers, with accepted draws per run for in double precision.
The test of the radius in Sec. VI B counts these draws in its outermost shell, and the test over all cells omits them, because their direction is undefined. The outermost shell, , holds the fastest 10% of draws, since is the 90th percentile of . These draws determine tail statistics such as the 99.9th-percentile speed of § 1.4 B. For the test of the radius alone, we therefore divide this shell further at the 99th, 99.9th, 99.99th, and 99.999th percentiles of , which gives 14 shells. The shell edges span a wide range of radii. The 99.999th percentile of is 55 at and at , and at about one draw in 1200 has , where exceeds the largest double-precision number. Each draw is therefore assigned to its shell by comparing with the logarithms of the shell edges.
Radius, direction, and their independence
We divide the space of into cells that the target distribution fills with equal probability, the choice analyzed by Mann and Wald [46], and compare the number of draws in each cell with its expected value. Nine radii , obtained from Eq. (14), divide into ten shells of probability each. The direction is divided into 40 cells by five equal intervals of and eight equal intervals of , where and are the polar angle and the azimuth of about the field. These cells have equal solid angle because (Sec. III D). The target makes the direction uniform and independent of , so each of the combined cells has probability .
The comparison uses Pearson’s statistic [47], the sum over cells of , where is the observed number of draws in a cell and the expected number. For a sample from the target distribution with large , this statistic follows the distribution with degrees of freedom, where is the number of cells. The -value is the probability that this distribution exceeds the observed value of the statistic. A small -value indicates a discrepancy, and we treat a -value below 0.01 as one. A radial distribution of the wrong shape changes the counts in the inner or the outer shells. A direction that is not uniform, such as the clustering near the poles described in Sec. III D, changes the counts in particular direction cells in every shell. A dependence between radius and direction changes the counts in particular direction cells of particular shells. An error in the thermal speeds or the rotation distorts and changes the counts in the same ways. The test over all 400 cells has 399 degrees of freedom. The test of the radius alone compares the counts in the 14 shells, whose probabilities differ; it has 13 degrees of freedom, and its smallest expected count, beyond the 99.999th percentile, is 500.
| Radius (14 shells) | Radius and direction (400 cells) | |
| 0.51 | 0.995 | 0.353 |
| 0.55 | 0.073 | 0.062 |
| 0.75 | 0.153 | 0.125 |
| 1 | 0.671 | 0.464 |
| 1.25 | 0.178 | 0.968 |
| 1.5 | 0.532 | 0.992 |
| 2 | 0.737 | 0.147 |
| 5 | 0.356 | 0.672 |
| 10 | 0.622 | 0.719 |
Table III. Comparison of the loaded velocities with the target distribution. Each entry is the -value of Pearson’s test (Sec. VI B); a value below 0.01 would indicate a discrepancy. The first column tests the radius alone, over the 14 shells of Figure 4. The second tests the radius and the direction together, over 400 cells of equal probability: ten radius shells of probability 1/10 by 40 direction cells. Rows above the line have , where the second moments do not exist. No velocity bound, , field along , double precision, draws at each .
Figure 4. Number of loaded draws in each radius shell compared with the number expected under the target distribution. The radius is , the length of the normalized velocity, obtained by undoing the rotation and the anisotropic scaling (Sec. VI). It is divided into 14 shells: nine of probability 1/10 inside , the 90th percentile of , and five beyond it (right of the dotted line), bounded by the 99th, 99.9th, 99.9th, and 99.999th percentiles. The horizontal axis gives the percentile of under the target distribution at each shell edge; it is not to scale, and the five outer shells are drawn wider. For each shell, is the observed count, the expected count (the number of draws, , times the probability of the shell), and the standard deviation of for a sample from the target distribution. For such a sample each value of is approximately a standard normal variable, so about 95% of the values should lie in the shaded band between and 2. No departs systematically in any range of . The markers of the nine are placed side by side within each shell; filled markers have , where the second moments do not exist. No velocity bound, , field along , double precision.
Table III gives the -values at each , with in each of the 400 cells. None is below 0.01; the smallest is 0.062. Figure 4 shows the deviation of each shell count from its expected value, in units of its standard deviation. The largest of the 126 values in magnitude is 2.5, and the values in the five outer shells scatter about zero at every , including .
Invariance under scaling and rotation
The sampler draws before applying and , so runs that start from the same random-number seed should give, draw by draw, the same for any thermal speeds and field direction, provided and are applied as specified. We repeated the runs at , 2, and 10 with the same seeds for each of the six combinations of and field directions , , and the unit vector along . Over the draws of the five new combinations, the normalized velocity agrees with the velocity of the corresponding draw at with the field along to , the level of floating-point rounding, so the loader applies and as specified. At these three values of , the results of Sec. VI B therefore hold unchanged for these thermal speeds and field directions.
Cartesian components and the bi-Maxwellian limit
As a secondary check, we compare each Cartesian component of the returned velocities with its exact onedimensional distribution. Integrating Eq. (2) over two of the three components gives the distribution of the remaining one. For each field-aligned component , with ,
a scaled Student- distribution with degrees of freedom, which is the same for all three components in the variable . Figure 5 overlays the three components on this curve, so a wrong parallel scale would move the parallel component off it. Agreement of the three component

Figure 5. Distributions of the Cartesian velocity components at , 2, and 10 (top to bottom), sampled without a velocity bound with , the field along , and draws per panel in double precision. Each component is divided by its own thermal speed, so both axes are dimensionless. Markers are sample probability densities of (circles), (squares), and (triangles), from bins of width 0.25 normalized by the total number of draws, so that they can be compared with the curves. The solid blue curve is the exact distribution of Eq. (23). The dashed red curve is the one-component distribution of the bi-Maxwellian limit, Eq. (3), which the markers approach as increases. The horizontal axis ends at thermal speeds, which contains about 90% of each component’s distribution at and 99.5% at .
| Expected | Sample | Diff. (%) | ||
| 2 | 2.0000 | 1.9916 | -0.42 | |
| 2 | 2.0000 | 1.9925 | -0.37 | |
| 2 | 8.0000 | 8.1369 | +1.71 | |
| 5 | 0.7143 | +0.04 | ||
| 5 | 0.7143 | 0.00 | ||
| 5 | 2.8571 | -0.03 | ||
| 10 | 0.5882 | -0.01 | ||
| 10 | 0.5882 | 0.00 | ||
| 10 | 2.3529 | +0.01 |
Table 4. Sample variances of the field-aligned components against Eq. (4), for where the variance exists. No velocity bound, , field along , double precision. The sample column gives the mean of the variances of 100 runs of draws its standard error. At the fourth moment does not exist, so the standard error does not describe the sampling error of the variance and is not given.
distributions does not determine the three-dimensional distribution, which the tests of Sec. VI B examine. The logarithmic density axis shows the agreement out to six thermal speeds and the approach to the bi-Maxwellian limit as increases. At , where Eq. (23) is a Cauchy distribution and the variance does not exist, this range contains about 90% of each component’s distribution; the radius test of Sec. VI B covers the tail beyond it.
Variances
For , where Eq. (4) holds, the sample variances of the three field-aligned components give a further secondary check (Table IV). We divide the draws into 100 runs of , compute the variance of each run, and compare the mean over the runs with Eq. (4), using the standard error of that mean as the scale. At and the differences are at most 0.04%, within 1.6 standard errors. At they are , , and . The fourth moment does not exist there, so rare large draws can raise the variance of one run far above that of the others and shift the mean over the runs. In the parallel component, one run has a variance of 23.9, against a median of 7.9 over the runs, and this run accounts for the . For the same reason, the standard error does not describe the sampling error of the variance, and we do not compare these differences with it.
Scope and limitations
Scope of the validation. The distribution tests used with the field along a coordinate axis; other thermal-speed ratios and field directions were checked through the invariance of the normalized velocity at three values of (Sec. VI C). In single precision, and for , Sec. IV measured the lost draws but not the distribution of the returned ones. For other parameters the released test program can be applied to the actual load.
Finite precision. The unavoidable loss follows from the target distribution and the floating-point format alone. A loader can compare its measured loss with this value; an excess indicates a loss in the calculation.
The cap. The tail was characterized by a single statistic, the 99.9th-percentile speed; a quantity weighted further into the tail may change more under the same cap. The box also breaks the rotational symmetry of the distribution about the field. Its orientation in the plane perpendicular to the field is set by the choice of (Sec. III E), so where the field direction varies, this orientation can change abruptly between neighboring regions. The rejected fraction and the speed distribution do not depend on it. A cap makes every moment finite, but the values depend on , a numerical parameter. When finite moments are wanted for physical reasons, the regularized Kappa distribution (Sec. II C) makes the cutoff a parameter of the model, and samplers for it exist [21].
Summary
We tested the complete output of an anisotropic bi-Kappa loader built on the Gamma-ratio construction [14, 19, 20, 21].
Near , the direct calculation of the radius loses large-radius draws when the floating-point product that forms its denominator rounds to zero. Computing the radius on a logarithmic scale avoids this loss. The loss that remains depends only on the target distribution and the floating-point format, so it can be computed before a run, and a loader built on another Gamma generator can compare its measured loss with it.
The rejected fraction of a component-wise bound decays only as , and a small rejected fraction can accompany a large change in a tail percentile. The region and width of a bound are therefore part of the loaded distribution and should be reported with , , and .
Tests of the normalized radius, the direction, and their independence need no finite moments, so they apply for , where the second moments do not exist, and they reach far into the tail. The loaded velocities were consistent with the target distribution at every tested . The released program applies these tests to velocities from any loader.
Code availability
The loader and the test program are released as bi-kappa-distribution-sampling under the MIT License at github.com/KehengZhu/bi-kappa-distribution-sampling and deposited on Zenodo at doi.org/10.5281/zenodo.20617011 [48]; the DOI points to the latest deposited version, and the version evaluated here is 3.0.0. The package contains C++ samplers for the bi-Kappa and bi-Maxwellian distributions, with or without a component-wise velocity bound, and a Python program that applies the tests of Sec. VI to velocities from any loader and, given the number of attempts, reports the rejected fraction. Without a bound, the samplers return a draw with a non-finite component rather than discarding it, so that the number of lost draws is known. The samplers are used in the HYPERS hybrid particle simulation code [49, 50, 51].
References
References
- [1]G. Livadiotis and D. J. McComas, Understanding kappa distributions: A toolbox for space science and astrophysics, Space Science Reviews 175, 183 (2013).DOI
- [2]V. M. Vasyl̄iunas, A survey of low-energy electrons in the evening sector of the magnetosphere with OGO 1 and OGO 3, Journal of Geophysical Research 73, 2839 (1968).
- [3]V. Pierrard and M. Lazar, Kappa distributions: Theory and applications in space plasmas, Solar Physics 267, 153 (2010), arXiv:1003.3532 [physics.space-ph].
- [4]L. Matteini, S. Landi, P. Hellinger, F. Pantellini, M. Maksimovic, M. Velli, B. E. Goldstein, and E. Marsch, Evolution of the solar wind proton temperature anisotropy from 0.3 to 2.5 AU, Geophysical Research Letters 34, L20105 (2007).
- [5]P. Hellinger, P. Trávníček, J. C. Kasper, and A. J. Lazarus, Solar wind proton temperature anisotropy: Linear theory and WIND/SWE observations, Geophysical Research Letters 33, L09101 (2006).DOI
- [6]V. Pierrard, M. Lazar, S. Poedts, Š. Štverák, M. Maksimovic, and P. M. Trávníček, The electron temperature and anisotropy in the solar wind: Comparison of the core and halo populations, Solar Physics 291, 2165 (2016).DOI
- [7]D. Summers and R. M. Thorne, The modified plasma dispersion function, Physics of Fluids B: Plasma Physics 3, 1835 (1991).DOI
- [8]R. L. Mace and M. A. Hellberg, A dispersion function for plasmas containing superthermal particles, Physics of Plasmas 2, 2098 (1995).DOI
- [9]G. Livadiotis, G. Nicolaou, and F. Allegrini, Anisotropic kappa distributions. I. formulation based on particle correlations, The Astrophysical Journal Supplement Series 253, 16 (2021).DOI
- [10]C. K. Birdsall and A. B. Langdon, Plasma Physics via Computer Simulation (McGraw-Hill, New York, 1985).
- [11]R. W. Hockney and J. W. Eastwood, Computer Simulation Using Particles (McGraw-Hill, New York, 1981).
- [12]J. P. Verboncoeur, Particle simulation of plasmas: Review and advances, Plasma Physics and Controlled Fu- sion 47, A231 (2005).DOI
- [13]K. L. Cartwright, J. P. Verboncoeur, and C. K. Birdsall, Loading and injection of Maxwellian distributions in particle simulations, Journal of Computational Physics 162, 483 (2000).DOI
- [14]R. F. Abdul and R. L. Mace, One-dimensional particle-in-cell simulations of electrostatic Bernstein waves in plasmas with kappa velocity distributions, Physics of Plasmas 22, 102107 (2015).DOI
- [15]R. F. Abdul and R. L. Mace, A method to generate kappa distributed random deviates for particle-in-cell simulations, Computer Physics Communications 185, 2383 (2014).DOI
- [16]X. An, A. Artemyev, V. Angelopoulos, S. Lu, P. Pritchett, and V. Decyk, Fast inverse transform sampling of non-Gaussian distribution functions in space plasmas, Journal of Geophysical Research: Space Physics 127, e2021JA030031 (2022).DOI
- [17]S. Zenitani and T. Umeda, An approximate kappa generator for particle simulations, Earth, Planets and Space 78, 119 (2026).DOI
- [18]S. Zenitani, A simple procedure for generating a kappa distribution in PIC simulation, Research Notes of the AAS 9, 299 (2025), arXiv:2512.04272 [physics.plasm-ph].DOI
- [19]S. Zenitani and S. Nakano, Loading a relativistic kappa distribution in particle simulations, Physics of Plasmas 29, 113904 (2022), arXiv:2210.15118 [physics.plasm-ph].DOI
- [20]S. Zenitani and S. Nakano, Loading loss-cone distributions in particle simulations, Journal of Geophysical Research: Space Physics 128, e2023JA031983 (2023), arXiv:2309.06879 [physics.plasm-ph].DOI
- [21]S. Zenitani, S. Usami, and S. Matsukiyo, Loading non-maxwellian velocity distributions in particle simulations, Journal of Geophysical Research: Space Physics 131, e2025JA034669 (2026), arXiv:2510.11890 [physics.plasm-ph].arxiv.org/abs/2510.11890
- [22]R. F. Abdul, 2D3V Electromagnetic Particle-In-Cell Simulations of Plasmas having Kappa Velocity Distributions, Ph.D. thesis, University of KwaZulu-Natal, Westville, South Africa (2018), hdl:10413/22458.
- [23]L. Devroye, Non-Uniform Random Variate Generation (Springer-Verlag, New York, 1986).
- [24]C. Liu, R. Martin, and N. Syring, Efficient simulation from a gamma distribution with small shape parameter, Computational Statistics 32, 1767 (2017).DOI
- [25]K. Scherer, H. Fichtner, H. J. Fahr, and M. Lazar, On the applicability of κ-distributions, The Astrophysical Journal 881, 93 (2019).DOI
- [26]G. R. Werner, T. G. Jenkins, A. M. Chap, and J. R. Cary, Speeding up simulations by slowing down particles: Speed-limited particle-in-cell simulation, Physics of Plasmas 25, 123512 (2018).arxiv.org/abs/1511.08225
- [27]M. Lazar, H. Fichtner, and P. H. Yoon, On the interpretation and applicability of κ-distributions, Astronomy & Astrophysics 589, A39 (2016).
- [28]K. Scherer, E. Husidic, M. Lazar, and H. Fichtner, The κ-cookbook: A novel generalizing approach to unify κ-like distributions for plasma particle modelling, Monthly Notices of the Royal Astronomical Society 497, 1738 (2020).DOI
- [29]K. Scherer, H. Fichtner, and M. Lazar, Regularized κ-distributions with non-diverging moments, Europhysics Letters 120, 50002 (2017).
- [30]K. Scherer, M. Lazar, E. Husidic, and H. Fichtner, Moments of the anisotropic regularized κ-distributions, The Astrophysical Journal 880, 118 (2019).
- [31]G. Marsaglia, Choosing a point from the surface of a sphere, The Annals of Mathematical Statistics 43, 645 (1972).DOI
- [32]R. M. Thorne and D. Summers, Enhancement of wave growth for warm plasmas with a high-energy tail distribution, Journal of Geophysical Research 96, 217 (1991).DOI
- [33]G. Marsaglia and W. W. Tsang, A simple method for generating gamma variables, ACM Transactions on Mathematical Software 26, 363 (2000).DOI
- [34]G. Johnson, A. Hakim, and J. Juno, A moment-conserving discontinuous Galerkin representation of the relativistic Maxwellian distribution, Journal of Plasma Physics 91, E130 (2025).DOI
- [35]H. J. Ho, T.-I. Lin, H.-Y. Chen, and W.-L. Wang, Some results on the truncated multivariate t distribution, Journal of Statistical Planning and Inference 142, 25 (2012).DOI
- [36]T.-I. Lin and W.-L. Wang, On moments of truncated multivariate normal/independent distributions, Journal of Multivariate Analysis 199, 105248 (2024).DOI
- [37]C. E. Galarza, T.-I. Lin, W.-L. Wang, and V. H. Lachos, On moments of folded and truncated multivariate Student-t distributions based on recurrence relations, Metrika 84, 825 (2021), implemented in the MomTrunc R package.DOI
- [38]J. G. Trotignon and M. R. Feix, Study of longitudinal electron oscillations in a plasma with a cut-off Maxwellian velocity distribution, Journal of Plasma Physics 17, 13 (1977).DOI
- [39]R. Stuchi and P. Lauber, Landau damping for non-Maxwellian distribution functions, Journal of Plasma Physics 91, E44 (2025).
- [40]G. M. Tallis, Elliptical and radial truncation in normal populations, The Annals of Mathematical Statistics 34, 940 (1963).DOI
- [41]F. Palombi, S. Toti, and R. Filippini, Numerical reconstruction of the covariance matrix of a spherically truncated multinormal distribution, Journal of Probability and Statistics 2017, 6579537 (2017).
- [42]R. Beran, Testing for ellipsoidal symmetry of a multivariate density, The Annals of Statistics 7, 150 (1979).DOI
- [43]N. Henze, Z. Hlá vka, and S. G. Meintanis, Testing for spherical symmetry via the empirical characteristic function, Statistics 48, 1282 (2014).DOI
- [44]H. Zhang and L. Feng, High-dimensional tests for elliptical models via radial-directional dependence (2026), arXiv:2605.03592 [stat.ME].arxiv.org/abs/2605.03592
- [45]M. Matsumoto and T. Nishimura, Mersenne twister: A 623-dimensionally equidistributed uniform pseudorandom number generator, ACM Transactions on Modeling and Computer Simulation 8, 3 (1998).DOI
- [46]H. B. Mann and A. Wald, On the choice of the number of class intervals in the application of the chi square test, The Annals of Mathematical Statistics 13, 306 (1942).DOI
- [47]K. Pearson, On the criterion that a given system of deviations from the probable in the case of a correlated system of variables is such that it can be reasonably supposed to have arisen from random sampling, The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science 50, 157 (1900).
- [48]K. Zhu and Y. A. Omelchenko, bi-kappa-distribution-sampling: bi-Kappa and related velocity samplers for kinetic plasma simulations (2026), software (all versions), https://doi.org/10.5281/zenodo.20617011.
- [49]Y. A. Omelchenko and H. Karimabadi, HYPERS: A uni-dimensional asynchronous framework for multiscale hybrid simulations, Journal of Computational Physics 231, 1766 (2012).
- [50]Y. A. Omelchenko, M. M. Kuznetsova, M. El-Alaoui, L. Rastaetter, M. Petrenko, and J. Ng, HYPERS-global model at CCMC: A hybrid framework for modeling multi-scale processes in space weather, AGU Fall Meeting 2023, San Francisco, CA, Abstract SH21E-2923 (2023) https://ui.adsabs.harvard.edu/abs/2023AGUFM.SH21E2923O.
- [51]Y. A. Omelchenko and H. Karimabadi, EMAPS: An intelligent agent-based technology for simulation of multi-scale systems, in Space and Astrophysical Plasma Simulation, edited by J. Büchner (Springer, 2023) Chap. 13, p. 393.DOI


