Recreational Mathematics   
   home  |  library  |  contact
 Math Notes
 Math Programming [25]
 Regression [3]
 Data Mining [17]
 Notation [6]
 Linear Algebra [9]
 Stats & Prob [15]
 Math Cognition [5]
 Space & Physics [6]
 Formulas [5]
 Fun & Games [2]
 Haskell [1]
 Bayes Theory [1]
 Site News [0]
 Math Projects [5]
 Polynomials [1]
 Calculus [9]
 Number Theory [3]
 Optimization [2]
 Financial [1]

 Math Links
 Andrew Gelman
 Chance Wiki
 Daniel Lemire
 KD Knuggets
 Social Stats
 MySQL Performance
 Matthew Hurst
 Hal Daume III
 Math Notes >> Notation

Order statistics [Notation
Posted on February 16, 2008 @ 01:36:53 PM by Paul Meagher

Order statistics are statistics derived from data ordered from smallest to largest. I've recently come across a nice notation for representing order statistics which I thought deserved a blog entry.

The notation involves putting a subscripted bracket around a positional index. Using this scheme, all the measurements in our ordered sample would be denoted as y[1],...,y[n]. In other words, the brackets around the subscripts tips us off that the elements denoted by these indexed y values are not simply the raw sample values in whatever order they were collected, but rather the sample values ordered from smallest to largest.

As an example of how this notation can be used, consider how we might express the formula for computing the first, second and third quartiles (Q1, Q2, Q3). Recall that Q1 is the value that 25% of our values are less than or equal to. Q2 is the value that 50% of our values are less than or equal to and Q3 is the value that 75% of our values are less than or equal to. Or, using our notation:

Q1 = y[(n+1)/4]

Q2 = y[(n+1)/2]

Q3 = y[3(n+1)/4]

If the subscripts are not integers, we average the two closest order statisitcs to obtain the quartile value.

The minimum value y[1], the three quartiles (Q1, Q2, Q3), and the maximum value y[n] are often reported together and are called the five number summary. The box-and-whisker plot is a graphical way to depict the five number summary.

As a final example of how our order notation can be used consider the formula for the trimmed mean. In the formula below mk is the trimmed mean with k values trimed from the top and bottom of an ordered list of numbers:

mk = ∑i=k+1 to n-k x [ i ] / (n - 2k)

Here is some PHP code for computing a trimmed mean where we remove the top and bottom 2 values from our computed mean (i.e., k=2):


function trimmed_mean($X$k) {
$n count($X);
$i=$k$i $n-$k$i++) 
$sum += $X[$i];
$mean $sum / ($n $k);

$X = array(551520122550);
"Trimmed mean is ".trimmed_mean($X2).".";

// Output: Trimmed mean is 20.


The next time you compute a mean you might want to consider computing a trimmed mean using a few different values of k to see how affected by outliers your computed mean is.


Superscripts and subscripts [Notation
Posted on July 27, 2007 @ 03:31:20 AM by Paul Meagher

Today I spent some time trying to explain to my daughter (going into grade 5) what an exponent is. She knows multiplication, subtraction, addition and some division but does not yet know what an exponent is. I tried to explain/motivate what an exponent was in the context of viewing the decimal system as a polynomial sum (which I discussed in my last blog). I was surprised to learn that a major block which she experienced in trying to learn this concept was viewing a superscripted number as having special notational meaning. If you add a superscripted 2 to the right of a 4 (i.e., 42) she views this as meaning 4 x 2 and can't see why it should mean 4 x 4. Note: She wrote out the exponent/power notation herself under instruction (i.e., "write a small 2 above the 4") without seeing a nicely rendered version of the notation. Perhaps this prop would have helped.

The next math lesson with my daughter may involve discussing the purposes behind using superscipts and subscripts in math notation.


Estimating Water Flow: Theory [Notation
Posted on July 11, 2007 @ 04:44:55 PM by Paul Meagher

We can denote the area under a simple curve from a to b (i.e., the definite integral) as:

aIb f(x)d(x)

We can use aIb to express the idea that the area under the curve from a to b (i.e., curve(a, b)) can be computed as the sum of curves from a to m (i.e., curve(a, m)) and m to b (i.e., curve(m, b)):

aIb f(x)d(x) = aIm f(x)d(x) + mIb f(x)d(x)

We can use the trapezoid rule to approximate (denoted by ~=) the definite integral from a to b:

aIb f(x)d(x) ~= h/2 * [f(a) + f(b)]

Where h = (b-a)/2.

Here is the delta version of the trapezoid rule which discards "b" in exchange for "a+h":

aIa+h f(x)d(x) ~= h/2 * [f(a) + f(a+h)]

The area under the trapezoid from a to b (i.e., trap(a, b)) can be computed as the sum of the trapezoids from a to m (i.e., trap(a, m)) and from m to b (i.e., trap(m, b)):

aIb f(x)d(x) ~= h/2 * [f(a) + f(m)] + h/2 * [f(m) + f(b)]


Standard Basis Vector for R3 [Notation
Posted on September 25, 2006 @ 03:03:02 AM by Paul Meagher

Behold the standard basis vector for R3:

v = x(1, 0, 0) + y(0, 1, 0) + z(0, 0, 1) = xi + yj + zk

To register a three-colum row of interval or ratio-scaled data (1, 5, 3) as a location in 3-D space, we can re-express the data using standard basis vector notation as 1i + 5j + 3k.


phpSyntaxTree [Notation
Posted on May 21, 2006 @ 04:15:19 PM by Paul Meagher

phpSyntaxTree is a neat web application:

phpSyntaxTree allows you to generate graphical syntax trees from labelled bracket notation phrases. You can then include the graphics into your homework or assignments.


PhpMathPublisher [Notation
Posted on May 21, 2006 @ 01:00:12 AM by Paul Meagher

Discovered the PhpMathPublisher package tonight:

With PhpMathPublisher, you can publish mathematical documents on the web by using only a php script (no latex programs on the server, no mathml...).

This looks like it might be a useful class/package to embed into my news publishing system. I've used Latex in the past to generate some of my math graphics. To do this I extended the XML_Transform package developed by Sebastian Bergman so that it would parse latex content embeded in XML tags and hand it off to latex to render. I never had time/motivation to master Latex or perfect the process so am open to alternative approaches such as PhpMathPublisher is taking.

I've recently set up an Ubuntu desktop system and hope to explore the Open Office Math app as well.

While it is nice to have these apps which will generate-printer ready math notation, when you are publishing math on the web there is nothing wrong with using some of the math notation provided by standard HTML as well. The HTML codes for the greek alphabet, for example, renders on all modern browsers and if you need to mix some greek notation into your blog it will often be just as easy and faster to render if you use the standard HTML codes for the greek alphabet. PhpMathPublisher will come in handy, however, if you have to build a more complex formula involving greek alphabet symbols.



php/Math Project
© 2011. All rights reserved.