Dan W
Reputation
Top tag
Next privilege 250 Rep.
 Apr 25 comment How can I rearrange this logarithmic formula to be computer friendly? @Pockets: The C# Decimal type doesn't support log(). Also, yes I need higher than 10^28. But perhaps most importantly to asking here, I was curious if the expression itself could be mathematically reformulated to say the same, but without the 1- bit. That's not a programming question any more. Apr 25 accepted How can I rearrange this logarithmic formula to be computer friendly? Apr 24 comment How can I rearrange this logarithmic formula to be computer friendly? @Ian: Gotcha - sounds good. I just checked the link you provided, and it seems like an imperfect, but workable solution. I'm still curious if there's a more exact elegant answer though, but feel free to add it as an answer, and I'll at least upvote it for now. Here's some talk about the issue. Apr 24 comment How can I rearrange this logarithmic formula to be computer friendly? @Ian: Thinking about it, even log1p(x) wouldn't work as the number 0.999999....(17 times) can't be stored into x in the first place. Apr 24 comment How can I rearrange this logarithmic formula to be computer friendly? @Winther: Exactly. I want to avoid the 1- bit altogether if possible as that's what's causing the problem. Question is how... Apr 24 comment How can I rearrange this logarithmic formula to be computer friendly? @Ian: Alas the log1p function doesn't exist in C#. Apr 24 comment How can I rearrange this logarithmic formula to be computer friendly? @copper.hat: Good point. It's a bit of a hack though, and I think the error grows exponentially for deeper and deeper magnitudes. Apr 24 comment How can I rearrange this logarithmic formula to be computer friendly? @user1952009: It's not that $ln(b)$ is too small, but that the computer can't hold $0.99999999999999999$ (17 nines) as a number in memory for it to calculate the log in the first place. Apr 24 revised How can I rearrange this logarithmic formula to be computer friendly? added 146 characters in body Apr 24 comment How can I rearrange this logarithmic formula to be computer friendly? @user1952009: Yes, I tried that. I still get NaN unfortunately. Apr 24 revised How can I rearrange this logarithmic formula to be computer friendly? added 30 characters in body Apr 24 revised How can I rearrange this logarithmic formula to be computer friendly? added 73 characters in body Apr 24 comment How can I rearrange this logarithmic formula to be computer friendly? @copper.hat: Literally like Math.Log(1 - a, 1 - b) (C# code). Apr 24 asked How can I rearrange this logarithmic formula to be computer friendly? Feb 15 awarded Popular Question Nov 27 awarded Curious Sep 29 comment Expected travel of random walk in arbitrary game with multiple payouts @ColmBhandal: Okay done! Sep 29 revised Expected travel of random walk in arbitrary game with multiple payouts added 418 characters in body Sep 25 comment Expected travel of random walk in arbitrary game with multiple payouts Sure. Here you go: pastebin.com/985eDTFh - Don't worry about the size - three quarters of it is code for a fast random class I pinched from Stackoverflow. You can use the default Random class if you prefer. Also, if you're not using C#, don't worry too much about converting the convertCSVtoPayoutTable() function as you can hard code the probability and payout arrays yourself if you prefer. Sep 25 comment Expected travel of random walk in arbitrary game with multiple payouts Aha, yes I get roughly around 9.38-9.4 after simulating 10M 'universes' (which you call experiments). Let me know if you'd like the code (it's in C# but is easily transferable to other languages).