Definition
​

In[]:=
BidenFraction[Association["Trump"t_,"Biden"b_],f_,margin_:0]:=BidenFraction[{{t,b},f},margin]
In[]:=
BidenFraction[{v:{t_,b_},f_},margin_:0]:=Module[{cast=Total[v],ultimate,remaining},​​ultimate=cast/f;​​remaining=ultimate-cast;Reduce[t+(1-bf)remaining+margin*ultimate<b+bf*remaining,bf][[2]]​​]

Documentation

In[]:=

Usage
​

BidenFraction[a,f]
takes an
Association
a
in which the keys are "Trump" and "Biden" and the values are the number of votes they have and f, which is the fraction of ultimate votes already believed to have been case.
BidenFraction[a,f,m]
performs similarly but requires Biden to win by
a
fraction
m
of the ultimate votes cast.
In[]:=

Details & Options
​

◼
By default, the optional
m
argument is set to zero; Biden is just required to win by one vote.
◼
The Trump fraction, the fraction of uncounted votes Donald Trump needs to have a majority in a state is simply one minus the Biden fraction.

Examples
​

In[]:=

Basic Examples

Compute the fraction of remaining votes in Georgia that Biden would need to win given the data on the CNN website at
Thu 5 Nov 2020 16:40:41GMT-6.
:
In[]:=
BidenFraction["Trump"2439800,"Biden"2430265,0.98]
Reduce
:Reduce was unable to solve the system with inexact coefficients. The answer was obtained by solving a corresponding exact system and numericizing the result.
Out[]=
0.547968
Compute the fraction of remaining votes in Pennsylvania that Biden would need to win the state by a 1% margin (using data on the CNN website at
Thu 5 Nov 2020 16:43:39GMT-6.
) and silence the error:
In[]:=
Quiet@BidenFraction["Trump"3247808,"Biden"3157266,0.93,0.01]
Out[]=
0.665332
In[]:=

Applications

The estimates for the number of votes cast could be incorrect. Plot the fraction of remaining votes Biden needs to win in Pennsylvania by 0% and by 1% given varying estimates as the fraction of votes already cast:
In[]:=
Legended[Apply[Show][Table[Plot[Quiet@BidenFraction["Trump"3247808,"Biden"3157266,cast,(m-1)*.005],{cast,0.85,0.99},AxesFalse,FrameTrue,FrameLabel{"fraction of votes already cast","Biden fraction"},PlotStyleColorData[98][m]],{m,1,5}]​​],LineLegend[ColorData[98][#]&/@Range[5],Range[0,0.025,0.005],LegendLabel"Biden victory margin"]]
Out[]=
Biden victory margin
0.
0.005
0.01
0.015
0.02

Code for BidenVictory FormPage

fp=FormPage{{"Trump","Trump votes so far"}Number,{"Biden","Biden votes so far"}Number,{"Fraction Cast","Fraction of ultimate votes already cast\n(enter as a decimal like 0.93)"}Restricted["Number",{0,1}],{"Margin","Percentage of Biden victory you require\n(enter as a decimal like 0.005; default is 0)"}Number0},If[#Margin0,StringTemplate["Joe Biden will win if he obtains at least `1` of the votes remaining to be cast"],​​StringTemplate["Joe Biden will win by a margin of at least `2` if he obtains at least `1` of the votes remaining to be cast"]]RoundQuiet@
[◼]
BidenFraction
[Association["Trump"#Trump,"Biden"#Biden],#"Fraction Cast",#Margin],0.0001,#Margin&,PageTheme"Blue",AppearanceRulesAssociation["Title""What fraction of uncounted votes does Biden need?","Description""By Seth J. Chandler"]
Out[]=
What fraction of uncounted votes does Biden need?
By Seth J. Chandler
Trump votes so far
​
Biden votes so far
​
Fraction of ultimate votes already cast
(enter as a decimal like 0.93)
​
Percentage of Biden victory you require
(enter as a decimal like 0.005; default is 0)
​
OK
In[]:=
CloudDeploy[fp,"BidenVictoryCalculator"]