Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Help w/ Jacobi Iterative (http://www.go4expert.com/forums/help-jacobi-iterative-t2086/)

bluelolypop 1Dec2006 11:28

Help w/ Jacobi Iterative
 
Hi I can't find how to do this in my book ANYWHERE so i dunno how to do this.. it's my hw and it's due tomorrow at 9 pm... if anyone can help that'd be nice... thanks a lot. These are the instructions but I don't even know how to start it..


/* In void prob1() you are asked to solve the system of equations:

a[i][0]*x[0]+a[i][1]*x[1]+...+a[i][4]*x[4] = b[i] for i=0, 1, ..., 4

using the Jacobi iterative method, where a[5][5] and b[5] are defined
as follows:
double a[5][5]={ 5., 0., 1., 0., -1.,
0., 4., 3., -1., 0.,
0., 0., 3., 1., -5.,
1., -1., 0., 3., 0.,
1., 1., 0., 0., -4.}
double b[5]={-1., -4., 1.,-3., 3.0}, x0[5]={0.}, x1[5];

In the method, one starts with an approximate x0[] and obtains an
improved solution x1[]:

x1[i] =1/a[i][i] *(b[i] - (sum on j, except j=i)a[i][j]*x0[j]))
for i=0,...,4.

Perform six** iterations to find an approximate solution
x1[] starting from the initial guess x0[0]=x0[1]=...=x0[4]=0.0.
After each iteration, print the values of x1[] by using %12.3e.*/


All times are GMT +5.5. The time now is 04:37.