- when physics texts have a ton of unexplained calculations with lots of (often sloppy) notation. learning this stuff for the first time, not knowing whether the equation is right or not, and you can't tell if that minus sign or variable doesn't make sense because you fail to understand something, or it's simply a typo.
- when you read 10 documents on the exact same problem, because none of them give a comprehensive explanation - so you need to piece together partial explanations from many sources.
- when the equations from every source all look different... and you need to get one document's expression into the form of another document to check each step for errors. Cross-check, verify the information being presented to you is in fact, accurate, before you spend the following hours not knowing why it is correct, and being offered no explanation by the physicist author.
- self-inconsistencies within the same document between the analytical theory equations and the actual numerical code implementation.
Case in point:
Numerov Algorithm for numerical solution of the Schrodinger Equation (1-D time-independent simple harmonic oscillator) ref: http://www.fisica.uniud.it/~giannozz/Corsi/MQ/LectureNotes/mq-cap1.pdf
Numerov Algorithm for numerical solution of the Schrodinger Equation (1-D time-independent simple harmonic oscillator) ref: http://www.fisica.uniud.it/~giannozz/Corsi/MQ/LectureNotes/mq-cap1.pdf
numerical code:f[i] = ddx12 * 2. * (vpot[i] - e);y[i + 1] = ((12. - f[i] * 10.) * y[i] - f[i - 1] * y[i - 1])/ f[i + 1];where:vpot[i] = 0.5 * x[i] * x[i];ddx12 = dx * dx / 12.
you can see (by the expression for y[n+1] matching the theory presented below) that this f[i] is intended to be exactly the auxiliary function described in the notes.
First notice that f_n in the code is supposed to be a function of g_n, but it has no mention of mass m, Planck's constant hbar as the theory exposits. Did we assume the mass and hbar equal one? Not necessarily. Let's take a closer look at the definition of g_n:
We can rectify this discrepancy of g_n in the code vs theory by noticing that the code should use the dimensionless form of the Schrodinger equation, which have the mass and hbar constants built into the transformed, adimensional variable corresponding to x.
We can rectify this discrepancy of g_n in the code vs theory by noticing that the code should use the dimensionless form of the Schrodinger equation, which have the mass and hbar constants built into the transformed, adimensional variable corresponding to x.
That would make g_n in the Schrodinger equation be equal to g(x~) = 2e - x~^2.
But despite this progress, another troubling observation persists. The coded function f_n is equal to
f_n = -g_n * dx^2 / 12...NOT equal to
f_n = 1 + g_n * dx^2 / 12,as the theory stipulates!
So... why??? Unless somehow they are equal with additional physics assumptions, blatant arithmetic errors caused by my careless stupidity, or an obvious simplification that eludes me... the theory tells one story and the code acts out another!
This is so frustrating to learn from!
Don't get me wrong. I really appreciate the information contained in the notes and the code, honestly, I do, because it gives me lots of guidance and explanation that other texts gloss over - this document has the best treatment of the numerical method for a beginner that I have come across - but unexplained self-inconsistencies are huge roadblocks to understanding and I have trouble hurdling over them!
EDIT: NVM I FOUND IT
source code:
/* f(x) as required by the Numerov algorithm */
for (i = 0; i <= mesh; ++i) {
f[i] = 1. - f[i];
}
First, the solver calculates the expression -g_n * dx*dx/12 to check for positive or negative sign. Then before actually using it in Numerov's algorithm, it fixes the value to f_n = 1 + g_n * dx*dx /12



No comments:
Post a Comment