Numerov method on a exponential grid mesh

Click For Summary

Discussion Overview

The discussion revolves around the implementation of the Numerov method for solving second-order differential equations on an exponential grid mesh, contrasting it with a uniform grid mesh. Participants explore the implications of using a non-uniform grid on the accuracy and behavior of the numerical solution.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant describes their successful implementation of the Numerov method on a uniform grid mesh and the subsequent issues encountered when transitioning to an exponential grid mesh, suggesting that the method may not account for the non-uniform spacing of points.
  • Another participant raises concerns about potential numerical issues related to floating-point representation in computations involving exponential functions, suggesting a switch from single to double precision as a troubleshooting step.
  • A participant expresses uncertainty about whether the observed "metric" problem is indeed the cause of the discrepancies in results, noting that they have never worked with variable grid meshes before.
  • There is a discussion about the challenges of modifying the Numerov method to accommodate the exponential grid, with one participant mentioning the complexity introduced by higher-order derivatives in their modified approach.
  • One participant speculates that the issue may stem from discretization and seeks insights from others experienced with variable grids and multistep methods.
  • Another participant suggests that the unexpected results could be due to a combination of computational errors, coding issues, or mathematical errors, urging a more focused examination of the problem.

Areas of Agreement / Disagreement

Participants express varying degrees of uncertainty regarding the source of the issues encountered with the exponential grid mesh. There is no consensus on whether the problems are primarily due to numerical errors, discretization issues, or the implementation of the algorithm itself.

Contextual Notes

Participants acknowledge the complexity of transitioning from a uniform to a non-uniform grid and the potential for various types of errors, but specific assumptions and limitations of their approaches remain unresolved.

