Use this URL in any client supporting remote Streamable HTTP MCP. Calls return structured JSON; inputs are processed without persistence.
Call success_count_distribution
Each event is a Bernoulli trial: success or failure. Events must be independent; shared failures and correlated outcomes invalidate this model. Probabilities are supplied assumptions, not estimates inferred from observations. This computes the Poisson-binomial distribution with rational arithmetic. Supply integer 0/1 or quoted fraction/decimal strings; JSON floats and booleans are rejected. Threshold is an integer; at_least and at_most are inclusive. Thresholds outside 0..trial_count return the corresponding zero/one tails and zero exact mass. An empty trial list has probability one of zero successes. All probabilities, expectation and variance are exact fraction strings. Distribution includes zero-mass counts. Intended for small probability lists; runtime grows quadratically with trial count. No sampling or external data is used.
The HTTP and MCP interfaces execute the same implementation. Validation errors are returned explicitly. See the tool notes above for its supported inputs and behavior.
Exact success-count probabilities: convolution and inclusive tails
Read the explanation
The saved example assumes three independent Bernoulli events with success probabilities one half, one third and three quarters. Start with probability one at zero successes. Each new event splits existing probability mass: failure keeps the count, while success moves it up by one. After the first two events, zero successes has probability one third, one success one half, and two successes one sixth. The displayed bars use six hundred pixels per probability one. Unequal probabilities give a Poisson-binomial distribution. Independence is a supplied assumption, not inferred from observations, and shared or correlated failures invalidate this model. This explanation derives saved inputs without sampling, external data or HTTP and MCP execution. For the third event, failure probability is one quarter and success probability three quarters. Exactly two successes combines two disjoint routes: two previous successes followed by failure, and one previous success followed by success. One sixth times one quarter plus one half times three quarters gives five twelfths. Exactly three is one sixth times three quarters, or one eighth. The full distribution for counts zero through three is one twelfth, three eighths, five twelfths and one eighth. Its masses sum to one. The bars use the same six hundred-pixel probability scale, illustrating exact masses rather than Monte Carlo estimates or measured agent results. The saved threshold is two. Exactly two is five twelfths, but at least two is inclusive and adds three successes, yielding thirteen twenty-fourths. At most two is also inclusive and equals seven eighths. Expectation is the sum of event probabilities, nineteen twelfths; variance is the sum of p times one minus p, ninety-five over one hundred forty-four. The bars use six hundred pixels per probability one. Integer thresholds outside the possible range have zero exact mass and the appropriate zero or one tails. An empty event list has probability one at zero successes. The contract accepts integer zero or one and quoted finite decimal or fraction strings, rejecting JSON floats and booleans. Offline shared app code is absent, so native input preservation is checked separately and service results remain unverified.
Exact Poisson-Binomial Distributions for Independent Bernoulli Trials
How does dynamic rational polynomial convolution calculate exact probabilities for unequal independent success events?
This agent tool evaluates the Poisson-binomial distribution, which specifies the exact probability distribution of the total number of successes across independent Bernoulli trials where each trial may possess an arbitrary success probability. Using dynamic iterative rational polynomial convolution rather than floating-point math or Monte Carlo sampling, it computes exact fractions for individual success counts, cumulative tail thresholds, expectation, and variance.
The model strictly assumes all trials are mutually independent; positive or negative correlation, shared operational risks, or cascaded dependencies invalidate the calculated distribution. In addition, because the convolution updates coefficients in O(n^2) rational operations without floating-point truncation or FFT approximations, large lists of trials will exhibit quadratic computational scaling.
Try a worked example
Leave the default arguments with probabilities '1/2', '1/3', and '3/4' and threshold 2, then click 'Run tool'. The structured result returns an exact distribution across 0 through 3 successes (1/12, 3/8, 5/12, and 1/8), yielding a probability_at_least of '13/24', an expected_successes value of '19/12', and a variance of '95/144'.
Iterative Polynomial Convolution
For n independent Bernoulli trials with probabilities p_1, ..., p_n, the probability generating function of the total success count S_n is given by the product of the individual trial polynomials ( (1 - p_i) + p_i * z ). Starting from a base polynomial representing zero trials with mass 1 at degree 0, the backend iteratively folds in each trial. For each probability p, every existing count mass k contributes value*(1 - p) to count k and value*p to count k + 1.
By maintaining all intermediate masses and probabilities as Python rational Fraction instances, the tool avoids numerical underflow and floating-point rounding errors entirely, outputting irreducible rational fraction strings for each outcome.
Threshold and Tail Derivation
Tail calculations sum the exact rational probabilities across designated count bins. For an integer threshold k, the probability_at_least sums all masses with index >= k, while probability_at_most sums all masses with index <= k. Values of k outside the range [0, n] yield exact mass 0 and proper tail bounds of 0 or 1 without throwing errors.
The expected number of successes is computed directly as the sum of all p_i, and the variance is calculated as the sum of p_i*(1 - p_i). For the three trials 1/2, 1/3, and 3/4, the individual variances are 1/4, 2/9, and 3/16, which sum exactly to 36/144 + 32/144 + 27/144 = 95/144.