Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ π -¹ ² ³ °

You are not logged in.

- Topics: Active | Unanswered

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 3,941

Hi Bobby,

I used similar to this:

bobbym wrote:

He wins half of it or loses half of it. The arithmetic was done after each toss using a TI - 92. at the end they decided on the rounding.

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,535

Hi;

**In mathematics, you don't understand things. You just get used to them.**

**I agree with you regarding the satisfaction and importance of actually computing some numbers. I can't tell you how often I see time and money wasted because someone didn't bother to run the numbers.**

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 3,941

Hi Bobby,

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,535

Hi;

**In mathematics, you don't understand things. You just get used to them.**

**I agree with you regarding the satisfaction and importance of actually computing some numbers. I can't tell you how often I see time and money wasted because someone didn't bother to run the numbers.**

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 3,941

Hi Bobby,

Thanks for that...saw it after typing this, which I'll post anyway. Our conclusions are the same.

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 3,941

And thanks too for the code.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,535

Hi;

Okay, by the way I use a different formula that I made myself but I never noticed the connection with the interest formula.

**In mathematics, you don't understand things. You just get used to them.**

**I agree with you regarding the satisfaction and importance of actually computing some numbers. I can't tell you how often I see time and money wasted because someone didn't bother to run the numbers.**

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 3,941

Would you like to show me? Or at least give me a clue as to which direction I should head in if I want to go it alone...in which case I wouldn't look at your code - if you do post it - until I collapse from mental exhaustion after trying unsuccessfully to make my own code.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,535

**In mathematics, you don't understand things. You just get used to them.**

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 3,941

Hi Bobby,

*Last edited by phrontister (2013-06-13 04:15:36)*

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,535

Hi;

I will post the function that you just have to plug in the numbers. If you like it you can use it, if not you can use your own. Meanwhile, have a good night.

**In mathematics, you don't understand things. You just get used to them.**

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 3,941

Hi Bobby,

Thanks for the code, but I'm sorry, I don't know how to run it. I tried a few things but I don't understand what I'm doing and got nowhere. Could you please help me understand the code and let me know how to get it to work?

Meanwhile, I came up with my own code (very different from yours!) that gave the right answer for most ( ) of what I threw at it. I tested it on quite a range of numbers, in particular those whose fractional part was very close to zero or 0.5: eg,

432.98 (input 433) @ 28 tosses = 9 losses;

3.01 (input 3) @ 32 tosses = 15 losses;

28.51 (input 29) @ 24 tosses = 10 losses;

13.90 (input 14) @ 71 tosses = 69 losses (correct answer is 28, but the 4th element of b was less than the 28th and gave that odd result).

As you can see, I had trouble isolating the answer from the table produced by the compound interest formula. My idea was that the answer should be the number of tosses less the element closest to an integer. I know now that will lead to some errors, but I haven't found the solution to that. Maybe it doesn't exist with my compound interest formula and inputting a rounded integer for the payout.

I tried to plug the hole that was letting some bogus answers through with *Select *in *a*, and that did shut the door on some errors, but not all.

*Last edited by phrontister (2013-06-13 18:45:01)*

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,535

Hi phrontister;

Do you want an example of it s usage?

**In mathematics, you don't understand things. You just get used to them.**

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 3,941

Yes please!

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,535

Hi;

**In mathematics, you don't understand things. You just get used to them.**

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 3,941

Thanks, Bobby...that works well.

I'd probably do it like this (my preference to get the prompt for when inputting a number of scenarios):

However, that gives the final payout sum, which isn't what I've been struggling with. I've been trying to find a formula that gives the number of losses from these known facts:

1. Starting sum in pocket

2. Percentage bet

3. Number of tosses (ie, total of winning and losing tosses) before Mad Archil calls the game off.

4. Final payout (rounded integer).

Given the rounded payout and the volatile nature of the different scenarios, I suspect that writing this up to cater for every scenario may be difficult.

My code from post #1812 nearly gets there, but occasionally a rogue result sneaks through.

*Last edited by phrontister (2013-06-14 16:30:26)*

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,535

Hi;

It is rule 4 that is causing the trouble. I do not think that you will find a trick that will work every time.

**In mathematics, you don't understand things. You just get used to them.**

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 3,941

Yes...I thought as much. Time to give up on it, I reckon, disappointing as that may be. Tea time for me now.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,535

Hi;

There is no reason not to use what you have there in post #812. You can quickly check the answer using the exact formula.

**In mathematics, you don't understand things. You just get used to them.**

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 3,941

True. I'll have to settle for including that check if it can't all be done in one go. Thanks again for your help...I've learnt some more.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,535

Hi;

You are a fast learner. I am very impressed with that.

**In mathematics, you don't understand things. You just get used to them.**

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 3,941

M's help files are excellent, and if I get stuck I widen my research on the www or ask you. There's usually an answer tucked away somewhere, but often not in terms I understand and that slows down progress.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,535

I'll say it does! Teaching yourself is about the hardest thing I have ever tried to do. That is why I joined here, I learn something every day.

**In mathematics, you don't understand things. You just get used to them.**

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 3,941

Yes, me too. I'm glad I found MIF...I've learnt a lot here and am enjoying the experience.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,535

How did you find the place?

**In mathematics, you don't understand things. You just get used to them.**

Offline