Trying to verify my program's output

In summary, the program found the kinetic energy matrix for a 1-D radial Schrodinger system using the Lagrange-Laguerre Mesh method. The program found that the roots for the Laguerre polyhedron were correct for the value of alpha = 0. However, the program was unable to find any experimental or exact results to compare with, and was curious if the kinetic elements were in the right ballpark. The program has uploaded an output csv file which the author would appreciate any insights on the kinetic Matrix in the file. Finally, the author is looking for confirmation that the natural units for the eigenvalues are Gev.
  • #1
ognik
643
2
Hi - I have written a Fortran 'beginner' program to find the kinetic energy matrix for a simplistic non-relatavistic, 1-D, radial Schrodinger system - using the Lagrange - Laguerre Mesh method. Firstly, I have verified that my roots for the Laguerre poly ##L^{\alpha}_{N}(x_{i}) = 0## are correct for ##\alpha = 0##, they look OK for other values of ##\alpha##.

What I'd like to know, is if my kinetic elements ##T_{ij}## are at least in the right ballpark? I haven't been able to find any experimental or exact results to compare with. I have uploaded an output csv output file which I hope is self-explanatory - would appreciate any insights on the kinetic Matrix in the file please.

I am also looking for insight into why my matrix elements have alternating sign - I suspect a program bug :-(

I have sourced understanding & formulae from the rather impressive article - D Baye, Physics Reports 565, 1107 (2015) - and have appended the essential formulae section I used into the csv file.

Finally, the units are a little unclear to me, this is the first time I have done anything like this, I believe these eqtns are in natural units with ##\hbar## = 1, and m = 1 eV. I think the natural units are Gev, so my value are O(1Gev) which seems about right - but would really appreciate confirmation?

If you could comment on whatever aspects you can, all knowledge is useful, thanks.
 

Attachments

  • KE_M_LN10.zip
    788 bytes · Views: 169
  • Like
Likes Dr. Courtney
Physics news on Phys.org
  • #2
If I recall correctly, there are two other ways to compute the eigenvalues of a 1-D Hamiltonian. The harder way is to choose an orthonormal basis compute all the matrix elements and diagonalize. The easy way to double check answers you already have is to directly integrate the TISE and confirm that the wave function goes to zero at infinity for the values of energy that are eigenvalues. Of course, you don't really integrate to infinity, but you integrate a bit past the classical turning point and confirm that the wave function is decreasing exponentially or faster.

You can search out eigenvalues of 1-D Hamiltonians with this method with an iterative guess-check method. This is computationally intensive and time consuming, but computers are fast. But double checking eigenvalues computed with another method is child's play.
 
  • Like
Likes ognik
  • #3
Dr. Courtney said:
This is computationally intensive and time consuming, but computers are fast. But double checking eigenvalues computed with another method is child's play.
I unfortunately don't have a lot of time and was hoping that either someone would look at my matrix and say if they are in the ball park or not - based on their experience etc. (just a best effort basis) OR point me at some research which includes a table of results from a similar exercise? Thanks.
 
  • #4
ognik said:
I unfortunately don't have a lot of time and was hoping that either someone would look at my matrix and say if they are in the ball park or not - based on their experience etc. (just a best effort basis) OR point me at some research which includes a table of results from a similar exercise? Thanks.

I don't play the game "is this right, prof."

I do empower students to figure out on their own whether a solution is correct.

The attached text file is a c program that computes the wave function for a given hamiltonian and energy level.

It uses atomic units (hbar = m = e = 1). If the wave function goes to zero beyond the classical turning point, you have an eigenvalue.

The potential in the code is V(z) = -1/sqrt(z*z+a*a), where z is the spatial variable and a is a parameter.

It is simple and obvious how to put in any potential function you wish.
 

Attachments

  • vwvfcn.txt
    1.3 KB · Views: 511
  • #5
The assignment was mainly to understand and implement the Lagrange-laguerre method - and then finish by commenting on the results for differing input params to show understanding of how those params. (alpha and lattice size) affect the results. I have thuis already completed the bulk of the assignment. But in order to comment on how lattice size for example affects the accuracy, I need some way of knowing what is accurate - I think that numerical methods like this need to be verifiable in some way - preferably through comparison with experimental evidence (which is what I was really hoping to find).

I am pretty sure of the method, so the other thing I was hoping to hear is that values O(1Gev) were reasonable - if they are significantly off, then it would almost certainly be a pgm bug, but again I would need to know if the results were off (and preferably by what factor) to drive any debugging effort.

So thanks for the pgm, have never worked with c, will find an IDE and have a go ...
 

1. How do I know if my program's output is correct?

There are several ways to verify your program's output. One approach is to manually compare the output with the expected results. Another option is to use automated testing tools, which can help identify any discrepancies between the two. Additionally, you can also ask for feedback from colleagues or fellow programmers to validate your program's output.

2. What should I do if my program's output is different from the expected results?

If your program's output differs from what you expected, the first step is to carefully review your code to identify any potential errors or bugs. You can also try using debugging tools or stepping through your code to pinpoint the issue. If you are still unable to identify the problem, seeking assistance from other programmers or experts in the field can be helpful.

3. Can I automate the process of verifying my program's output?

Yes, there are several automated testing tools and frameworks available that can help with verifying your program's output. These tools can run your program and compare the results with the expected output, saving you time and effort in manual validation.

4. How important is it to verify my program's output?

Verifying your program's output is crucial in ensuring its accuracy and functionality. It helps identify any errors or bugs that may affect the performance of your program and ensures that it meets the desired requirements. Validating your program's output also helps build confidence in its reliability and can save you time and resources in the long run.

5. Are there any best practices for verifying a program's output?

Yes, there are a few best practices to keep in mind when verifying your program's output. These include writing clear and concise code, using appropriate data types and error handling, and thoroughly testing your program with various inputs. It is also beneficial to document your testing process and results to track any changes or improvements made to your program.

Similar threads

  • Programming and Computer Science
Replies
19
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
508
  • Classical Physics
2
Replies
61
Views
1K
  • Programming and Computer Science
2
Replies
41
Views
3K
  • General Math
Replies
1
Views
2K
Replies
2
Views
2K
Replies
1
Views
1K
  • Programming and Computer Science
3
Replies
75
Views
4K
Replies
4
Views
2K
  • Programming and Computer Science
Replies
1
Views
3K
Back
Top