Telemachus
Messages
820
Reaction score
30
Hi there. I was trying to implement Numerov method for solving second order differential equations (you can see some information of Numerov algorithm at here: https://en.wikipedia.org/wiki/Numerov's_method ). At the beginning I've used a uniform grid mesh, all points equally spaced. I'm working in Fortran, and the program I wrote worked fine on that mesh, I've tried different things and contrasted what the method gave with the analytical solutions, everything went just great. But then I wanted to use a different kind of grid mesh, so I've implemented an exponential grid mesh. When I've started to run the program on this exponential grid mesh, with points spaced like

x_i=x_0(e^{t_i}-1) and t_i=(i-1)h

the solution started to look like compressed at the origin, where points are more dense in the gridmesh. So I came to think that probably this was because of Numerov method being a multi step method derived on a uniform grid mesh, that the problem was maybe due that the algorithm doesn't have in account how the points in the domain are spaced when I use a grid mesh which is not uniform, so when I've took a domain with discrete points given by an exponential function, adjacent points were not equally spaced anymore, and that changed the metric somehow. Is this appreciation correct? I have never done this before, so I'm just "trying". I haven't read any book on how to implement this sort of things. If you have any reference on where to look for the implementation of variable grid mesh that would be great.

So then what I tryied to do was to modify the algorithm to work in this exponential domain. So I rederived a formula by using the chain rule in the taylor expansion. But then the method doesn't look that nice anymore, I have many derivatives of all orders including a first order one, which I can't extract from the differential equation as it is done in the standard Numerov method.

y''(x)=-g(x)y(x)+s(x)

Well, any idea, correction or comment will be welcome. Thank you in advance.

Note to the moderation: I've originally posted this issue in here: https://www.physicsforums.com/threads/variable-grid-mesh-in-numerovs-method-fortran.870657/ but then I thought that this subforum was more appropriate. Please, don't be mad at me for posting this again in here, just delete the other topic if necessary.
 
Technology news on Phys.org
The first thing as a computer guy to ask you about without even understanding the details of what you're doing, is: have you looked at potential numeric issues with it? These come up all the time with exponential stuff. The computer uses a floating point type to represent the number. So if you sum a large float and a small float, the small float just disappears, because of the rounding, so you lose information and get garbage out of complex computations. I don't know much about FORTRAN, but a quick way to test if you think this may be it is to try changing from single precision to double precision floats, and see if it gets a little better. I don't know if this is your issue, but its a simple thing to rule out.
 
  • Like
Likes   Reactions: Telemachus and jim mcnamara
Thank you very much for your response first of all.

I've been working with double precision all the time. Actually, the result doesn't look like garbage, but instead it seems to be this kind of "metric" problem. Of course, this is what I've deduced, and I'm not totally sure this is the problem. Probably someone working in numerical analysis could say if that could be the problem (I have never before worked with variable grid meshes, and I've been "inventing" what I did, so I'm not much sure of anything at all). But, in principle, this is what I thought. The Numerov method uses information of previous and forward steps, and when I've changed the grid mesh to the exponential, the thing actually looks like if it where compressing the wave function in the region where the x points are more dense. I'll post a picture to clarify. Numerov method uses a Taylor expansion of the wavefunction, now my domain has real numbers that grows exponentially, not linearly (as in the uniform grid). I thought that this non uniformity could introduce some sort of different 'metric' in the wave function. After all, when one approximates a derivative by finite differences, is using this linearity, and this 'metric' to approximate the differentials. But I'm not sure, because is the first time I'm doing this, but I thought that could be the problem. I've tried to modify Numerov method, by considering a composite function ##y(e^x)## and using the chain rule in the Taylor expansion, but then the algorithm looses all of its nice simplicity, and there appears derivatives of all orders, including a first order which didn't allow me to proceed, because I would have to integrate the function I'm looking for, and things get more complicated.

This is for example a result I've obtained previous to changing the grid (that is, with a uniform grid using Numerov method):

?temp_hash=2adc64f315e3c75b56f0b5b0b7c018d1.png


Upwards are the numerical and analytical wavefunction (the program calculates the analytical wf by means of Laguerre polynomials). And downwards the derivatives. The program propagates from the outward to the inward region, and from the inward to the outward, and then matches both solutions, normalize, etc. I'm using the discontinuity at the matching point as a convergence criteria.

As you may see I have an excellent agreement if I use a proper number of points in the grid mesh to propagate the numerical solution.

Now, when I've tried to implement the exponential grid this is what I obtain (this is for the ground state):

?temp_hash=2adc64f315e3c75b56f0b5b0b7c018d1.png


It looks awful, but the exterior region is actually not that bad. The thing is that when the program matches both solutions (inward and outward) it uses the value of the function propagating from the inward to the outward region at the matching point, and at that point the outward solution is already negative, so it looks like the matching procedure is inverting the wave function with respect to the x axis. What the wavefunction looks like is like if it were being compressed in the interior region, where there are a bigger number of points (the discrete grid is more dense in that region).
 

Attachments

  • Screenshot from 2016-05-03 18:30:44.png
    Screenshot from 2016-05-03 18:30:44.png
    18.1 KB · Views: 806
  • in_numlagwf.png
    in_numlagwf.png
    6.4 KB · Views: 757
Last edited:
Hmm, sounds like interesting stuff, but a really dense problem. I think this is the first question: is the unexpected result due to computation (such as numeric errors) a bug or coding issues (you entered the wrong thing, or aren't sure how to implement an algorithm in FORTRAN) or mathematical errors? If you can shrink the problem down to a specific field, I think it will be easier to answer.
 
  • Like
Likes   Reactions: Telemachus
Well, I personally think that the issue is due to the discretization, basically I wanted to know if someone have worked with variable grids with this kind of multistep methods, and what would be expected to see by the trained eye. Is there anyway to save this problem or am I condemned with it? perhaps I reached as far as it can be taken, but I'm just not sure. I'm actually not sure about my hypothesis of this behaviour being given by the discretization it self, and if it is a reasonable thing trying to modify Numerovs method using the chain rule. I actually am not sure about the whole thing, but it worked pretty well on the uniform grid. I have checked many things in the program. I would like to know if this kind of problem is to be spected when changing the grid, I am no expert in numerical analysis.
 
Hmm. Sounds like its hard to pin down where the problem really lies, to reduce it to a pure computer science problem. I'll let it stand then, good luck!
 
  • Like
Likes   Reactions: Telemachus
Great, thank you :D you helped me a lot in trying to clarify my problem.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
12K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
9
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K