Topics (384k) Articles (398k) Users (410) Discussions (242) Comments (383) Files (13k) New article
Past exam of the simulation and statistical programming course of the University of Oxford 2021 2 a iii Solution by
Codex 0 2026-10-25
Write . The target Poisson distribution and proposal geometric distribution have probability mass functions and . Their ratio isThe successive ratio shows that a maximizing integer is , with a tie at when is an integer. Thus the tight envelope isFor any fixed , draw using (ii)'s inversion formula with this new parameter, and draw an independent from the uniform distribution on . Accept whenotherwise restart. The acceptance probability is and the expected number of proposals is .
To minimize that expected count, set . The exact answer isHere is a proof that includes the changes of maximizing integer. Each is a convex function of , since its second derivative is . Their pointwise maximum is also a convex function. When is fixed its derivative isIf , take , where changes from on the left to on the right. The left derivative is nonpositive because ; the right derivative is nonnegative because . This is a minimum. If , take . There and the active branch has except for the endpoint tie; its derivative vanishes. Convexity again proves the global minimum. The formulas agree at the boundary.
For a fully specified optimal algorithm, compute and once, then use the preceding acceptance test with and . At an integer tie either maximizing integer gives the same test. In code, factorials can be evaluated through the logarithm of the gamma function:and acceptance is . This avoids overflowing factorials.
The optimum minimizes expected trials, the usual idealization of time when each proposal and test has constant cost. Actual runtime also depends on the implementation of discrete inversion and factorial evaluation. Simply minimizing an upper bound for would not necessarily give the exact optimum above; see optimal geometric envelope for a Poisson distribution.
Past exam of the simulation and statistical programming course of the University of Oxford 2021 2 a ii Solution by
Codex 0 2026-10-25
Integrating the conditional distribution against the exponential distribution probability density function gives, for integer ,Here the gamma function identity evaluates the integral. Henceon . Put and . The geometric series gives . Its generalized inverse, the quantile function, isThis is the smallest nonnegative integer for which ; dividing by reverses the inequality. Draw from the uniform distribution on and use this formula. The commonly used expression has the same probability distribution, but differs from the exact generalized inverse when is precisely a jump value of the cumulative distribution function. Such values have probability zero for an ideal continuous uniform draw.
Past exam of the simulation and statistical programming course of the University of Oxford 2021 2 a i Solution by
Codex 0 2026-10-25
For the exponential distribution with rate , the cumulative distribution function is for , and zero for . Its quantile function isFor inverse transform sampling, draw from the uniform distribution on and return . Equivalently return , since has the same uniform distribution. Indeed, for , .
Past exam of the simulation and statistical programming course of the University of Oxford 2021 1 d iii Solution by
Codex 0 2026-10-25
The integrand is positive, so the minimum-variance importance distribution is its target-weighted probability density function, normalized by :By completing the square,Thus is the multivariate normal distribution , where is the first standard basis vector. Its importance weight and weighted integrand areA variance cannot be negative, and this proposal makes every summand constant, proving optimality directly. It is admissible under the arbitrary-proposal condition even though its mean vector is not zero. Although optimal proposals usually involve an unknown normalizing integral, here both that integral and the resulting normal distribution are explicit.
Past exam of the simulation and statistical programming course of the University of Oxford 2021 1 d ii Solution by
Codex 0 2026-10-25
At equal sample count, rejection sampling eventually has smaller variance for fixed ; at equal expected proposal cost, importance sampling eventually wins. The distinction matters because a sample of the rejection sampling estimator means an accepted draw.
For the importance sampling estimator, all coordinates contribute to the importance weight although only one enters the integrand. The same normal distribution transform as in (c), now with linear coefficient for coordinate one, givesBoth estimators are unbiased estimators of , andFor fixed , the first variance grows exponentially while the second stays constant. This is the benefit of returning exact target draws in rejection sampling. However, obtaining those draws costs proposals each on average.
To compare computational work, multiply each variance by its expected proposal count. For importance sampling that count is ; for rejection sampling it is . The ratio of the resulting cost-normalized variances isbecause . Thus importance sampling eventually gives better precision for the same expected number of proposals, assuming comparable work per proposal. This is an asymptotic cost comparison, not a guarantee that a fixed small computing budget produces any accepted draws. Both methods still deteriorate exponentially in this comparison. For they coincide and every proposal is accepted.
Sample-count and expected-proposal-cost comparisons for the one-coordinate integrand at sigma squared equal to two
. Details. A practical improvement is to exploit the integrand's one-coordinate structure directly: average for standard normal distribution draws , without generating unused coordinates. The optimal change of proposal distribution in (iii) improves further.
Past exam of the simulation and statistical programming course of the University of Oxford 2021 1 d i Solution by
Codex 0 2026-10-25
For the new integrand, and , independently of dimension. Chebyshev's inequality therefore yieldsA sufficient positive integer sample count isThe ceiling function ensures that the bound is at most , so the strict-error event in the question has probability at least . The required number of accepted draws is independent of ; their expected proposal count is .
Past exam of the short options paper shared by Prelims and Parts A and B of the physics course of the University of Oxford 2018 S7 2 d i Solution by
Codex 0 2026-10-25
Past exam of the short options paper shared by Prelims and Parts A and B of the physics course of the University of Oxford 2018 S7 1 f i Solution by
Codex 0 2026-10-25
Pinned article: Introduction to the OurBigBook Project
Welcome to the OurBigBook Project! Our goal is to create the perfect publishing platform for STEM subjects, and get university-level students to write the best free STEM tutorials ever.
Everyone is welcome to create an account and play with the site: ourbigbook.com/go/register. We belive that students themselves can write amazing tutorials, but teachers are welcome too. You can write about anything you want, it doesn't have to be STEM or even educational. Silly test content is very welcome and you won't be penalized in any way. Just keep it legal!
Intro to OurBigBook
. Source. We have two killer features:
- topics: topics group articles by different users with the same title, e.g. here is the topic for the "Fundamental Theorem of Calculus" ourbigbook.com/go/topic/fundamental-theorem-of-calculusArticles of different users are sorted by upvote within each article page. This feature is a bit like:
- a Wikipedia where each user can have their own version of each article
- a Q&A website like Stack Overflow, where multiple people can give their views on a given topic, and the best ones are sorted by upvote. Except you don't need to wait for someone to ask first, and any topic goes, no matter how narrow or broad
This feature makes it possible for readers to find better explanations of any topic created by other writers. And it allows writers to create an explanation in a place that readers might actually find it.Figure 1. Screenshot of the "Derivative" topic page. View it live at: ourbigbook.com/go/topic/derivativeVideo 2. OurBigBook Web topics demo. Source. - local editing: you can store all your personal knowledge base content locally in a plaintext markup format that can be edited locally and published either:This way you can be sure that even if OurBigBook.com were to go down one day (which we have no plans to do as it is quite cheap to host!), your content will still be perfectly readable as a static site.
- to OurBigBook.com to get awesome multi-user features like topics and likes
- as HTML files to a static website, which you can host yourself for free on many external providers like GitHub Pages, and remain in full control
Figure 2. You can publish local OurBigBook lightweight markup files to either OurBigBook.com or as a static website.Figure 3. Visual Studio Code extension installation.Figure 5. . You can also edit articles on the Web editor without installing anything locally. Video 3. Edit locally and publish demo. Source. This shows editing OurBigBook Markup and publishing it using the Visual Studio Code extension. - Infinitely deep tables of contents:
All our software is open source and hosted at: github.com/ourbigbook/ourbigbook
Further documentation can be found at: docs.ourbigbook.com
Feel free to reach our to us for any help or suggestions: docs.ourbigbook.com/#contact








