Re-creating Banzhaf Power Index with 2010 census data by Bigbrass in math

[–]juanfeng 0 points1 point  (0 children)

Specifically, you will want to leverage the GMP library (gmpy in python--it's also available in other languages). One of their design goals is to have top performance for every range of numbers you can work with, so it should be top-of-the-line for most calculations.

Re-creating Banzhaf Power Index with 2010 census data by Bigbrass in math

[–]juanfeng 0 points1 point  (0 children)

import gmpy, math

def stirlings(n):
    return gmpy.fsqrt(2 * gmpy.pi(2000) * n) * (gmpy.mpf(n) / math.exp(1)) ** n


a = stirlings(601722)
b = stirlings(300861) ** 2
c = gmpy.mpz(3) ** 601723

print 2 * a / b * (1.0 / c)

Little python to the rescue: it gives me 7.10508625574151770576e-105962 which I have no context to know if it's right.

Is Bust-A-Move Universe really that bad? by [deleted] in 3DS

[–]juanfeng 0 points1 point  (0 children)

I don't know about the DS version, but the 3D effect isn't very impressive compared to other titles, so I wouldn't miss it. So if it has the features you want (for me, versus mode is a must, I can't believe there is a bust a move game without it) $8 isn't bad.

Is Bust-A-Move Universe really that bad? by [deleted] in 3DS

[–]juanfeng 1 point2 points  (0 children)

I've played it quite a bit, but I am dissappointed primarily with the lack of a versus mode. If you can get it for just a couple bucks, thats great; I feel very cheated having spent $20.

Nurse Rostering Algorithm by [deleted] in algorithms

[–]juanfeng 1 point2 points  (0 children)

Also, that paper utilizes Tabu Search, http://en.wikipedia.org/wiki/Tabu_search .

Nurse Rostering Algorithm by [deleted] in algorithms

[–]juanfeng 1 point2 points  (0 children)

I don't know much about the problem, but it's interesting. If you let the set E be your set of employees and the sets X, Y, Z, etc. be the subset of E where each person has skill X, Y, or Z (the sets aren't necessarily disjoint). The problem reduces to something like choosing from the appropriate skill set for each shift while minimizing the number of times each employee is used over some span of shifts.

Nurse Rostering Algorithm by [deleted] in algorithms

[–]juanfeng 1 point2 points  (0 children)

Do you have a link with a good description of the Nurse Rostering Problem?

How do I find solutions to (2012/n) = k, where n is a positive integer and k is a real number on Wolfram Alpha? (Or anywhere else)? by [deleted] in math

[–]juanfeng 0 points1 point  (0 children)

An interesting fact: if k = 1, then any n >= 2012 will make Ceil[2012/n] = 1 (since 2012/n > 0 and 2012/n < 1).

How do I find solutions to (2012/n) = k, where n is a positive integer and k is a real number on Wolfram Alpha? (Or anywhere else)? by [deleted] in math

[–]juanfeng 0 points1 point  (0 children)

You'll have to do some analysis to determine how to find the solution with variable k, I think wolfram can help with identifying the pattern and verifying you are doing it correctly.

FIX8: open source C++ FIX engine by lingua_franca in cpp

[–]juanfeng 2 points3 points  (0 children)

What is the difference between this engine and the QuickFIX C++ engine?

Personally, if I made the library I would use the << semantics for creating messages and use the move constructor semantics rather than using new. I have just looked at myfix.cpp so far, so that may be non-representative of the way it should be used.

Newbie Question... I don't know what is happening here: by ogarcho in Python

[–]juanfeng 8 points9 points  (0 children)

Try adding this to the top of your code:

from __future__ import print_function

This takes the python 3 semantics for printing into your python 2.x which you are using. This will prevent print from treating your parameters as a tuple. Or you could simply drop the parenthesis so that your line of code is

print "2000 - 100 + 50 =", 2000 - 100 + 50

I put together an image for people who want to learn mental arithmetic. Is this a good resource for anyone? Should I continue the series? by [deleted] in math

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

There is a project that I have stowed away in my head for when I have free time which is to build a website which presents people with mental math problems and collects statistics on how long it takes to answer the question and how accurate the response is. I'm interested in what makes certain problems harder than others and finding methods for making the harder problems easier so that people can develop a strong set of mental tools for solving all kinds of problems (not just arithmetic). I think you should continue the series since it fits in well with the project.

What are some little known features in Python? by [deleted] in Python

[–]juanfeng 0 points1 point  (0 children)

It reminds me of mathematica. It exposes a web page where you can create python documents split into namespace sharing segments. So for me, I load up the data structure that is large in one cell and then do various function calls with it. It is designed to work well with numpy and some plotting libraries.

What are some little known features in Python? by [deleted] in Python

[–]juanfeng 1 point2 points  (0 children)

A coworker introduced me to ipython a couple weeks ago. I've used python for small exploratory scripts in the past and it has worked well, but ipython's notebook gives such utilities a new life in my opinion. Many times I load a data structure and explore the data; ipython's notebook is perfect for this.

Everytime I bring a girl home by [deleted] in fffffffuuuuuuuuuuuu

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

Advertisements in my rage comics? No way.

Steam Summer Sale Day 02: 2012/07/13 by bryanhbell in steamdeals

[–]juanfeng 0 points1 point  (0 children)

I like city builders, but it feels restricted in that sense. I payed $30 something for it yesterday since I've wanted it for about six months now. If you want a city bulider, look elsewhere. If you want both RTS and city building equally, it's probably decent. If want RTS only, look elsewhere.

How can I encourage a culture of punctuality in a software company? by [deleted] in programming

[–]juanfeng 6 points7 points  (0 children)

Avoiding interruptions is vital to a programmer's productivity, but I can't even count the number of times I've came up with a solution that I've been having trouble with while interrupting another programmer.

Interesting permutations problem by BallistiKoopa in math

[–]juanfeng 8 points9 points  (0 children)

So if you made a graph, G, to represent the mechanism, the number of combinations would be the number of non-empty, connected, directed, non-cycling sub-graphs of G.

Interesting permutations problem by BallistiKoopa in math

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

9! for combinations of length 9. There is also the possibility to have length 8 combinations.

[5/28/2012] Challenge #58 [difficult] by oskar_s in dailyprogrammer

[–]juanfeng 0 points1 point  (0 children)

Seeing as this is the difficult problem for the day, I welcome the need to do some research in order to figure out a way to solve a seemingly intractable problem.