This is a more general issue to be discussed how to structure
ProbabilityDistribution class.
Currently ProbabilityDistribution class (
http://www.sagemath.org/doc/
reference/sage/gsl/probability_distribution.html) includes the
following sub classes.
RealDistribution: various real-valued probability distributions.
SphericalDistribution: uniformly distributed points on the surface
of an $n-1$ sphere in $n$ dimensional euclidean space.
GeneralDiscreteDistribution: user-defined discrete distributions.
I feel this is a bit confusing. RealDistribution to the moment does
not include discrete distributions while GeneralDiscreteDistribution
only handles user defined discrete distributions.
The term RealDistribution is confusing by itself. There is no unreal
distribution or something similar to that. Sage users probably would
use Wikipedia for reference and there is no such term in Wikipedia too
Next, the term GeneralDiscreteDistribution is confusing too as there
is no specific discrete distribution implemented in Sage, and as the
documentation says, this class only holds user defined distributions.
Specific discrete in my understanding would be binomial, pascal and
the like which are not implemented in Sage yet and which on my system
I included into RealDistribution.
I propose the following ways of structuring distribution classes in
Sage:
1. The base class ProbabilityDistribution, as it exists now, will have
two sub classes: (1) ExplicitDistribution holds all the currently
available distributions continuous or discrete. (2)The second subclass
UserDefinedDistribution holds all distributions that can be continuous
(function P(x), x = continuous variable) and discrete (set of P(x), x
discrete values). Not yet implemented in Sage is the user defined
continuous probability function.
2. Alternatively, the base class ProbabilityDistribution, as it
exists now, will have two sub classes: (1) ContinuousDistribution and
(2) DiscreteDistribution, and both of them will implement user defined
probability functions too.
3. Alternatively, each possibility receives its own class
ContinuousExplicit, ContinuousUserdefined, Discrete Explicit,
DiscreteUserdefined. In this case ContinuousExplicit is what
RealDistribution stands for now and DiscreteUserdefined is currently
GeneralDiscreteDistribution.
4. Finally, there will be only one class. The base class will be
extended to hold all types of probability distributions, and user
defined probability distributions are initialized by the keyword
'user'. For instance T(user defined and discrete) =
ProbabilityDistribution('user', [list]) or T(user defined and
continuous) = ProbabilityDistribution('user', [function])
I hope my considerations will trigger some discussion about
restructuring the ProbabilityDistribution class. Alternatively one may
think of omitting this class at all as the functionality is
implemented in NumPy and R more or less available from Sage.