PDA

View Full Version : A numbers/equation/math-tricks request...


fatdave
09-21-2005, 02:35 AM
As I am trying to increase my skill in various forms of mathematics/calculus/trig/geometry/whatever, as well as in PHP, I would like to request some suggestions or questions for things for me to calculate, using PHP as my calculator.

It seems really redundant, as so many math functions are immediately available in PHP. However, the stringing together of functions in search of a result is really what I'm looking for.

So please, throw whatever you got at me. This could include statistical simulations, or word problems, or game theory, or whatever. Surprise me. Punish me (and you most likely will, as I forget lots of math "rules", except for maybe "Please My Dear Aunt Sally").

A very simple example is my post in this thread (http://forumserver.twoplustwo.com/showflat.php?Cat=&Number=3456545&page=0&view=colla psed&sb=5&o=&fpart=1). I learned something new about both math and PHP.

I would prefer something that has at least a little bit of "math magic" in it, as opposed to straight-up boring equations.

Part of this is to teach me more PHP, part of it is to teach my about math, part of it is just for entertainment.

Siegmund
09-21-2005, 04:16 AM
Two suggestions from statistics that you might someday have a use for:

1) Generate your own normally distributed random numbers. [You can do this the easy way, using someone else's uniform random number generator and just learn how to use uniform random numbers to make normal random numbers - or you can learn how a good RNG like the Mersenne Twister works too.]

2) Of the two "textbook" ways of computing the standard deviation of a long series of numbers, one is subject to bad roundoff errors, and the other requires you to repeat the calculation from scratch every time you add a new datapoint to your list.
But there is a recurrence relation, that just takes the mean and standard deviation of the old list and the value of one additional datapoint, and updates the mean and standard deviation. (This one won't be much of a challenge for programming once you find the formula, but it's a formula that deserves more attention than it gets.)