If you google for nhl playoff simulator my NHL Eastern Conference Playoff Race Simulator comes in at #3 in the search results. While I was checking my Google ranking, I found a paper written by some professors from the University of Alberta where they used some simple Monte Carlo simulations in Excel to simulate the end of the 2004 NHL regular season, and then the playoffs. If you are of the less math-inclined persuasion, skim sections 2 and 3, but be sure to read at least section 4. Here is a reference to the paper:
Ingolfsson A. (2004), “Simulating NHL Games to Motivate Student Interest in OR/MS,” INFORMS Transactions on Education, Vol. 5, No 1, http://ite.pubs.informs.org/Vol5No1/Ingolfsson/
After reading up on MATLAB vectorization last week, I wrote this code to normalize each row of a N by 3 matrix. The speedup is not enourmous, but it is significant. I tried timming things this weekend on my computer at home, but MATLAB on a 1GHz G4 with 512MB of RAM is not what you would call ‘peppy’. I’ll try on a modeling workstation at the office today and see what’s what when we try a big matrix and it can stay all in memory.
function [ ] = unit_vector_rows_for( N )
%UNTITLED1 Summary of this function goes here
% Detailed explanation goes here
%make a 1×3 matrix, we will consider rows as 3-tuples
a = [1:3] ;
%repeat a so that it becomes a N by 3 matrix, so we can have a big one to
%test
a=repmat(a,N,1);
tic
for i=1:size(a,1)
a(i,:) = a(i,:) ./ norm(a(i,:)) ;
end
k=toc;
fprintf(‘For loop time is %f\n’,k);
function [ ] = unit_vector_rows_mat( N )
%UNTITLED1 Summary of this function goes here
% Detailed explanation goes here
a=[];
%make a 1×3 matrix, we will consider rows as 3-tuples
a = [1:3] ;
%repeat a so that it becomes a N by 3 matrix, so we can have a big one to
%test
a=repmat(a,N,1);
tic
a = a./repmat(sqrt(sum((a.^2)’))’,1,3);
k = toc;
fprintf(‘Vectorized time is %f\n’,k);
Check out the new Laurentian Aerospace Corp website, put together by yours truly!
This is a post for me to save links of neat js and css stuff:
100 CSS Examples