16 September 2008

Good Graph, Bad Graph

So my final year project has been plodding on like some mammoth tank running on a 100 cc engine. Being a simulation, I can always, as a start, choose a problem that can be theoretically solved, and simulate the solution to this problem. Then by comparing my simulation against the theoretical predictions, I should know how accurate my simulation is.

And a few weeks ago I got this milestone:



Whoopee! The simulation result coincides with the theoretical prediction quite closely, though a small shift is still evident - something I have to resolve in time to come. But at least I know that my code is largely correct.

That, is a good graph. But most of the time things go awry, and more often than not I get crap. In fact, according to theory, changing the basis states won't affect the results, but when I plug them into my simulation:



ARGHHHH! Seriously, I'm getting pretty frustrated at these graphs. Somewhere, something is very wrong, but sometimes, hunting for it through my code line by line is a vexing task. And then later I find the mistake to be in my mathematical derivation of the simulation algorithm. Argh!

No comments: