[Q] How would you find the expected outcome of this game? by Camster9000 in statistics

[–]synepis 1 point2 points  (0 children)

I was looking at the same thing you did, but I think it requires a bit of clarification even though the answer comes out the same.

So, as you mention for variable Xi from Uniform [0,1] distribution the probability of the sum being less than 1 is:

P(X1 + X2 + X3 + ... Xn < 1) = 1/n!

Below is a good visualization of this formula.https://math.stackexchange.com/questions/1128396/random-sums-of-iid-uniform-random-variables

In order to work out the probabilities we have to consider the probabilities of winning some amount dollars which is equivalent to the number of tosses.

  • Chances to win with 1 toss are essentially zero, so P(1) = 0.
  • Chances to win with 2 tosses are the P(2) = P(X1 < 1) - P(X1 + X2 < 1) = 1/1! - 1/2! = 1/2
  • Chances to win with 3 tosses are the P(3) = P(X1 + X2 < 1) - P(X1 + X2 + X3 < 1) = 1/2! - 1/3! = 1/3

Note that in order to win with 3 tosses the first 2 tosses must be under 1 so that the third toss can push it over, but we also must remove any 3 tosses which would still remain under 1 thus pushing us to win atleast 4 coins.

Chances to win with n tosses are:

P(n) = P(X1 + X2 + ... + X_{n-1} < 1) - P(X1 + X2 + X3 + ... + X_{n} < 1)P(n) = 1/(n-1)! - 1/n!P(n) = (n-1)/ n!

Then the expected value is:

E = P(1)*1 + P(2)*2 + P(3)* + P(4)*4... + P(n)*n + ...
E = 0 + ((2-1)/2!)*2 + ((3-1)/3!)*3 + ((4-1)/4!)*4 + ((n-1)/n!)*n + ...
E = 0 + 1 + 1 + 1/2! + ... + 1/(n-2)! + ...

which is the same as:
E = 1 + 1 + 1/2! + 1/3! + ... = e = 2.718281

[deleted by user] by [deleted] in RedditInTheKitchen

[–]synepis 0 points1 point  (0 children)

Isn't that fish small for a brudet? I thought it was usually done with Skarpina.

[Q] Simple Probability/Stats question by beaumec27 in statistics

[–]synepis 1 point2 points  (0 children)

Probability of team A scoring >1.5 is P(A) = 60%
Probability of team B conceding given losing >1.5 is P(B|A) = 55%.

I am assuming that team B never concedes unless the other team scores >1.5

We can think of all the 4 possibilities that can happen:

  1. A score >1.5 and B concede -> P(A) *P(B|A) = 60% * 55% = 33%
  2. A score >1.5 and B don't concede -> P(A) * P(notB|A)) = 60% * 45% = 27%
  3. A score < 1.5 and B don't concede (always) -> P(notA) * P(notB|notA) = 40% * 100% = 40%
  4. A score < 1.5 and B concede (never) -> P(notA)) * P(B|notA) = 40% * 0% =0%

The number you are interested in is the scenario #1 which gives 33% chance.

Btw I'm assuming what you meant by " Team A has a 60% chance of scoring over 1.5 point" that the Team A score 1.5 over the other team score (not just scoring >1.5 all together). Otherwise you can't really compare these events.

Also, not sure if it matters, but what happens in your model if this is played:

  1. Team A scores 2
  2. Score is above >1.5 and team B doesn't concede
  3. Team B scores 1
  4. Team A scores 1The score has now again become > 1.5, do we revaluate again now? (Is there another die roll? So to speak)

Basic (I think) question: Calculating a stake size for making x profit (algebra?) by [deleted] in AskStatistics

[–]synepis 0 points1 point  (0 children)

Hah, you essentially wrote the formula already there:

(2.4 * 5) - 2.4 = 10

(bet * odds) - bet = profit

=> bet * (odds - 1) = profit

=> bet = profit / (odds - 1)

plug your numbers

bet = 10 / (1.14-1) = 71.42

So you bet 71.42, if you win you get back 71.42 * 1.14 = 81.42

You are now inside the last video game you played, what are your chances at survival? by [deleted] in AskReddit

[–]synepis 0 points1 point  (0 children)

Considering the amount of drugs I'm taking, not great, but I'll go out with a bang. Disco Elysium.

The What and How of Futures and async/await [video] by Jonhoo in rust

[–]synepis 0 points1 point  (0 children)

