Two Plus Two Newer Archives  

Go Back   Two Plus Two Newer Archives > General Gambling > Probability
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-17-2006, 06:17 PM
PrayingMantis PrayingMantis is offline
Senior Member
 
Join Date: Nov 2003
Location: some war zone
Posts: 2,443
Default Suitable programming language

I'd like to learn a programming language that will allow me to write my own simulations for all kinds of math/probability problems that interest me. I don't have much of a knowledge or education in the programming field, but am a very fast (self) learner. It isn't meant to serve me on the job market or anything, but more like a fun/challenging thing. What would you recommend?
Reply With Quote
  #2  
Old 10-17-2006, 09:55 PM
SumZero SumZero is offline
Senior Member
 
Join Date: Jul 2004
Location: South SF bay area, Califonia
Posts: 1,223
Default Re: Suitable programming language

[ QUOTE ]
I'd like to learn a programming language that will allow me to write my own simulations for all kinds of math/probability problems that interest me. I don't have much of a knowledge or education in the programming field, but am a very fast (self) learner. It isn't meant to serve me on the job market or anything, but more like a fun/challenging thing. What would you recommend?

[/ QUOTE ]

I think perl is a decent quick and dirty language that can be useful for lots of small tasks that may be used in simulations.

Recently I've been learning python for this stuff both because python is a popular language amongst smart folks and because python offers excellent treatment of large numbers and what not that can be involved in big calculations.

Both languages have pretty extensive online examples and sample code that does a bunch of common tasks that can be useful both to do the tasks and to learn the language.
Reply With Quote
  #3  
Old 10-18-2006, 04:08 AM
Siegmund Siegmund is offline
Senior Member
 
Join Date: Feb 2005
Posts: 1,850
Default Re: Suitable programming language

There is one compelling argument against perl and python: for simulations and exhaustive enumerations, speed matters. There is a reason to pick a compiled language, any compiled language.

Beyond that, I would suggest your choice is based more on what type of problems you have in mind.

C is fast, free versions are available, and lots of code libraries are available - but the learning curve is exceptionally steep and you're liable to get frustrated.

Visual Basic is capable of nice fancy front ends, buttons and menus and mouse interaction and all, but whether that's a feature or a flaw depends whether you WANT that. If ALL you want is a simulation program to spit out an answer into a text file, this is not the way to go. If, on the other hand, you've always wanted to build cute little mini-Windows programs, this is the easiest way to do that. Another strike against VB is that it's not a leading science/math language so it isn't going to have many built-in functions or libraries to help you with simulation code, though it will have all sorts of business applications, custom form designs, and such available.

Visual C++ will have the same "Visual" feature/flaws as VB, the same learning curve feature/flaws as C, but an abundance of libraries.

Another alternative is to get something like Mathematica that is only secondarily a programming language, but has a huge array of mathematics- and statistics-specific built-in functions and free code snippets. It requires some prodding to make Mathematica compile before executing but can be done. Don't choose this route if you "want to learn to program," but do choose this route if you also want to play around with extremely high precision arithmetic without special libraries, draw plots of your data without having to write extra code to do so (this is a real pain in VB or C - usually you export the data into a graphics program and then create the graphs separately instead), and so on.

Bottom line is that any language you choose will be *capable* of doing the simulations - your choice of language is going to depend entirely on outside considerations like what else you want to use your new programming skills for and who you want to share your programs with.
Reply With Quote
  #4  
Old 10-18-2006, 06:58 AM
PrayingMantis PrayingMantis is offline
Senior Member
 
Join Date: Nov 2003
Location: some war zone
Posts: 2,443
Default Re: Suitable programming language

[ QUOTE ]
There is one compelling argument against perl and python: for simulations and exhaustive enumerations, speed matters. There is a reason to pick a compiled language, any compiled language.

[/ QUOTE ]

Can you please elaborate on what exactly do you mean by "speed matters"? If I remember correctly, many people who were doing simulations on the sit&go forum for instance were doing it with pearl. I could be wrong tho.

Also, why isn't Mathematica an option if "I want to learn to program"? Is it because it's too tough to start with, or simply because it's a secondary language and as such I wouldn't be really learning to program? I am not as much as interested in learning a program per se but more in creating simulations, as comfortably as possible, like I've said.

As a simple example, let's say I want to write something that will do exactly what twodimes.net does, what is my best option?

Also, I'd say that the ability to draw plots of my data would definitely be a plus.
Reply With Quote
  #5  
Old 10-18-2006, 08:30 AM
Tiki Tiki is offline
Senior Member
 
Join Date: Aug 2006
Location: A fugitive from the Law of Averages..
Posts: 329
Default Re: Suitable programming language

Never used mathematica but Matlab is a great and easy to use secondary programming language.

C/C++ is great. I taught myself using a free compiler. If you Google 'Bloodshed C++' you can easily download and see for yourself. Plenty of on-line tutorials too.

