Looking for an example of a Successive over-relaxation

hahaha158
Messages
79
Reaction score
0
Hi

I am working on a programming assignment that requires me to implement the successive over-relaxation algorithm. We are given the wikipedia page for this: http://en.wikipedia.org/wiki/Successive_over-relaxation.

I have read through the wikipedia page for this numerous times but am still quite unsure of the process.

If given a 3x3 matrix for A, let's say [[1,2,3][5,1,-3][3,1,2]] and a vector for B = [1,-1,2], how can I use this method to solve for x? Sorry if the A and B I gave are not even solvable.

I think that we need to find a w between 1 and 2, so I just arbitrarily chose 1.5, then we need to choose an initial value of x? Can anyone either please give a simple example demonstrating this method, or help explain the wikipedia write up in simpler terms?

Thanks
 
Physics news on Phys.org
The Wikipedia page is quite clear. What part didn't you understand? Can you write down the matrices D, L, and U?
 
I have D = [[1,0,0][0,1,0][0,0,2]], L = [[0,0,0],[5,0,0][3,1,0]] U = [[0,2,3][0,0,-3][0,0,0]]. From here do I plug into the x^(k+1) equation? How do I find x^(k). What is the xi^(k+1) equation?
 
You're iterating. You start with a guess for x. Say your guess is (1,2,3). k is the index of the iterations. So your guess is x(0). So x0(0) = 1, x1(0) = 2, x2(0) = 3. So given x(0), you use the equation to calculate x(1), which is a better approximation to the answer. You keep iterating until the answer stops changing to some degree of accuracy. Do you see?
 
Under the algorithm section, i guess they use
7f20aa0b3691b496aec21cf356f63e04.png
for the x and σ for the change from x^k to x^(k+1)? Are these assumptions correct? If so, is finding σ just x^(k+1) - x^k, and I want to keep iterating until σ < (arbitrary minimum i choose?)
 
Yes. In the algorithm section φ is the same as x up above, and σ is just a shorthand for the product Ax (or Aφ).
 
ok, so since σ is not used for testing convergence like I assumed, can I choose an arbitrary value of let's say 0.001, and then in the section under algorithm that says test for convergence, can I just check to see whether φ^k+1 - φ^k < 0.001, and exit the loop if so?
 
I'm still not sure you've got it. Yes, you can just check to see whether φ^k+1 - φ^k < 0.001, and exit the loop if so. But you can't assume value for σ. You have to calculate σ, it is the product of A and φ.
 
Sorry, my last reply was worded poorly. I meant to choose an arbitrary value for φ^k+1 - φ^k, i didn't mean to imply that the value is equal to σ. In any case, it doesn't seem like you actually need to calculate σ, since in the algorithm it is initialized as 0, and they have a line that computes it inside the j loop, correct?
 
  • #10
Yes, correct. They are just showing you how to calculate it.
 
  • #11
thank you!

your explanations helped a lot
 
Back
Top