montecarlo

Running an allocation simulation repeatedly breaks after the first run.

Background I have a bunch of students, their desired projects and the supervisors for the respective projects. I'm running a battery of simulations to see which projects the students end up with, which will allow me to get some useful statistics required for feedback. So, this is essentially a Monte-Carlo simulation where I'm randomising...

Why use Monte-Carlo method?

When should the Monte-Carlo method be used? For example, why did Joel decide to use the Monte-Carlo method for Evidence Based Scheduling instead of methodically processing all user data for the past year? ...

How do I perform a monte carlo simulation in Open Office?

Hello all. I am trying to generate some ranges for a problem I am working on. These rangers are going to be based on the sum of the ratio's of a bunch of numbers. So for example, the constant's are 5 6 and 7. The ranges I get will be 5/x + 6/y + 7/z = S I want x, y, and z to come out of a list of numbers I have - say .5, .6, .7, .8, ....

Help with 2 quetions about randomized algoritms

I an now learning the Las Vegas and Monte Carlo algorithms myself,and have two questions may be simple but I can not answer them,if someone can help me...Thanks in advance Consider a Monte Carlo algorithms A for a problem P whose expected runnig time is at most T(n) on any instance of size n that produces a corect solution with probabi...

Getting a subroutine to return a pointer referencing an array and then dereferencing it in main (in C)

Hiya im trying to write a code for basic 1D Monte-Carlo integration. To do so I need a list of pseudo-random numbers which I can then input into a function (stored in another subroutine). I've given the list of random numbers a pointer but when I try to dereference it in main I get "error: incompatible types when assigning to type ‘dou...

Getting a subroutine to return three seperate arrays of random numbers in C

I currently have code for a subroutine to return a pointer to an array. This array is a list of random numbers for a one dimensional monte-carlo integral. I am now trying to do a multi dimensional equivalent which requires 3 arrays of random numbers and instead of having a separate subroutine for each I'm trying to make one which retur...

NSDecimalNumber for intensive scientific applications?

Let's say I'm writing a "DayData" class, containing the ivars NSString *symbol; //such as "AAPL" NSString *currency; //such as "USD" NSDate *day; double open; double high; double low; double close; The last four ivars are the open,high,low,close prices of that stock for that day. Say I'm using this class as the fundamental building-...

Is there a way of using linked lists to simplify my Monte-Carlo code

Hiya, my code currently has three functions each producing a massive array of random numbers. Im wondering if there is a way of just having one function returning a linked list or multidimensional array to make it a bit neater: (copied from http://pastebin.com/Y5aE6XKS) #include <stdio.h> #include <stdlib.h> #include <math.h> #include...

Thread-safe random number generation for Monte-Carlo integration.

Im trying to write something which very quickly calculates random numbers and can be applied on multiple threads. My current code is: /* Approximating PI using a Monte-Carlo method. */ #include <stdio.h> #include <stdlib.h> #include <math.h> #include <time.h> #include <omp.h> #define N 1000000000 /* As lareg as possible for increased ...

How to vectorize a random walk simulation in Matlab

I am rewriting a monte carlo simulation model in Matlab with an emphasis on readability. The model involves many particles (represented as (x,y,z)) following a random walk over a small set of states with certain termination probabilities. The information relevant for output is the number of particles that terminate in a given state. Th...

Importance sampling in monte carlo method (in C)

Hiya, Ive written a code which successfully approximation one, two and three dimensional integrals using a 'crude' Monte-Carlo sampling technique. I would now like to improve this by using 'importance sampling', as apparently this can reduce variance. I have read a few web pages about this but none seem particularly clear. How would I ...

Binary tree that stores partial sums: Name and existing implementations

Consider a sequence of n positive real numbers, (ai), and its partial sum sequence, (si). Given a number x ∊ (0, sn], we have to find i such that si−1 < x ≤ si. Also we want to be able to change one of the ai’s without having to update all partial sums. Both can be done in O(log n) time by using a binary tree with the ai’s as leaf node v...

How can I get started with Monte Carlo simulations for financial data in Perl?

I need to create a Monte Carlo simulator for some financial transactions. The inputs would be: the average percent of transactions that end up profitable the average profit per transaction the number of transactions per time period I've looked at the Math::Random::MT::Auto Perl module but am unsure how to formulate the inputs to the...