FANDOM


[edit] Template-info Template documentation
Transparent
Ambox content
SOURCE EDITOR ONLY!
This page uses LaTeX markup to display mathematical formulas. Editing the page with the VisualEditor or Classic rich-text editor disrupts the layout.
Do not even switch to one of these editors while editing the page!
For help with mathematical symbols, see Mathematical symbols and expressions.


The templates {{Required trials}} and {{Required trials percent}} calculate the number $ n $ of Bernoulli trials required to achieve at least one success with a given minimum probability.

The only difference between the two is that {{Required trials}} works with probabilities from 0 to 1, while {{Required trials percent}} works with probabilities from 0 % to 100 %.

The formula is

$ n \ge \frac{\ln(1- \mathrm P_{min})}{\ln(1-p)} $
$ \mathrm P_{min} $: desired minimum probability of at least one success
$ p $: probability of success

Usage

{{required trials | pmin = | p = | format}}

or

{{required trials percent | pmin = | p = | format}}

Parameters

pmin

  • Desired minimum probability $ \mathrm P_{min} $ of at least one success
  • Required.
    • {{Required trials}}: Number between 0 and 1.
    • {{Required trials percent}}: Number between 0 % and 100 %, with or without percent sign.

p

  • Probability $ p $ of success
  • Required.
    • {{Required trials}}: Number between 0 and 1.
    • {{Required trials percent}}: Number between 0 % and 100 %, with or without percent sign.

format

  • Display options for $ n $
  • Optional. One of the following texts:
    • ceil – Displays the ceiling $ \lceil n \rceil $ instead of an unrounded $ n $.
      As there are no "partial" trials, it is usually recommended to use ceil instead of round.
    • round x – Rounds $ n $ to x trailing digits.

Examples

Standard

Given a probability $ p $ = 1.88 % = 0.0188 of obtaining a V8 Engine from a Pro Kit Box, the number of cards required to get at least one V8 Engine with a probability of 90 % = 0.9 is:

Unformatted
{{required trials | p=0.0188 | pmin=0.9}}121.32299622997
Rounded to 3 digits
{{required trials | p=0.0188 | pmin=0.9 | round 3}}121.323
Ceiling
{{required trials | p=0.0188 | pmin=0.9 | ceil}}122

Percentages

Technically, {{Required trials percent}} simply calls {{Required trials}} with pmin and p divided by 100.

Percent signs and spaces are removed, so it doesn't matter if parameters are provided as 90 %, 90% or 90.

Unformatted
{{required trials percent | p=1.88 % | pmin=90 %}}121.32299622997
Rounded to 3 digits
{{required trials percent | p=1.88% | pmin=90% | round 3}}121.323
Ceiling
{{required trials percent | p=1.88 | pmin=90 | ceil}}122

Extracted values from Pro Kit Box templates

{{Required trials percent}} is particularly useful for statistical values extracted from Pro Kit Box templates via the # parameter, as these values are always given in percent.

For example, {{Finish Line Box|#sv82}} delivers 2.13, the average percentage of V8 Engines in A8Box Finish Line Box Finish Line Boxes. See {{A8box-meta}} for an overview of statistics parameters.

Cards needed for at least one ...

V8 Engine from Finish Line Boxes
{{required trials percent | p={{Finish Line Box|#sv82}} | pmin=90 | ceil}}107
Tech card from Ultra Boxes
{{required trials percent | p={{Ultra Box|#stech2}} | pmin=90 | ceil}}37
Tech card from Engine Boxes (impossible)
{{required trials percent | p={{Engine Box 1-5|#stech2}} | pmin=90 | ceil}}
9999999999999999999
$ \infty $

Extreme values

Extreme parameter values would lead to errors like division by zero or invalid arguments for the logarithm. These values are handled as follows:

p

  • p = 0: success is impossible, $ \infty $ is displayed (an infinite number of trials is required).
  • p = 1: success is sure, 1 is displayed (only one trial is required).

pmin (if 0 < p < 1)

  • pmin = 0: A desired 0 % probability of having at least one success is achievable with any probability of success, 1 is displayed (only one trial is required).
  • pmin = 1: A desired 100 % probability of having at least one success is impossible if success is not sure, $ \infty $ is displayed (an infinite number of trials is required).

The percent values 0 % and 100 % work accordingly.

  • {{required trials | p=0 | pmin=0.9}}
    9999999999999999999
    $ \infty $
  • {{required trials | p=0 | pmin=0}}
    9999999999999999999
    $ \infty $
  • {{required trials | p=0 | pmin=1}}
    9999999999999999999
    $ \infty $
  • {{required trials | p=1 | pmin=0.9}}1
  • {{required trials | p=1 | pmin=0}}1
  • {{required trials | p=1 | pmin=1}}1
  • {{required trials | p=0.2 | pmin=0}}1
  • {{required trials | p=0.2 | pmin=1}}
    9999999999999999999
    $ \infty $

Technical details

If the infinity sign is displayed, the template adds an invisible leading <div> tag:

<div style="display:none;">9999999999999999999</div><math>\infty</math>

This is to ensure that $ \infty $ is sorted after all numbers in tables, for example in Pro Kit Box statistics: minimum card requirements.

Community content is available under CC-BY-SA unless otherwise noted.