I noticed today a strange thing in Oregon.
Gas prices have changed, suddenly and drastically.
The whole year I've been here (almost-- can't believe it has been that long!) gas prices have been around 2.80-3.00. That's not the cheapest in the country, but it is pretty constant, and I like that.
I am not a fan of 3.65.
Now, I don't have to drive much, so it's not a big deal, and I guess it's just all this turmolt in the Middle East that's driving it but still. As an Oregonian, I know that there are a lot of people whose (timber) lives depend on driving and using gas. Hmmm... I feel bad for them and our industry. Trust me they are looking at alternative sources of fuel (wood chips) but that technology just isn't advancing as swiftly as most people would like.
Well, with spring (hopefully) coming it will be good incentive to walk around more. It's probably only a mile or so to the Safeway shops, Market of Fail, etc. and only 2 miles to places like Kimbos. Actually, school is only about 3 miles away if you take that path.
I am laughing a little now at how seriously I am considering getting a "Razor Scooter"-- 20 dollars to increase my MPH enough to make the commute feasible on a tight schedule! (I'm not much of a biker, sadly, but that also would be fun).
Sunday, February 27, 2011
Thursday, February 24, 2011
Snow? What...?
There is a chance of snow in San Francisco!This is crazy...I don't think it has snowed here in about 100 years.
Wednesday, February 23, 2011
Why travel?
"A hundred reasons clamor for your going. You go to touch on human identities, to people an empty map... You go because you are still young and crave excitement, the crunch of your boots in the dust; you go because you are old and need to understand something before it's too late."
- Colin Thubron, Shadow of the Silk Road
- Colin Thubron, Shadow of the Silk Road
Tuesday, February 22, 2011
Stupidity as an emergent property
An amusing observation I've heard a couple times is that a person is smart, but people are stupid.
At first glance, this seems like a silly (or even paradoxical) idea, but I think there's actually some truth to it. Suppose that, in the aggregate, irrational behavior in groups of people does not tend to cancel out, but rather, tends to be self-reinforcing. If a herd of horses running down a trail in the woods comes to a fork in the trail, the first horse has about a 50-50 chance of going right versus going left, but the second horse does not -- it will tend to follow the first horse. The third horse will have an even stronger tendency to imitate the first two, and so on. In this way, 'herd mentality' can be thought of as a sort of positive feedback loop.
Now, think of people. For example, people buying and selling stock. Clearly, trading stocks is a much more complicated situation than a hypothetical herd of horses running down a trail. However, what if the same sort of herd mentality exists there, as well? It may be true that, on average, stock traders generally behave as independent actors. However, competing with this rationality, I think it is reasonable to say that they have a (perhaps only slight) natural tendency to imitate each other. This tendency is safely ignored most of the time, but in the case where very many traders are suddenly all buying or selling the same stock, individual traders are going to be enormously tempted to imitate the large group. After all, who wants to be the only one left out of a really hot stock? Who wants to be the sucker last in line during a bank run? If you are the thirteenth horse on the trail, and all twelve of the horses before you went left, then you figure, maybe they know something you don't know. Chances are, you'll break left, too.
Just a thought I had. This seems consistent with the observation that stock price fluctuations are a heavy-tailed (power law) distribution; these tend to imply that an underlying coupling exists in the system. Now, if I could just get my hands on some stock price fluctuation data, I might be able to really take this somewhere...
At first glance, this seems like a silly (or even paradoxical) idea, but I think there's actually some truth to it. Suppose that, in the aggregate, irrational behavior in groups of people does not tend to cancel out, but rather, tends to be self-reinforcing. If a herd of horses running down a trail in the woods comes to a fork in the trail, the first horse has about a 50-50 chance of going right versus going left, but the second horse does not -- it will tend to follow the first horse. The third horse will have an even stronger tendency to imitate the first two, and so on. In this way, 'herd mentality' can be thought of as a sort of positive feedback loop.
Now, think of people. For example, people buying and selling stock. Clearly, trading stocks is a much more complicated situation than a hypothetical herd of horses running down a trail. However, what if the same sort of herd mentality exists there, as well? It may be true that, on average, stock traders generally behave as independent actors. However, competing with this rationality, I think it is reasonable to say that they have a (perhaps only slight) natural tendency to imitate each other. This tendency is safely ignored most of the time, but in the case where very many traders are suddenly all buying or selling the same stock, individual traders are going to be enormously tempted to imitate the large group. After all, who wants to be the only one left out of a really hot stock? Who wants to be the sucker last in line during a bank run? If you are the thirteenth horse on the trail, and all twelve of the horses before you went left, then you figure, maybe they know something you don't know. Chances are, you'll break left, too.
Just a thought I had. This seems consistent with the observation that stock price fluctuations are a heavy-tailed (power law) distribution; these tend to imply that an underlying coupling exists in the system. Now, if I could just get my hands on some stock price fluctuation data, I might be able to really take this somewhere...
Monday, February 21, 2011
Physics envy
In many parts of physics, theory drives experiment: theory is advanced, complete, and quantitative enough that it is able to lead the way into unknown territory, suggesting new experiments. However, this is not the case is almost all other fields that have a significant theoretical component. For example, in biology, theory is almost always retrodictive: the best it does, or even tries to do, is to help better explain or quantify things that are already qualitatively understood through experiment. While this is certainly an important task, it does lead biological theorists (meaning, in this case, me...but also others I've spoken to!) to a certain 'physics envy.'
Because this is the current state of biological theory, when developing a new model, I've found there is an awkward balance between my inner gung-ho theorist, which tells me I should make all kinds of counter-intuitive, out-there assertions based on a sort of reductio ad absurdum application of my model, and my more practical, engineering-like mindset, which insists that I focus on interpreting data that already exists, and only make predictions which can be experimentally verified without a ridiculous time and/or expense. Where they find common ground is that (1) the theory does need to agree with whatever data currently exists, and (2) it does need to make meaningful predictions, which are (at least in principle) testable experimentally.
(1) seems straightforward, but consider this. I'm in the final stages of building a model for the evolution of protein-protein interaction (PPI) networks. It agrees with the data pretty well for every standard network property I could think to measure -- degree, clustering, betweenness, eigenvalues, closeness, error tolerance...you name it! Altogether I've got 12 things I'm comparing, and it seems like my model nails pretty much all of them, in fruit flies, yeast, and humans. I've also confirmed that various other models do not capture all these features. So, off to a good start, right?
Here's the complication: these are all static features. My model builds a network which ends up looking, at least topologically, very much like present-day PPI networks. The model also makes specific predictions about the evolution of the network (which is, of course, the point of the thing in the first place). For example, it describes (at a very rough level) the evolution of the first cell. The thing is, there's no data against which I can validate these predictions, and I feel that it would be very strange to make any grand claims regarding evolution without being able to at least qualitatively verify them.
Ironically, my goal with this model was to see how simple a model I could build that would still accurately represent the PPI network's structure. However, it turns out that the model's excessive genericness works against it: it's hard to find things to test! This is my quandary at the moment: how do I make predictions about evolution which won't require millions of years to actually test? I am very interested in augmenting this model in various ways, including functional and environmental factors into it. But the first step is to verify what I've got already, and that's tricky, precisely because it's so simple at the moment.
One idea (which was suggested by my wife) is that I should try and apply the model to allopatric speciation events -- that is, to organisms' sudden evolutionary burst in response to geological or environmental changes. I think I can incorporate this kind of event into my model framework in a relatively natural way, and this has the great advantage that it happens on a rapid enough time-scale that there is real data out there to compare my predictions with.
Because this is the current state of biological theory, when developing a new model, I've found there is an awkward balance between my inner gung-ho theorist, which tells me I should make all kinds of counter-intuitive, out-there assertions based on a sort of reductio ad absurdum application of my model, and my more practical, engineering-like mindset, which insists that I focus on interpreting data that already exists, and only make predictions which can be experimentally verified without a ridiculous time and/or expense. Where they find common ground is that (1) the theory does need to agree with whatever data currently exists, and (2) it does need to make meaningful predictions, which are (at least in principle) testable experimentally.
(1) seems straightforward, but consider this. I'm in the final stages of building a model for the evolution of protein-protein interaction (PPI) networks. It agrees with the data pretty well for every standard network property I could think to measure -- degree, clustering, betweenness, eigenvalues, closeness, error tolerance...you name it! Altogether I've got 12 things I'm comparing, and it seems like my model nails pretty much all of them, in fruit flies, yeast, and humans. I've also confirmed that various other models do not capture all these features. So, off to a good start, right?
Here's the complication: these are all static features. My model builds a network which ends up looking, at least topologically, very much like present-day PPI networks. The model also makes specific predictions about the evolution of the network (which is, of course, the point of the thing in the first place). For example, it describes (at a very rough level) the evolution of the first cell. The thing is, there's no data against which I can validate these predictions, and I feel that it would be very strange to make any grand claims regarding evolution without being able to at least qualitatively verify them.
Ironically, my goal with this model was to see how simple a model I could build that would still accurately represent the PPI network's structure. However, it turns out that the model's excessive genericness works against it: it's hard to find things to test! This is my quandary at the moment: how do I make predictions about evolution which won't require millions of years to actually test? I am very interested in augmenting this model in various ways, including functional and environmental factors into it. But the first step is to verify what I've got already, and that's tricky, precisely because it's so simple at the moment.
One idea (which was suggested by my wife) is that I should try and apply the model to allopatric speciation events -- that is, to organisms' sudden evolutionary burst in response to geological or environmental changes. I think I can incorporate this kind of event into my model framework in a relatively natural way, and this has the great advantage that it happens on a rapid enough time-scale that there is real data out there to compare my predictions with.
Sunday, February 20, 2011
Inset plots in Matlab
Here's a Matlab code snippet that I've found to be useful. Something I find myself needing to do pretty regularly is to create a plot that has a smaller plot as an inset. (This is common because many journals have pretty strict space limits, so you've got to try and pack as much info as possible into the small set of figures you're allowed...)
When you run this, you get the following extremely sexy plot:Full disclosure: I copied this code from somewhere else a while ago, but I can't remember where. (Cool story, huh?) Anyway, thought I'd post it here, in case it is useful to someone.
X = -5*pi:0.05:5*pi;
Y = sin(X)./X;
figure(1)
clf
plot(X,Y,'b-','LineWidth',1)
hold on
ylabel('sin(x)/x')
xlabel('0 \leq x \leq 5\pi')
title('Halfway to a mexican hat')
axis([0 5*pi -0.3 1.1])
h1 = figure(1);
h2 = get(h1,'CurrentAxes');
% Note: edit these numbers to change position
% and size of inset plot
h3 = axes('pos',[.575 .575 .31 .31]);
plot(X,Y,'b-')
xlabel('-5\pi \leq x \leq 5\pi')
axis([-5*pi 5*pi -0.3 1.1])When you run this, you get the following extremely sexy plot:Full disclosure: I copied this code from somewhere else a while ago, but I can't remember where. (Cool story, huh?) Anyway, thought I'd post it here, in case it is useful to someone.
Saturday, February 19, 2011
Is this a deconvolution?
Matlab has a handy built-in function to do two-dimensional convolutions. These are useful for a variety of reasons: in any situation where you have a 2-D array, and you want to adjust each value in the array according to the values of its neighbors, a 2-D convolution can do this quickly and painlessly. It's a standard tool used, for example, in image processing: programs like Photoshop use 2-D convolutions to filter images in various ways, such as blurring or sharpening it.
Here's a related problem I encountered recently. Suppose, instead of adjusting each array value as a weighted sum of its neighbors, you want to use each array value to adjust all its neighbors. Specifically, you've got an array of mostly 1's, interspersed with the occasional 0, and you want to take each zero and surround it with 8 other 0's. One way to do this is to have a nested for-loop that checks if each element is equal to 0, and if so, sets its neighbors to 0. This is the brute force method. One annoying feature of this approach, however, is that you have to include special exceptions for any values along the edges: for example, if there's a 0 in the first row of your array, then it only has 6 neighbors to set equal to 0. Also, if the array is of any reasonably large size, nested for-loops take forever and a day to run. Anyway, here's a code snippet I wrote that avoids some of these issues:
So, what this does is sort of like a convolution. It first 'pads' the array with 1's along all its edges, then creates 8 arrays that are shifted to every position that needs to be zeroed out. Then it multiplies all the arrays together (element-wise multiplication, of course, not matrix multiplication!). The final four lines just chop off the 1's that the array was padded with.
While this works fine, and is much faster than looping through the indices explicitly, I have a nagging question of whether this can in fact be done using a standard 2-D convolution/deconvolution operation... Hmm. In any case, in the off chance that someone will find this code useful, it's here!
UPDATE (2/20/11): As KSP points out in the comments, this is really just an interpolation. With this in mind, it is straightforward to rewrite this as a convolution:
(F is the convolution filter.) This does the same thing as the previous code snippet, but it runs about 3.5 times faster. Not sure how I didn't see that you could do it this way to begin with! D'oh.
Here's a related problem I encountered recently. Suppose, instead of adjusting each array value as a weighted sum of its neighbors, you want to use each array value to adjust all its neighbors. Specifically, you've got an array of mostly 1's, interspersed with the occasional 0, and you want to take each zero and surround it with 8 other 0's. One way to do this is to have a nested for-loop that checks if each element is equal to 0, and if so, sets its neighbors to 0. This is the brute force method. One annoying feature of this approach, however, is that you have to include special exceptions for any values along the edges: for example, if there's a 0 in the first row of your array, then it only has 6 neighbors to set equal to 0. Also, if the array is of any reasonably large size, nested for-loops take forever and a day to run. Anyway, here's a code snippet I wrote that avoids some of these issues:
A = ones(5); A(1,1) = 0; A(2,4) = 0; pA = padarray(A,[1 1],1); A1 = padarray(A,[2 2],1,'post'); A2 = padarray(padarray(A,[0 1],1),[2 0],1,'post'); A3 = padarray(padarray(A,[0 2],1,'pre'),[2 0],1,'post'); A4 = padarray(padarray(A,[1 0],1),[0 2],1,'post'); A5 = padarray(padarray(A,[1 0],1),[0 2],1,'pre'); A6 = padarray(padarray(A,[2 0],1,'pre'),[0 2],1,'post'); A7 = padarray(padarray(A,[0 1],1),[2 0],1,'pre'); A8 = padarray(A,[2 2],1,'pre'); zA = pA.*A1.*A2.*A3.*A4.*A5.*A6.*A7.*A8; zA(1,:) = []; zA(:,1) = []; zA(6,:) = []; zA(:,6) = [];
So, what this does is sort of like a convolution. It first 'pads' the array with 1's along all its edges, then creates 8 arrays that are shifted to every position that needs to be zeroed out. Then it multiplies all the arrays together (element-wise multiplication, of course, not matrix multiplication!). The final four lines just chop off the 1's that the array was padded with.
While this works fine, and is much faster than looping through the indices explicitly, I have a nagging question of whether this can in fact be done using a standard 2-D convolution/deconvolution operation... Hmm. In any case, in the off chance that someone will find this code useful, it's here!
UPDATE (2/20/11): As KSP points out in the comments, this is really just an interpolation. With this in mind, it is straightforward to rewrite this as a convolution:
A = ones(5); A(1,1) = 0; A(2,4) = 0; F = ones(3); zA = ~conv2(double(~A),F,'same');
(F is the convolution filter.) This does the same thing as the previous code snippet, but it runs about 3.5 times faster. Not sure how I didn't see that you could do it this way to begin with! D'oh.
ah spring time
I'd like to point out that it's like 109 degrees at this same place in May because it's so exposed.
Godspeed latent heat flux.
I need some old harvest prescriptions to finish my work for this paper. They are located at Andrews. If this works ok, I'm uploading a time lapse of Andrews so that we can all see the fun weather.
If not, you can see it here:
http://webcam.oregonstate.edu/andrews/
Godspeed latent heat flux.
I need some old harvest prescriptions to finish my work for this paper. They are located at Andrews. If this works ok, I'm uploading a time lapse of Andrews so that we can all see the fun weather.
If not, you can see it here:
http://webcam.oregonstate.edu/andrews/
Monday, February 14, 2011
Tuesday, February 01, 2011
Friday, January 28, 2011
Crab, Elk, Snowfields
The definition of insanity is doing the same thing over and over and expecting different results
Strangely enough, that's kind of similar to the definition of Monte Carlo Simulation.
Monte Carlo simulation calculates results over and over, each time using a different set of random values from the probability functions. Depending upon the number of uncertainties and the ranges specified for them, a Monte Carlo simulation could involve thousands or tens of thousands of recalculations before it is complete.
Ok, so it's not really the same, but it IS uncanny that Einstein's famous quote made me think of Monte Carlo.
Moving on....
I drove to the beach tonight, on a "whim"-- I noticed upon returning that I felt epically more productive, and I should really sacrifice the gas for a beach night with "crab in a box" more often. I mean, that is some darn good crab-- you can tell it just came right out of the sea, it still tastes salty and fresh.
What I want to share though is this. As I drove out, I had this strange feeling. I was listening to some music, thinking about the trees and the mountains and just how beautiful forests are (no seriously I think of that a lot) and suddenly I realized that I was RELAXED. I can't even remember the last time I felt relaxed. There's always something wearing on me-- money, school, you know, it's just my personality, I guess, I always kind of get pent up. I wondered, maybe what I have been needing all along to feel good is just to be outside in the beautiful landscape more. I mean, that's why I got into this field in the first place, right? That's why we all do it, on some level. We feel just inherently ill when we can't be surrounded by trees. I am going to try this for a while; taking daily time (not just runs, which are on roads and are good for other reasons) but daily time to just be in the forests and mountains, and more weekend time to travel to the mountains and the sea. If the cure for feeling run down is just living in a beautiful place and enjoying it more, well, that I can do!
Anyway so I will take it as a sign that this was a good thought because I had the most amazing nature experience on the way back. It was really dark and I was driving along the road with a few other cars when suddenly-- wait don't get worried, this is a good story-- suddenly something darted out in the road, but like WAY ahead of me, not where I could hit it. So I stopped and looked and it was an elk. And he just sort of stared and stopped in the road for whatever reason (if there's such a thing as "elk in the headlights" that was this elk). So I was just stopped in the road, watching this elk and he watching me, and then I kind of looked up because it was on a downhill sort of between Toledo and Blodgett, and I saw these white clouds in the sky, almost like city lights, so I was thinking, that's weird, Corvallis is a small city, there's no way it could generate that light. So the elk moved on and I started going again, just watching this white stuff, and eventually there's a part in the road where you go over a pass, which I think is Summit Pass, it's maybe like 1000 feet high? Anyway at the top I could see the white stuff better and I could see what was below it and it was the snowfields on the Cascades. The moon was breaking the clouds in just the right way that the snowfields were glowing so brightly that they were reflecting off the clouds. I mean, you have no idea how magical this was. It's literally pitch black in the coast range, but I know what's around me, and it's this beautiful, dense, epiphytic (moss-covered) doug-fir/alder/western hemlock stand with a babbling creek along the side of the road, and then I'm at the top of one of these mountains and I can see all the way across the valley (although I couldn't really see the valley itself because of the angle and some trees) and you know, probably at least 70 miles away to the first snow cap mountain from there, and they are glowing as bright as say a short of dim blue colored flash light. Also yes, it was a blue glow, the color of a swimming pool or a glacier or something. It was just incredible.
I am so fortunate to live near mountains, especially snowy ones. And I'm so fortunate that my job essentially forces me to be near forested mountains. And sometimes I forget that I am very lucky like that. But the mountains, and the elk, and the trees, and the epic crab, they remind me that this is good.
Strangely enough, that's kind of similar to the definition of Monte Carlo Simulation.
Monte Carlo simulation calculates results over and over, each time using a different set of random values from the probability functions. Depending upon the number of uncertainties and the ranges specified for them, a Monte Carlo simulation could involve thousands or tens of thousands of recalculations before it is complete.
Ok, so it's not really the same, but it IS uncanny that Einstein's famous quote made me think of Monte Carlo.
Moving on....
I drove to the beach tonight, on a "whim"-- I noticed upon returning that I felt epically more productive, and I should really sacrifice the gas for a beach night with "crab in a box" more often. I mean, that is some darn good crab-- you can tell it just came right out of the sea, it still tastes salty and fresh.
What I want to share though is this. As I drove out, I had this strange feeling. I was listening to some music, thinking about the trees and the mountains and just how beautiful forests are (no seriously I think of that a lot) and suddenly I realized that I was RELAXED. I can't even remember the last time I felt relaxed. There's always something wearing on me-- money, school, you know, it's just my personality, I guess, I always kind of get pent up. I wondered, maybe what I have been needing all along to feel good is just to be outside in the beautiful landscape more. I mean, that's why I got into this field in the first place, right? That's why we all do it, on some level. We feel just inherently ill when we can't be surrounded by trees. I am going to try this for a while; taking daily time (not just runs, which are on roads and are good for other reasons) but daily time to just be in the forests and mountains, and more weekend time to travel to the mountains and the sea. If the cure for feeling run down is just living in a beautiful place and enjoying it more, well, that I can do!
Anyway so I will take it as a sign that this was a good thought because I had the most amazing nature experience on the way back. It was really dark and I was driving along the road with a few other cars when suddenly-- wait don't get worried, this is a good story-- suddenly something darted out in the road, but like WAY ahead of me, not where I could hit it. So I stopped and looked and it was an elk. And he just sort of stared and stopped in the road for whatever reason (if there's such a thing as "elk in the headlights" that was this elk). So I was just stopped in the road, watching this elk and he watching me, and then I kind of looked up because it was on a downhill sort of between Toledo and Blodgett, and I saw these white clouds in the sky, almost like city lights, so I was thinking, that's weird, Corvallis is a small city, there's no way it could generate that light. So the elk moved on and I started going again, just watching this white stuff, and eventually there's a part in the road where you go over a pass, which I think is Summit Pass, it's maybe like 1000 feet high? Anyway at the top I could see the white stuff better and I could see what was below it and it was the snowfields on the Cascades. The moon was breaking the clouds in just the right way that the snowfields were glowing so brightly that they were reflecting off the clouds. I mean, you have no idea how magical this was. It's literally pitch black in the coast range, but I know what's around me, and it's this beautiful, dense, epiphytic (moss-covered) doug-fir/alder/western hemlock stand with a babbling creek along the side of the road, and then I'm at the top of one of these mountains and I can see all the way across the valley (although I couldn't really see the valley itself because of the angle and some trees) and you know, probably at least 70 miles away to the first snow cap mountain from there, and they are glowing as bright as say a short of dim blue colored flash light. Also yes, it was a blue glow, the color of a swimming pool or a glacier or something. It was just incredible.
I am so fortunate to live near mountains, especially snowy ones. And I'm so fortunate that my job essentially forces me to be near forested mountains. And sometimes I forget that I am very lucky like that. But the mountains, and the elk, and the trees, and the epic crab, they remind me that this is good.
Friday, January 21, 2011
An ode to ODEs
Earlier today, Master-o-Forests asked me for help on solving a system of coupled ordinary differential equations (ODEs). I regurgitated the standard method that I'd learned in college, then, as I was driving home, it started to seem sort of unsatisfactory to me, for reasons I won't go into. Anyway, I thought for a bit, and, to keep my brain otherwise occupied while I wait for my interminable simulations to run, I scribbled down an explanation that (to me, at least) seems a little more motivated.
Here's the basic problem statement. Suppose you've got two ODEs which are coupled in the following way:
\[ \frac{dx_1}{dt} = m_1 x_1 + m_2 x_2 \]\[ \frac{dx_2}{dt} = m_3 x_1 + m_4 x_2 \]Where the $m$'s are specified (they're just numbers). How can you find an exact solution for $x_1$ and $x_2$ as a function of $t$?
First, let's identify what the complication is here. The trouble is that the time-derivatives (on the left-hand side) are expressions of both $x_1$ and $x_2$. Life would be a lot easier if this wasn't the case -- if $dx_1/dt$ just had $x_1$ on the right-hand side, then we could separate the variables and integrate, and we'd be done! Fortunately, there's a way to uncouple the system so that we do have two very simple equations. To see this, the first thing to do is gather the $m$'s into a matrix,
\[ \frac{d}{dt}\begin{bmatrix}x_1 \\ x_2 \end{bmatrix} = \begin{bmatrix} m_1 & m_2 \\ m_3 & m_4 \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} \]which is written in more compact matrix notation:
\[ \frac{d\mathbf{x}}{dt} = \mathbf{M} \mathbf{x} \]Notice that we'd have an uncoupled system if M was a diagonal matrix (that is, if $m_2$ and $m_3$ were both equal to 0). Well, M isn't diagonal, but it can be diagonalized by finding its eigenvalues and eigenvectors:
\[ \mathbf{M} = \mathbf{S D S}^{-1} \]where D is diagonal (with its elements being the eigenvalues of M, which we'll call $\lambda_1$ and $\lambda_2$):
\[ \mathbf{D} = \begin{bmatrix} \lambda_1 & 0 \\ 0 & \lambda_2 \end{bmatrix} \]and S has the eigenvectors of M (we'll denote these as a and b) as its columns,
\[ \mathbf{S} = \begin{bmatrix} a_1 & b_1 \\ a_2 & b_2 \end{bmatrix} \]Plugging the diagonalized M into our equation for $d\mathbf{x}/dt$, we find
\[ \frac{d\mathbf{x}}{dt} = \mathbf{SDS}^{-1} \mathbf{x} \]and we can multiply both sides on the left by $\mathbf{S}^{-1}$:
\[ \mathbf{S}^{-1} \frac{d\mathbf{x}}{dt} = \mathbf{DS}^{-1} \mathbf{x} \]To clean up the notation, define a new vector $\mathbf{u} \equiv \mathbf{S}^{-1} \mathbf{x}$:
\[ \frac{d\mathbf{u}}{dt} = \mathbf{D} \mathbf{u} \] Which looks pretty much like our initial system of equations, with one important exception: D is diagonal! Therefore, these equations are uncoupled:
\[ \frac{du_1}{dt} = \lambda_1 u_1 \]\[ \frac{du_2}{dt} = \lambda_2 u_2 \]These are separable, so it's easy to solve for $u_1$ and $u_2$:
\[ u_1 = C_1 \mathrm{e}^{\lambda_1 t} \]\[ u_2 = C_2 \mathrm{e}^{\lambda_2 t} \]where $C_1$ and $C_2$ are as-yet-unknown constants of integration (they'll be specified by the initial conditions). Now that we know u, it's simple to also calculate x, since, by definition:
\[ \mathbf{x} = \mathbf{S u} \]So, that's our answer. It looks a little different than the usual result, but, multiplying it out explicitly, we find the general solution is written
\[ \begin{bmatrix}x_1 \\ x_2 \end{bmatrix} = C_1 \begin{bmatrix} a_1 \\ a_2 \end{bmatrix} \mathrm{e}^{\lambda_1 t} + C_2 \begin{bmatrix}b_1 \\ b_2 \end{bmatrix} \mathrm{e}^{\lambda_2 t} \]which is the expected result.
Anyway, your mileage may vary, but I thought that this makes it clearer where the exponentials in the solution come from, and why we care about diagonalizing M in the first place.
Here's the basic problem statement. Suppose you've got two ODEs which are coupled in the following way:
\[ \frac{dx_1}{dt} = m_1 x_1 + m_2 x_2 \]\[ \frac{dx_2}{dt} = m_3 x_1 + m_4 x_2 \]Where the $m$'s are specified (they're just numbers). How can you find an exact solution for $x_1$ and $x_2$ as a function of $t$?
First, let's identify what the complication is here. The trouble is that the time-derivatives (on the left-hand side) are expressions of both $x_1$ and $x_2$. Life would be a lot easier if this wasn't the case -- if $dx_1/dt$ just had $x_1$ on the right-hand side, then we could separate the variables and integrate, and we'd be done! Fortunately, there's a way to uncouple the system so that we do have two very simple equations. To see this, the first thing to do is gather the $m$'s into a matrix,
\[ \frac{d}{dt}\begin{bmatrix}x_1 \\ x_2 \end{bmatrix} = \begin{bmatrix} m_1 & m_2 \\ m_3 & m_4 \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} \]which is written in more compact matrix notation:
\[ \frac{d\mathbf{x}}{dt} = \mathbf{M} \mathbf{x} \]Notice that we'd have an uncoupled system if M was a diagonal matrix (that is, if $m_2$ and $m_3$ were both equal to 0). Well, M isn't diagonal, but it can be diagonalized by finding its eigenvalues and eigenvectors:
\[ \mathbf{M} = \mathbf{S D S}^{-1} \]where D is diagonal (with its elements being the eigenvalues of M, which we'll call $\lambda_1$ and $\lambda_2$):
\[ \mathbf{D} = \begin{bmatrix} \lambda_1 & 0 \\ 0 & \lambda_2 \end{bmatrix} \]and S has the eigenvectors of M (we'll denote these as a and b) as its columns,
\[ \mathbf{S} = \begin{bmatrix} a_1 & b_1 \\ a_2 & b_2 \end{bmatrix} \]Plugging the diagonalized M into our equation for $d\mathbf{x}/dt$, we find
\[ \frac{d\mathbf{x}}{dt} = \mathbf{SDS}^{-1} \mathbf{x} \]and we can multiply both sides on the left by $\mathbf{S}^{-1}$:
\[ \mathbf{S}^{-1} \frac{d\mathbf{x}}{dt} = \mathbf{DS}^{-1} \mathbf{x} \]To clean up the notation, define a new vector $\mathbf{u} \equiv \mathbf{S}^{-1} \mathbf{x}$:
\[ \frac{d\mathbf{u}}{dt} = \mathbf{D} \mathbf{u} \] Which looks pretty much like our initial system of equations, with one important exception: D is diagonal! Therefore, these equations are uncoupled:
\[ \frac{du_1}{dt} = \lambda_1 u_1 \]\[ \frac{du_2}{dt} = \lambda_2 u_2 \]These are separable, so it's easy to solve for $u_1$ and $u_2$:
\[ u_1 = C_1 \mathrm{e}^{\lambda_1 t} \]\[ u_2 = C_2 \mathrm{e}^{\lambda_2 t} \]where $C_1$ and $C_2$ are as-yet-unknown constants of integration (they'll be specified by the initial conditions). Now that we know u, it's simple to also calculate x, since, by definition:
\[ \mathbf{x} = \mathbf{S u} \]So, that's our answer. It looks a little different than the usual result, but, multiplying it out explicitly, we find the general solution is written
\[ \begin{bmatrix}x_1 \\ x_2 \end{bmatrix} = C_1 \begin{bmatrix} a_1 \\ a_2 \end{bmatrix} \mathrm{e}^{\lambda_1 t} + C_2 \begin{bmatrix}b_1 \\ b_2 \end{bmatrix} \mathrm{e}^{\lambda_2 t} \]which is the expected result.
Anyway, your mileage may vary, but I thought that this makes it clearer where the exponentials in the solution come from, and why we care about diagonalizing M in the first place.
Thursday, January 20, 2011
Do not be deceived
In the movie Fight Club, the protagonist "Jack" is really Calvin from the comic strip Calvin and Hobbes:
Thursday, January 13, 2011
Models, part 2
Models get into your head.
One skill they should teach in schools is how to psychologically deal with models.
It is a strange thing. There is such tension, wanting to be able to even write a basic model to get it onto paper, and yet having it stuck in your brain. I imagine this must be what artists feel like when they are trying to make a picture, and they know what it should look like, but their hands can't make it happen. And how do we judge really good artists, but by how well they can represent reality, or the reality that they experience. Cezanne painted the same mountain over and over for 20 years, never depicting the image that was in his mind.
In the end though, we say something about some artists, "that artist, he/she has talent!" it doesn't matter if that face looks like a cube, or a real face, there's art that we see and we appreciate, because it resonates with what we know of reality. There's something inherent in artistic talent. (then there's an intellectual agreement between the producer and the consumer (viewer), but to be discussed later). The point is, there's just some people who CAN'T draw well.
My resonating fear is that I'm the kid drawing the stick figure claiming it's a bird.
No, really, it's a bird. Ask Brancusi.
One skill they should teach in schools is how to psychologically deal with models.
It is a strange thing. There is such tension, wanting to be able to even write a basic model to get it onto paper, and yet having it stuck in your brain. I imagine this must be what artists feel like when they are trying to make a picture, and they know what it should look like, but their hands can't make it happen. And how do we judge really good artists, but by how well they can represent reality, or the reality that they experience. Cezanne painted the same mountain over and over for 20 years, never depicting the image that was in his mind.
In the end though, we say something about some artists, "that artist, he/she has talent!" it doesn't matter if that face looks like a cube, or a real face, there's art that we see and we appreciate, because it resonates with what we know of reality. There's something inherent in artistic talent. (then there's an intellectual agreement between the producer and the consumer (viewer), but to be discussed later). The point is, there's just some people who CAN'T draw well.
My resonating fear is that I'm the kid drawing the stick figure claiming it's a bird.
No, really, it's a bird. Ask Brancusi.
Wednesday, January 12, 2011
words of the wise
"All a man needs is clean air to breathe, fresh water to drink, and salmon"- Siskyou chieftain
Tuesday, January 04, 2011
plant physiologists
"Plant physiologists have two responsibilities to the public whose money supports them. One is to make profound discoveries. The other is to make useful ones."-J.B. Passioura
Monday, January 03, 2011
But what if your box was made of carbon fibers?
Or to say it in another way, you can catch a phenomena in a logical box or in a mathematical box. The logical box is coarse but strong. The mathematical box is fine-grained but flimsy. The mathematical box is a beautiful way of wrapping up the problem, but it will not hold the phenomena unless they have been caught in a logical box to begin with.
-John R. Platt
-John R. Platt
Sunday, December 26, 2010
home home in the bris
From Otis Redding's Sitting on the Dock of the Bay
Sittin' in the mornin' sun
I'll be sittin' when the evenin' come
Watching the ships roll in
And then I watch 'em roll away again, yeah
I'm sittin' on the dock of the bay
Watching the tide roll away
Ooo, I'm just sittin' on the dock of the bay
Wastin' time
I left my home in Georgia
Headed for the 'Frisco bay
'Cause I had nothing to live for
And looked like nothin's gonna come my way
So I'm just gonna sit on the dock of the bay
Watching the tide roll away
Ooo, I'm sittin' on the dock of the bay
Wastin' time
Sittin' in the mornin' sun
I'll be sittin' when the evenin' come
Watching the ships roll in
And then I watch 'em roll away again, yeah
I'm sittin' on the dock of the bay
Watching the tide roll away
Ooo, I'm just sittin' on the dock of the bay
Wastin' time
I left my home in Georgia
Headed for the 'Frisco bay
'Cause I had nothing to live for
And looked like nothin's gonna come my way
So I'm just gonna sit on the dock of the bay
Watching the tide roll away
Ooo, I'm sittin' on the dock of the bay
Wastin' time
Sunday, December 12, 2010
Perhaps the best article about fat I have ever read
Everything you wanted to know about fat
I'm serious, I'm not talking about "fat people" really as much as fat itself in different forms and the risks possible for CHD based on consumption.
Also is a good example of evidence chain statistics.
I'm serious, I'm not talking about "fat people" really as much as fat itself in different forms and the risks possible for CHD based on consumption.
Also is a good example of evidence chain statistics.
Subscribe to:
Posts (Atom)



