after that I use the 5/4 in the next equation, and the 0 from the matrix [3x1](k).

So, X2(k+1)=(8-2*(1.25)-0)/-6= ~0,91

and so on.

What I can't figure it out is how to do that. I think that I need to use for loops and the matrix [3x1](k) = [ 0 0 0 ] must save the current values, so that it can be used in the next computation, but I'm blocked. I'm seeing how to do that.

05-13-2011

tabstop

You need to pick a problem and stick with it: Either you are going to do this component-wise with three different equations or you are going to use operators * and +. If you intend to do component-wise manipulation, then you can throw away your class and make six variables (X, Y, Z, newX, newY, newZ) and write down your equations.

05-13-2011

PyroBlast

But the idea is to do the gauss-seidel method.

So I need the X updated to use right away in the next equation.

Do you understand what I mean?

Like, I ask the user to all that crap that will allow me to "build" the Matrix A, x and b (Ax=b).

Then I will transform those Matrix on a different order: X(updated=k+1) = Beta(=bi/aii) + (alfa Matrix *X(before=k) )

But instead of doing right away the general purpose, I'm doing it for a particularly 3x3 matrix.

I make 3 Matrix with the costructor, X[3x1]=Beta[3x1] + Alfa[3x3]*X[3x1] ;

Here, both matrix X[3x1] are the same. So when I'm solving the first equation, the X Matrix will be updated and then the next equation will use the same X Matrix with the updated value, like in the example before.

Help meeeee lol

05-14-2011

tabstop

The statement that you've made three matrices is a bit worrisome, given that you have four in the problem. Unless by "matrix" you mean "vector", in which case you need to also make a "matrix" class to handle your Alfa, and then you can write operator*(matrix, vector) to finish it off.

(Or unless you aren't keeping old X around, in which case

Code:

X = Beta + Alfa*X;

and we're done.)

05-14-2011

VirtualAce

The answer is to overload the operators relative to your matrix class that you need in the equation. This has been stated more than once.