Random Variables and Distributions

A random variable (also called stochastic variable) is a variable that can take a set of possible different values, each with its own probability. For example, the experiment could be picking a person at random, and a random variable would be the person’s height. A random variable can be discrete or continuous. Discrete random variables […]

Solomon Wisdom Probability Problem

I saw this problem in a Probability course offered by the Harvard Extension program. I highly recommend it if you have the time. Here’s the problem: In Solomon’s reign there were two types of prophets: true prophets, who spoke the truth 9 out of 10 times, and false prophets, who only spoke the truth 5 […]

Solution to Problem 28 on Project Euler

The problem: Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows: 21 22 23 24 25 20  7  8  9 10 19  6  1  2 11 18  5  4  3 12 17 16 15 14 13 It can be verified that the sum of the numbers on the diagonals is […]

The Prosecutor’s Fallacy

Before I explain what the prosecutor’s fallacy is, here’s a real life example where it affected (for the worse) the life of someone. Sally Clark was a British solicitor, and in 1996 his first son died, only weeks after his birth. In 1998 the same pattern occurred, when his second son died only weeks after […]

Bayes’ Theorem with Examples

Thomas Bayes was an English minister and mathematician, and he became famous after his death when a colleague published his solution to the “inverse probability” problem. Described below. Given that you have a urn with 10 black balls and 20 white ones, what’s the probability that by picking randomly you’ll get a white ball? This […]

How To Make A POST Request with PHP and cURL

Below you’ll find the PHP code to make a simple POST request using cURL. You can send the POST request either to your own server/domain, or to an external one, though it’s not guaranteed the external host will accept your POST. <?php                 $name = "John Doe";                 $email = "johndoe@hotmail.com";                 $url = "http://www.domain.com/signup/";                 $fields = "name=$name&email=$email"; […]