Archive

Posts Tagged ‘Websites’

P-Value Calculators and Graphers in Javascript

September 5th, 2010

There are a lot of online tools out there for computing p-values and test statistics associated with common statistical distributions such as the normal or Student’s t-distributions. Unfortunately, most of them are either ad-ridden or powered by Java (and hence slow to initially load and finicky when it comes to which browsers they work with). So one of my summertime projects this year was to create a website that solves both of those problems:

The website computes p-values and test statistics in real-time via javascript (and thus does not need Java or any other plug-in). The computations themselves are fairly straightforward and are performed via the trapezoid rule. The graphic on the right is composed of a static PNG that displays the appropriate distribution. The distribution’s image is transparent under the graph and opaque above the graph, which makes it easy to display the p-value graphically – the light blue area is actually just a blue rectangle that is drawn beneath the distribution’s image.

Additionally, through the magic of PHP the tool automatically creates a URL that links to the current computation (and thus makes it much more citable). So, for example, if you want to know the T-value that corresponds to a right-tailed test with 12 degrees of freedom and a p-value of 0.1, you could simply click here.

Anyway, if you’re a nerd like me then enjoy it and of course feel free to leave any feedback/suggestions that you might have.

Tags:

My New Project: Conway’s Game of Life

January 16th, 2009

Sometime around the start of December I was reminded of Conway’s Game of Life – a mathematical “game” that I was first introduced to in my grade 12 programming class. Unfortunately for me and my research, I found the game much more interesting this time around and have proceeded to spend almost the entire last month dedicated to it.

It started out innocently enough; I thought that a webpage that uses the canvas tag to run the Game of Life would be the perfect way to hammer home what I was talking about in this post. It turns out that the game gets quite computationally intensive for even moderately-sized patterns however, so although the tool was functional, it chugged. What would be the solution to this problem? Write the tool in a pre-compiled programming language like Java, of course.

There are several Java implementations of the game freely available on the internet, but at this point I wanted to make an online tool that does a bit more than just evolve patterns; I wanted also to be able to upload, save, and download pattern files from the tool, something that is quite impossible from a Java applet. Also, because building interfaces for Java applets is a bit of a chore, most of the pre-existing Java applets implementing the game are a bit hard to look at. All of these problems can be solved via a bit of server-side ASP and some Java-to-javascript communication, fortunately (something I will post about separately later).

The end result? Well, I don’t really know yet, but here’s the beta 0.2.0 result:

The Java applet that runs the game itself is based on Alan Hensel’s brilliantly fast Java staggerstep algorithm, with some added file manipulation functionality and a dynamic online database of patterns. The applet is still very much a work in progress and there are quite a few known bugs, but it works well enough for now.

The real star of the website for now is the LifeWiki, which I’m hoping will fill a huge gap on the internet that I was rather shocked to find – even though there are many great homepages with bits and pieces of information about the game scattered across the internet, there really is no central resource that catalogues everything about the game; LifeWiki will hopefully fill that gap. I have started it off with some 150 articles and uploaded as many images, but I’m hoping that I can draw a few other Life enthusiasts to the wiki to help expand it so as to ease some of the burden.

Anyway, that’s about all I have to say for now about the website; I’ll likely make another post or two in the reasonably near future with coding tips/tricks based on my experience making the tool and site in general. Until then, I present to you my favourite pattern for the Game of Life, the Canada goose:

PS. Happy birthday to me!

Tags:

New Website Launched

October 2nd, 2008

Well, after squatting on this domain for about a year, I finally decided that I might as well put a website up here again. The website is going to be much more math-oriented this time around since I’m a nerd like that. In that vein, my first entry here will simply be one of the only math-related things that I wrote on the old site (on November 22, 2005):

 After hours of thought and consideration, I have come to the conclusion that the way in which math is taught sucks monkey fur.Let us take, for example, a Numerical Methods assignment that I currently have sitting in front of me. One particular question (which is worth a whopping 0.0769% of my final mark) on this assignment requires to me to find eigenvalues of a 3 × 3 matrix for which the characteristic polynomial does not factor. “But Nathan,” I can hear you say, “that’s simply a matter of plugging numbers into the cubic root formula! What’s your problem, ho?” And though you are quite correct, allow me to print, in its entirety, said formula: “But Nathan,” I can hear to chirp up again, “why don’t you just use the QR Algorithm or MATLAB or some other method to find the roots?” Well, it seems that this route of escape was thought of by the prof, so she specifically states that we are to compare our answer with the one obtained from MATLAB – indicating that we are indeed actually expected to find these roots by hand and get the exact answers – to obtain a whopping 0.0769% of our final mark (actually, considerably less than that – this is only one part of a multi-part question). “But Nathan,” I hear you say one final time, “why don’t you talk about something interesting? I don’t know what the hell the QR Algorithm is, nor could I care less.” Shut up, I never talk about math on here, I’ve been generous until now, so let me rant. I’m getting sick and tired of so many courses managing to teach so little, while expecting so much. Why do we have to prove over and over again that we are capable of plugging numbers into longer and longer formulae, while not actually being required to demonstrate any real insight along the way? So, tell me professors, what is the point of this? And what is the point of us having to draw nine linearizations to complete question #1 on a differential equations assignment? You don’t believe that we know how to do it after the first eight times? Why do you feel the need to ask the same questions over and over again, while giving us nothing really insightful or different on the assignments? Maybe someday down the line if/when I become a professor I’ll understand (and perhaps even prove) that making assignments ridiculously repetitive and far more tedious than necessary is a fundamental law of the universe which keeps us all in harmony and prevents the Earth from being hurled into the sun. But, barring that realization, I make the following vow to my future students, should I become a professor: I will (try to) make assignments for my classes (as) interesting (as possible for a math class) and will not ask you to do questions that involve exceedingly gross algebra (unless you all get on my bad side by skipping lectures) for no good reason.
Tags: