[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Sup /sci/, I usually hang out on /g/ but this one fits this board
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /sci/ - Science & Math

Thread replies: 23
Thread images: 7
File: fungraph10.gif (4 KB, 319x300) Image search: [Google]
fungraph10.gif
4 KB, 319x300
Sup /sci/,
I usually hang out on /g/ but this one fits this board better.

I'm working on a gambling type website and I need some help with calculating win probabilities fluidly.

I want to average 10% hold.

Given a random number between let's say 0 and 100, I want the equation to return me a win value with the constraint being: the sum of all winnings times their probability must be 0.9 as to give me 10% hold.

So, winning nothing, or less than 1 would have to be more likely than winning 100.

I imagine the curve must look something like pic related, but I wonder about how to math this.

Thank you
>>
File: index.jpg (118 KB, 1200x1600) Image search: [Google]
index.jpg
118 KB, 1200x1600
correction.

What I need looks more like this

With

f(0)=-1

and [ sum n=0; 100 | f(n) ] = 0.9
>>
I want a share of your revenues from that website.
>>
File: IMG_20160613_150028927.jpg (2 MB, 4160x2340) Image search: [Google]
IMG_20160613_150028927.jpg
2 MB, 4160x2340
>>8140026
You sure?

Your OP makes it sound like you want something like this.
>>
>>8140049
I'm not sure..

I want the function to return the number I have to multiply the bet with.

User bets 10
Function says 0.5
User gets 5

with the AVERAGE value being 0.9 over the defined area of random inputs
>>
>>8140049
stop helping for free you fucking faggot.
why do you think stemfags never make money? Because they're so retarded they give their help for free to people who actually can make money.
They studied what they liked, and they use you to do what they don't know how to do.
>>
>>8140062
Is "value" the number the user gets or what the function says?
>>
>>8140077
Sorry.
The average value returned by the function should be 0.9 (In the space between x=0 and a defined upper border).
This way there's a 10% hold.

user_bet * winfunction ( rnd_value ) would be the calculation for the winnings. In this case, the average should be user_bet * 0.9.


My second picture is crap.

>>8140069
Stop wasting your time and go make money if that's what you care about. It's not like I was going to spend millions in the stem field if no one helped me here.
>>
>>8140083
OK and presumably there should be some circumstances that users get a net positive return? Otherwise no one would take the bet.

i.e. some values of the function should be more than 1
>>
>>8140086
Exactly.
Big chance to get a bit less than your money (<1)

Smaller chance to get a bit more than your money (>1)
>>
>>8140083
you could get sued for part of your shit because using someone's work will be considered as a contribution in nature to your business.
>>
File: IMG_20160613_161740923.jpg (2 MB, 4160x2340) Image search: [Google]
IMG_20160613_161740923.jpg
2 MB, 4160x2340
>>8140088
Something like this? It's continuous not discrete, idk if that's an issue.

You've got two free variables so you can fiddle them about to fit any other constraints you may have.
>>
>>8140145
Thank you, I will see what I can do with it. I'm having problems getting wolframalpha to understand what I want it to do.

A friend of mine has fired up mathematica and is fiddling around at the moment. I've sent him your picture, he's got a better understanding of maths.

My 2 other constraints are
f(0)=0 and f(100)=50
to get a maximum win of 50x the bet.


I have something that satisfies the constraints but the curve looks like this...
>>
>>8140176
Turns out this is on a log scale.

This is what the graph looks like otherwise
>>
File: IMG_20160613_171505997.jpg (2 MB, 4160x2340) Image search: [Google]
IMG_20160613_171505997.jpg
2 MB, 4160x2340
>>8140176
Looks pretty linear, a truly evil gambling site would probably skew it to the right so there are less possible wins.

Could either be polynomial or exponential. You could fit both of these to the constraints.
>>
>>8140178
>>8140192
Oh wait

Yeah, looks like what I said.
>>
>>8140178
>>8140195
Could still try the polynomial approach though.
>>
>>8140201


[code]
var b=55.7;
var a=50/(Math.exp(b)-1);
var sum=0;


for (var i = 0; i<10 ; i++){
var r= f(a,b,Math.random());
console.log(r);
}

function f(a,b,x){
return Math.round(a*(Math.exp(b*x)-1)*100)/100;
}
[/code]

This works out to ~ 0.9 hold, but I don't like the way it plays. You get all 0's and then once in a while you get 20 or 25.

There's too little small winnings and too many big ones.
>>
>>8140207
Try f(x) = Ax^b, might have less of a sharp increase.
>>
>>8140209
Not that anon but I've been working on this. I couldn't solve for the particular solution for the exponential because I don't have enough computing power, but when I found A and b for the polynomial I got b=555553 and A=500000/100^(555555)~0. It works with the conditions you wanted but it has an extremely steep slope and I think the exponential would lead to a better distribution.
>>
>>8140225
I'm going to do some pre-sorting now to get a prettier distribution.

20% of people will get nothing.
60% of people get a consolation price of ~50% their bet
20% of people get on average 3 times their bet

I will only use the exponential function to calculate the last 20%. This way you get little wins quite often and big wins not so often.

Updated constraints now are
f(0) = 1.5 (if you are in the lucky 20%, you get at least 1.5 times your bet)
f(1) = 50
avg : 3
>>
>>8140069
>stop helping for free you fucking faggot.
I agree with this anon. If op needs help making a website he should pay someone or figure it our himself.
>>
>>8140265
Help4free
Thread replies: 23
Thread images: 7

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.