A friend of yours proposes a game: if you correctly guess the amount of money in his wallet, the cash is yours; otherwise, you get nothing. You're allowed a single guess.
You believe there's a 50 percent chance your friend has $0 in his wallet, a 25 percent chance of $1, 24 percent of $100 and — excitingly — a one percent chance he has $1,000.
What dollar amount should you guess in order to maximize your expected winnings?
You can argue like this: suppose that you take a guess N times with N approaching infinity, and you must always guess the same amount. What would you earn if your constant guess was $1? [There is no point betting $0.] Well, 25% of the time you would win, so your earnings would be 0.25*N*($1) = $(0.25*N).
Likewise, if your guess was $100 you would win 24% of the time, so your earnings would be 0.24*N*($100) = $(24*N), and if your guess was $1000 you would win 1% of the time, yielding 0.01*N*($1000) = $(10*N).
So, the guess which maximizes the earnings (in the sense described) is $100.
Related
I feel like my brain is just not working...
In my scenario, I want to calculate how much bonusDamage a player should be doing!
the minimumBonusDamage is 0
the maximumBonusDamage is 20 ( for this moment )
if we get a random float a between 0 and 1, representing chance of winning...
I drew it on paper and decided:
that to win 20 bonus damage is 5% chance = 0.05f
that to win 10 bonus damage is 10% chance = 0.1f
that to win 5 bonus damage is 25% chance is 0.25f
that to win 0 bonus damage is 100% chance.
As you can see, it is a curved slope, where to win the higher bonus damages of 19... is much more rare than winning a bonus damage of 1 or 2.
I am imaging the best solution is to iterate from the more rare to the most common.
I guess that part of my problem is calculating the slope of the percentage win?? and then determining what the damage should be...How would you do it? Do I even need a For-Loop?
I tried several, things but I know there is an intelligent way to think about this but I am brain-farting.
Suppose, I have a pen, which initially cost 0 $, now it costs 20$.
What is the increment percentage?
Ideally, it will cause the divide by zero exception.
There are things which happen practically first and they are made part of study. Then, there are things which are believed, experimented with, and set in theory and later proven practically. Mathematics deals with both of them. This is a mathematical question, not astronomical. This is not a planetary distance calculation whose actual value is unknown and even current value is unknown. It's not like part of unknown is unknown, but which part, nobody knows.
A pen does exist. It is not virtual. It costs nothing. Why? May have been free with something, but it does have an actual price which is not known. So, there is a definite price increase from 0 $ to 20 $. That means, 20 - 0 is the increase.
You cannot divide ultimately by 0 because you cannot divide 20 into any number of fragments of 0. So, 0 raise to power n will always remain 0 and never reach 20.
Infinity hence cannot be the answer as well since 0^infinity is zero. That is why, in such cases, you can accept the numerator and denominator can be set to 1, to replace the unknown actual price of the pen.
Dividing by zero is infinity, so in such questions which need definitive calculation and not infinity answer, 0 is changed to 1 for division, not for subtraction, to let the numerator decide the increase factor. Infinity is convenience here, not the answer. The earlier actual price of the pen is indeterminate, so you cannot divide by it.
So, denominator can be treated as Case number WHEN 0 THEN 1 ELSE number. So, it will be ((20-0) * 100)/1 = 2000%. So, price has raised by 2000% for the end consumer of the pen.
How You find increment percentage if its initial cost is zero? it should be greater than zero
For example
initial cost 10
New cost 20
then
(20-10)/10 *100
So
100 % is increment %
The increment percentage is undefined because you can't divide by zero.
The formula is (new-old)/old and this turns into 20/0
I'm writing a bank simulation program and I'm trying to find that percent to know how fast to program a new person coming in based on a timer that executes code every second. Sorry if it sounds kinda confusing, but I appreciate any help!
If you need to generate a new person entity every 2-6 seconds, why not generate a random number between 2 and 6, and set the timer to wait that amount of time. When the timer expires, generate the new customer.
However, if you really want the equivalent probability, you can get it by asking what it represents: the stochastic experiment is "at any given second of the clock, what is proability of a client entering, such that it will result in one client every 2-6 seconds?". Pick a specific incidence: say one client every 2 seconds. If on average you get 1 client every 2 seconds, then clearly the probability of getting a client at any given second is 1/2. If on average you get 1 client every 6 seconds, the probability of getting a client at any given second is 1/6.
The Poisson distribution gives the probability of observing k independant events in a period for which the average number of events is λ
P(k) = λk e-λ / k!
This covers the case of more than one customer arriving at the same time.
The easiest way to generate Poisson distributed random numbers is to repeatedly draw from the exponential distribution, which yields the waiting time for the next event, until the total time exceeds the period.
int k = 0;
double t = 0.0;
while(t<period)
{
t += -log(1.0-rnd())/lambda;
if(t<period) ++k;
}
where rnd returns a uniform random number between 0 and (strictly less than) 1, period is the number of seconds and lambda is the average number of arrivals per second (or, as noted in the previous answer, 1 divided by the average number of seconds between arrivals).
Im looking to create a ranking system for users on a gaming site.
The system should be based of a weighted win percentage with the weighted element being the number of games played.
For instance:
55 wins and 2 losses = 96% win percentage
1 win and 0 losses = 100% win percentage
The first record should rank higher because they have a higher number of wins.
I'm sure the math is super simple, I just can't wrap my head around it. Can anyone help?
ELO is more thorough because it considers opponent strength when scoring a win or loss, but if opponents are randomly matched a simple and very effect approach is:
(Wins + constant * Average Win % of all players) / (Wins + Losses + constant)
so with 0 games the formula is the average for all players, as you increase the number of games played the formula converges on the actual record. The constant determines how quickly it does this and you can probably get away with choosing something between 5 and 20.
Yes, it is "super simple":
Percentage = Wins * 100.0 / (Wins + Losses)
To round to an integer you usually use round or Math.round (but you didn't specify a programming language).
The value could be weighted on the number of wins, using the given ratio:
Rank = Wins * Wins / (Wins + Losses)
But there are other systems that understand the problem better, like Elo (see my comment).
Another possibility would be my answer to How should I order these “helpful” scores?. Basically, use the number of wins to determine the range of likely possibilities for the probability that the player win a game, then take the lower end. This makes 55-2 beat 1-0 for any reasonable choice of the confidence level. (Lacking a reason to do otherwise, I'd suggest setting that to 50% -- see the post for the details, which are actually very simple.)
As a small technical aside: I've seen some suggestions to use the Wald interval rather than Agresti-Coull. Practically, they give the same results for large inputs. But there are good reasons to prefer Agresti-Coull if the number of games might be small. (By the way, I came up with this idea on my own—though surely I was not the first—and only later found that it was somewhat standard.)
How about score = (points per win) * (number of wins) + (points per loss) * (number of losses), where points per win is some positive number and points per loss is some negative number, chosen to work well for you application.
I have a program which records events that occur with some probability p. After I run it I get k events recorded. How can I calculate how many events there were, recorded or not, with some confidence, say 95%?
So for example, after getting 13 events recorded I would like to be able to calculate that there were between 13 and 19 events total with 95% confidence.
I'm pretty sure your process is the same as a binomial process - the probability p of an event being recorded can be considered a success. I don't think there's a need to elaborate further on the underlying process.
The twist in your problem is that you don't know the value of n, only k and p. Confidence interval calculations typically assume you know n & p and you want a confidence interval around k, the number of successes. See here.
Given k and p, you should be able to determine the probabiilty distribution of n, q(n), then create a distribution of k given known p and q(n). This distribution of k will yield a confidence interval, right?
If p is between 0 and 1:
(1/p) * k = typical number of actual events
If your random() is PERFECT, it will ALWAYS be true. However, this is not usually the case.
For a LARGE k (the larger, the more accurate the result base don percentage off) it will be CLOSE to the actual number, though it is doubtful that it will hit it exactly.
The problem with your statement is that you are saying there is a know probablitiy of the event. If that is know and you know how many events you saw there is no error in how many events there were. Do you know how many recordings there were?
I think you need to reframe the way you are asking the question or try to estimate something different.
Or are you saying your recording only happens 60% of the time when a true event happens. What is it you are measuring and what constitutes an event. An analogy would be ok - but the way it is formulated now there is no way to construct a confidence interval on the true number of events.
Here is the answer that Andrew Walker gave on the stats site. I am going to accept this as the answer to this question. Thanks to everyone.