examples/schrodinger/schrodinger.cpp
/*
 * uses the Numerov algorithm to get the next value of psi
 */
uses the Numerov algorithm to get the next value of psi
uses the Numerov algorithm to get the next value of psi
Sdouble Schrodinger::calculateNextPsi(int n)
{
    FUNCTION_BLOCK;
    Sdouble KSqNMinusOne = calculateKSSquared(n - 1);
    Sdouble KSqN = calculateKSSquared(n);
    Sdouble KSqNPlusOne = calculateKSSquared(n + 1);
    Sdouble nextPsi = 2.0 * (1.0 - (5.0 * hZero * hZero * KSqN / 12.0)) * psi[n];
    nextPsi -= (1.0 + (hZero * hZero * KSqNMinusOne / 12.0)) * psi[n-1];
    nextPsi /= (1.0 + (hZero * hZero * KSqNPlusOne / 12.0));
    return nextPsi;
}
Sdouble Schrodinger :: calculateNextPsi ( int n ) { FUNCTION_BLOCK ; Sdouble KSqNMinusOne = calculateKSSquared ( n - 1 ) ; Sdouble KSqN = calculateKSSquared ( n ) ; Sdouble KSqNPlusOne = calculateKSSquared ( n + 1 ) ; Sdouble nextPsi = 2.0 * ( 1.0 - ( 5.0 * hZero * hZero * KSqN / 12.0 ) ) * psi [ n ] ; nextPsi -= ( 1.0 + ( hZero * hZero * KSqNMinusOne / 12.0 ) ) * psi [ n - 1 ] ; nextPsi /= ( 1.0 + ( hZero * hZero * KSqNPlusOne / 12.0 ) ) ; return nextPsi ; }
uses the Numerov algorithm to get the next value of psi
uses the Numerov algorithm to get the next value of psi