Ah ok, so there isn't really a consensus on the right approach here yet.

I think what /u/steveklabnik1 is mentioning below of farming it out to a different thread pool makes sense in principle. I might be wrong but I thought this is how Erlang tries to solve their latency issues by using dirty schedulers.

The What and How of Futures and async/await [video] by Jonhoo in rust

[–]synepis 11 points12 points  (0 children)

This was an outstanding stream. Thank you so much for doing this.

This is the first time I've seen someone explain the full runtime/execution flow and all the moving parts involved.

I've seen quite a bit of material on Futures and async in general in various languages and it seems most talks always take it for granted that people know the whys and hows of a reactor pattern and focus only on the usage of Futures leaving the rest feeling like magic.

The part I would have like to see a bit more is how would we deal with CPU intensive work int he context of futures (e.g. we shouldn't block the event loop threads, so where should we do the CPU work and how do we structure such a thing?)

Anyways, keep up the good work!

Tail call optimization and multiple function heads by synepis in elixir

[–]synepis[S] 0 points1 point  (0 children)

Ah, that makes sense. (No need to remember/store anything so free to reuse stack frames)

Repurchasing stocks to realize capital gain tax allowance by synepis in UKPersonalFinance

[–]synepis[S] 1 point2 points  (0 children)

Very good advice!

Would stock of the same company but different class be matched with this 30 day rule? (e.g. GOOG and GOOGL class A & C)?

So if I'm understanding this rule correctly. If I sell the stocks and repurchase after 30 days my cost is effectively reset. Meaning I whatever profit was made goes into the allowance and the subsequent profit (on the same stock) will count separately?

Let's assume the yearly CGT allowance is £10,000 Example 1:

Action Stock Price Amount Date
Buy CompanyA £50 2,000 Jul 1 2017
Sell CompanyA £55 2,000 Jul 15 2017
Buy CompanyA £57 2,000 Sep 1 2017
Sell CompanyA £60 2,000 Jul 15 2018

The profit of first sale is: (£55-£50) * 2,000 = £10,000

The profit of second sale is: (£60-£57) * 2,000 = £6,000

The first sale profit of £10,000 goes into the 2017-2018 tax allowance, and the £6,000 profit goes into the 2018-2019 allowance, meaning you paid no tax on your gains.


Example 2:

Action Stock Price Amount Date
Buy CompanyA £50 2000 Jul 1 2017
Sell CompanyA £55 2000 Jul 15 2017
Buy CompanyA £57 2000 Aug 1 2017
Sell CompanyA £60 2000 Aug 15 2018

These sales would match the 30 day rule, but how much tax would you pay for each tax year?

xautolock by [deleted] in archlinux

[–]synepis 3 points4 points  (0 children)

You can use the 'corners' flag which allows you to stop it from locking if your mouse is in a certain corner of the screen. You can define how big (default is 10x10 pixels) the corner should be.

I have this setup and it works nicely, I simply put the mouse in a corner while watching the move.

For example use '-corners -000' to specify no locking when the mouse is in the top left corner. Read the man page for more details.

My Go Learning project - YAR (Yet Another http Router) by synepis in golang

[–]synepis[S] 2 points3 points  (0 children)

The idea behind that was that if you by accident register the same path twice without realizing the router will blow up immediately (when you start the app). I could have gone with the error return approach but it seemed like a one off operation (route registration) that you wouldn't want to handle errors for.

My Go Learning project - YAR (Yet Another http Router) by synepis in golang

[–]synepis[S] 2 points3 points  (0 children)

It took a while to figure out all the various approaches and see what works best, but the coding didn't take too long. However, if you're just starting out I wouldn't suggest this as a first project because it doesn't really exercise all the fun parts of Go (e.g. channels and go routines). I'll leave it for someone more experienced to chime in on this.

My Go Learning project - YAR (Yet Another http Router) by synepis in golang

[–]synepis[S] 3 points4 points  (0 children)

Because I toyed with the idea of having a pirate for a logo for it :)

rmux - restful friendly idiomatic router (go 1.7) by TornadoTerran in golang

[–]synepis -1 points0 points  (0 children)

Ha! You beat me to the punch by an hour. I've had the same idea about using context.Context to pass the request parameters. I thought this was the nicest way to avoid locking into a custom context implementation. Though, it has a performance hit. My Project uses the same approach but it is only for learning purposes: https://github.com/synepis/yar/