How do I determine if my iterations are converging?

Hey everyone, sorry to bother. I'm working on a quick program for Jacobi iteration to find a solution vector. For those not familiar with it in simple terms what I'm trying to do is run a vector through a calculation to get a new vector, and if the change between the two vectors is large enough then I just throw out the first vector and run the calculations with the newly made vector.
I'm supposed to run this repeatedly until the two values begin converging, or rather when the changes to the vector every time it goes through the equation becomes too small to make much of a difference.

Now the issue is that the Professor didn't mention how to check for convergence. The only way I could think of is a loop that runs through the old vector adding and subtracting a specific value to the current value of that vector, creating two new numbers that will act as a range, and seeing if the corresponding value in the new vector falls into that range, and only stopping the iterative loop when all values fall into their corresponding range, but... That honestly seems rather cumbersome.

So I was curious if anyone else knew if there were other ways to check two vectors for convergence, otherwise I'll just code the method I mentioned above.
closed account (48T7M4Gy)
See https://en.m.wikipedia.org/wiki/Jacobi_method
Yes I have read through the Wikipedia article several times, but note that the convergence section only speaks about conditions about if it converges are not, the pseudo code just says "While it has not reached convergence", and the full code written below is done in Python using a function called allclose, which c++ does not have.

What I'm trying to find out is if there method I mentioned above is the only means of finding convergence, or if there is some mathematical equation I'm forgetting about.
closed account (48T7M4Gy)
On the issue of allclose, this is the key to the test while the rest of the python code is for other things.

But there's no problem in implementing that in C++, https://docs.scipy.org/doc/numpy/reference/generated/numpy.allclose.html

Whether there's some slick maths to avoid doing the obvious remains to be seen :)

Topic archived. No new replies allowed.