Opened 12 years ago

Closed 12 years ago

Last modified 10 years ago

#6662 closed enhancement (duplicate)

sampling from a general discrete probability distribution

Reported by: carlohamalainen Owned by: mhampton
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: statistics Keywords:
Cc: kohel Merged in:
Authors: carlohamalainen Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

This patch exposes the general discrete distribution code in the Gnu Scientific Library (GSL). It provides a fast way to sample from a user-defined discrete probability distribution, and it also extends the DiscreteProbabilitySpace? class by allowing sampling from the defined distribution.

Attachments (1)

general_discrete_distribution.patch (23.3 KB) - added by carlohamalainen 12 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 12 years ago by carlohamalainen

Why is the reference manual formatting broken? After doing "sage -docbuild reference html" the examples in the entry "Interface to gsl discrete random variable generator" in Probability have examples that are not formatted. Why? What's going wrong with the docstring formatting in my pyx file?

Changed 12 years ago by carlohamalainen

comment:2 Changed 12 years ago by carlohamalainen

Fixed the docstring formatting.

comment:3 Changed 12 years ago by wdj

I can try to test this, but I'm wondering how (for example) do I generate a list of 10 numbers in (0.1,2.3) randomly having the normal distribution with mean 1 and standard deviation 2? (Similar question for other common distributions.)

comment:4 Changed 12 years ago by wdj

This patch installs fine with 4.1.1.a1 on an amd64 machine running ubuntu 9.04. It passes sage -testall, except for the known failures.

I'm a little concerned about the docstrings. If I were more of a probability expert maybe this would not be an issue but not being an expert (which maybe is a good thing?) I don't see how to use it to do some basic sampling which might be useful for teaching a first course in probability.

comment:5 Changed 12 years ago by carlohamalainen

I only wrote an interface to one particular discrete distribution in gsl. I'll add stuff for normal distribution, binomial, etc later this month (travelling and no time to do Sage).

comment:6 Changed 12 years ago by wdj

  • Summary changed from [with patch, needs review] sampling from a general discrete probability distribution to [with patch, needs work] sampling from a general discrete probability distribution

comment:7 Changed 12 years ago by mvngu

  • Milestone changed from sage-4.1.2 to sage-duplicate/invalid/wontfix
  • Resolution set to duplicate
  • Status changed from new to closed
  • Summary changed from [with patch, needs work] sampling from a general discrete probability distribution to sampling from a general discrete probability distribution

Closing this as a duplicate of #6662.

comment:8 Changed 10 years ago by kcrisman

  • Report Upstream set to N/A

You mean #6827! That wasted 20 minutes for me, Minh.

:)

Note: See TracTickets for help on using tickets.