I love real numbers. Here's an interesting Ted Talk on the amount of land and other resources required to fuel the UK with alternative energy sources.
http://www.ted.com/talks/david_mackay_a_reality_check_on_renewables.html
Saturday, June 30, 2012
Monday, June 18, 2012
Write for ideas
"Writing doesn't just communicate ideas; it generates them.
If you're bad at writing and don't like to do it, you'll miss out
on most of the ideas writing would have generated." - Paul Graham
I really could not agree more with this sentiment. In fact, it's why I started the blog. Don't underestimate the power of writing for developing new ideas. It's good for finding flaws in your ideas, too.
I really could not agree more with this sentiment. In fact, it's why I started the blog. Don't underestimate the power of writing for developing new ideas. It's good for finding flaws in your ideas, too.
Labels:
writing
Friday, June 15, 2012
Measurements and theory - the required number of data points
I hosted group meeting today. The topic was on Brownian motion, but during it I came to an interesting realization about measurements of displacement, velocity, and acceleration.
Consider the measurement of a displacement of an object, say a car, from some fixed point, let's say its owner's house. A measurement of the car's distance from home consists of taking a yardstick and determining how many yardsticks away from the house the car lies at a moment in time. This is one measurement. If we wish to determine the car's (average) velocity, we measure the distance at another moment in time, subtract this from the previous measurement to obtain its displacement, and divide by the time interval between measurements.
This means that if we wish to determine the velocity of the car, we necessarily must make two measurements of its distance from home. If the car is accelerating, then this may be determined from a minimum of three distance measurements. The two (average) velocities determined by the three points where the distance measurements occurred are subtracted and divided by the time difference between the first and last measurement, resulting in the car's acceleration.
One could argue that the car has an instantaneous velocity and acceleration, so to talk about the number of measurements required to determine one of the car's dynamical quantities is nonsense. For a car this is more or less true, practically speaking. However, the fact is that at very small length and time scales, we can not measure instantaneous quantities. Rather, they are sampled at specific time intervals. For example, a digital camera works by sampling the light that falls on each pixel of its CCD array. So, any measurement is in reality a collection of discrete points of data. Quantum mechanics also tells us that in the microscopic world, measurements are discrete and that the continuum results from combining a large number of discrete measurements.
Back to my main point. In kinematics and calculus we learn that velocity is the first order derivative of displacement and that acceleration is the second order derivative. The previous argument suggests that if we wish to determine some quantity that is a derivative of the quantity that we actually measure, then we need to make N+1 measurements, where N is the order of the derivative representing the quantity that we're after.
So there you have it. You can't determine an acceleration from one or two measurements of displacement. If I had a device that measured velocity, however, then the acceleration could be determined from two velocity measurements, since acceleration is the first derivative of velocity. All of these arguments aren't too surprising when you consider that these quantities are essentially differences, and differences require more than one thing.
As an aside, fractal motion becomes a bit more enlightening in this context, but I'll save that for a later discussion.
Consider the measurement of a displacement of an object, say a car, from some fixed point, let's say its owner's house. A measurement of the car's distance from home consists of taking a yardstick and determining how many yardsticks away from the house the car lies at a moment in time. This is one measurement. If we wish to determine the car's (average) velocity, we measure the distance at another moment in time, subtract this from the previous measurement to obtain its displacement, and divide by the time interval between measurements.
This means that if we wish to determine the velocity of the car, we necessarily must make two measurements of its distance from home. If the car is accelerating, then this may be determined from a minimum of three distance measurements. The two (average) velocities determined by the three points where the distance measurements occurred are subtracted and divided by the time difference between the first and last measurement, resulting in the car's acceleration.
One could argue that the car has an instantaneous velocity and acceleration, so to talk about the number of measurements required to determine one of the car's dynamical quantities is nonsense. For a car this is more or less true, practically speaking. However, the fact is that at very small length and time scales, we can not measure instantaneous quantities. Rather, they are sampled at specific time intervals. For example, a digital camera works by sampling the light that falls on each pixel of its CCD array. So, any measurement is in reality a collection of discrete points of data. Quantum mechanics also tells us that in the microscopic world, measurements are discrete and that the continuum results from combining a large number of discrete measurements.
Back to my main point. In kinematics and calculus we learn that velocity is the first order derivative of displacement and that acceleration is the second order derivative. The previous argument suggests that if we wish to determine some quantity that is a derivative of the quantity that we actually measure, then we need to make N+1 measurements, where N is the order of the derivative representing the quantity that we're after.
So there you have it. You can't determine an acceleration from one or two measurements of displacement. If I had a device that measured velocity, however, then the acceleration could be determined from two velocity measurements, since acceleration is the first derivative of velocity. All of these arguments aren't too surprising when you consider that these quantities are essentially differences, and differences require more than one thing.
As an aside, fractal motion becomes a bit more enlightening in this context, but I'll save that for a later discussion.
Monday, June 4, 2012
The importance of knowing your random number generator
I recently gained access to the Stokes computing cluster at UCF and ran some long-time simulations that I had written in Matlab. These were not in parallel, but rather utilized each node to run a separate simulation. Each simulation took a few days to run.
I was a bit irritated to find the output from each simulation was exactly the same, despite having run on separate nodes. The reason, I discovered, is that Matlab will generate the same string of random numbers every time you start a new instance.
I tried this experiment with Matlab R2011a. After opening a fresh instance of Matlab, I entered and received the following in the Command Window:
>> randn(1,5)
ans =
0.5377 1.8339 -2.2588 0.8622 0.3188
I then closed Matlab and reopened it. Entering the same command gives the same output as before:
>> randn(1,5)
ans =
0.5377 1.8339 -2.2588 0.8622 0.3188
Oh, boy. I performed the same procedure on a different model of computer in our lab and received the same output. I also tried this with Python 2.7 and Numpy's random.rand() method. The output is different each time I start an iPython session, so the seed must be automatically shuffled at the start.
Lesson learned. If you're working with random numbers in Matlab (at least with R2011a), be sure to randomize the seed with the command rng shuffle. Now to go redo a few week's worth of work...
I was a bit irritated to find the output from each simulation was exactly the same, despite having run on separate nodes. The reason, I discovered, is that Matlab will generate the same string of random numbers every time you start a new instance.
I tried this experiment with Matlab R2011a. After opening a fresh instance of Matlab, I entered and received the following in the Command Window:
>> randn(1,5)
ans =
0.5377 1.8339 -2.2588 0.8622 0.3188
I then closed Matlab and reopened it. Entering the same command gives the same output as before:
>> randn(1,5)
ans =
0.5377 1.8339 -2.2588 0.8622 0.3188
Oh, boy. I performed the same procedure on a different model of computer in our lab and received the same output. I also tried this with Python 2.7 and Numpy's random.rand() method. The output is different each time I start an iPython session, so the seed must be automatically shuffled at the start.
Lesson learned. If you're working with random numbers in Matlab (at least with R2011a), be sure to randomize the seed with the command rng shuffle. Now to go redo a few week's worth of work...
Subscribe to:
Posts (Atom)