I am not a proper coder but my C++ code ran at 40X the speed of the Matlab code. However, Matlab is about 40X more easy to learn.

Necessity is the mother of fluency. Good luck.
Reply With Quote
  #6  
Old 10-18-2006, 11:24 AM
Red_Diamond Red_Diamond is offline
Senior Member
 
Join Date: Nov 2005
Posts: 567
Default Re: Suitable programming language

I do most my stuff now in java now just so I can run it without problems on boht my unix & winblows boxes. The other benefit is mac users aren't left in the dark.

If I have serious numbers to crunch on it, I can always compile it to native for a speed boost.
Reply With Quote
  #7  
Old 10-18-2006, 02:51 PM
uDevil uDevil is offline
Senior Member
 
Join Date: Jul 2003
Location: Cloudless climes and starry skies.
Posts: 2,490
Default Re: Suitable programming language

[ QUOTE ]
I'd like to learn a programming language that will allow me to write my own simulations for all kinds of math/probability problems that interest me. I don't have much of a knowledge or education in the programming field, but am a very fast (self) learner. It isn't meant to serve me on the job market or anything, but more like a fun/challenging thing. What would you recommend?

[/ QUOTE ]

There is free poker related code in C available at sourceforge. C has speed advantages. It isn't that difficult to learn. The GNU compiler is free.

Python is interesting and may be easiest for a beginning programmer to learn. It is an interpreted language, which makes it slow, but if you reach a point where this becomes an issue, you can incorporate C or Java to speed things up where needed.

I like Java because it gives me a lot of flexibility, including relatively simple to construct GUIs and the ability to make programs available on the web. There are free IDEs available. There is a lot of information on the web including poker related code.

You can find basic information about any programming language you may be interested in at http://www.wikipedia.org

I have some simple program examples are on my poker page, if you're interested. There is a Perl CGI script, a script in Javascript, and a Java applet.

I think any of the languages mentioned in this thread would be fine to start with. Once you learn one language, other languages are easier to learn, so if you find that your first choice isn't working for some task, your efforts aren't wasted.
Reply With Quote
  #8  
Old 10-18-2006, 04:43 PM
AaronBrown AaronBrown is offline
Senior Member
 
Join Date: May 2005
Location: New York
Posts: 2,260
Default Re: Suitable programming language

C++ is the one most likely to be used by professionals with similar problems, so you'll find the most code to borrow, and the instruction books will be closest to your needs.

VB may be the easiest to learn and is good for prototyping where you do some work in a spreadsheet and some in the programming language.

Perl, Java, C#, Visual C and others are fun to learn, but none are optimal for poker simulations.

Matlab and Mathematica are good for simulations, especially if there's some analytic component as well. If you're just simulating deals, it doesn't matter, but if you're programming optimal agents or building a bot, they have handy features. They're expensive.

Crystal Ball is an Excel add-in designed entirely for simulations. I like it a lot. It's extremely easy to use, and very fast.
Reply With Quote
  #9  
Old 10-18-2006, 07:47 PM
PrayingMantis PrayingMantis is offline
Senior Member
 
Join Date: Nov 2003
Location: some war zone
Posts: 2,443
Default Re: Suitable programming language

Thanks for all the replies so far.


[ QUOTE ]
Crystal Ball is an Excel add-in designed entirely for simulations. I like it a lot. It's extremely easy to use, and very fast.

[/ QUOTE ]

This actually sounds like an interesting option. I'll look into Matlab and Mathematica too.

Would you say that it is possible to deal with most probability problems that call for simulations using a tool like Crystal Ball alone, without a need for real knowledge in any programming language? Sorry if it sounds like a noob question.
Reply With Quote
  #10  
Old 10-19-2006, 05:43 PM
AlienBoy AlienBoy is offline
Senior Member
 
Join Date: Feb 2006
Location: Poker Happens...
Posts: 2,264
Default Re: Suitable programming language

I write in C, C++, PHP, FileMaker (if you can call that a language) and VBA for Excel.

Based on what you want to do, I suggest Excel with VBA (Visual basic for Applications).

The nice thing about Excel/VBA is that the I/O is already taken care of by the spread sheet, and it's really easy to create an attractive and functional layout is a very short time, and focus on the code that actually makes your application do what you need.

It's not the "fastest" in terms of runtime execution, but it's fast enough for most things.

If you are doing monte carlo simulations, there's even a version of the Mersenne Twister pseudo random algorithm for VBA.



As such, I think it's an environment that is well suited for what you are asking to do.


Of the languages listed above, C is generally fastest, as it has the lowest overhead after compilation - It's faster because it's lower level, but the lower levelness means you have more of a learning curve to climb. It's case sensitive and syntax must follow some arcane and exact rules. One the other hand there are a number of libraries available to help your development.

I think you'll find the learning curve/functionality sweetspot with VBA/Excel.


AB
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:33 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.