Hello,
I can not find the reason of error at below program, Could anyone help about this problem?
It is a syntax problem.(…is incomplete; more input is needed.)
If I have not made an error typing your code
jacobi[a0_,b0_,p0_,max_]:=Module[{a=N[a0],b=N[b0],i,j,k=0,n=Length[p0],p=p0,pold=p0},
Print["P"o,"=",p];
While[k<max,
For[i=1,i<=n,i++,
p[[i]]=1/a[[i,i]](b[[i]]+a[[i,i]]pold[[i]]-Sum[a[[i,j]]pold[[j]],{j,1,n}])];
Print["p"k+1,"=",p];
pold=p;
k=k+1];
Return[p];];
a={{2,8,3,1},{0,2,-1,4},{7,-2,1,2},{-1,0,5,2}};
b={-2,4,3,5};
vars={"x1","x2","x3","x4","x5","x6","x7","x8","x9"};
Print["Denklem Sistemi Cozumu"];
Print[MatrixForm[a],MatrixForm[vars],"=",MatrixForm[b]];
p={1,1,1,1,1,1,1,1,1};
x=jacobi[a,b,p,15]
then running that instantly displays
Denklem Sistemi Cozumu
<<<your matrix expression>>
Po={1,1,1,1,1,1,1,1,1}
Part 5 of {2, 8, 3, 1} does not exist
Part 6 of {2, 8, 3, 1} does not exist
Part 7 of {2, 8, 3, 1} does not exist
Further output of Part::partw will be suppressed during this calculation
followed by a large expression with subscripts which cannot be evaluated because they are out of bounds.
Can you compare this with what you have and see if you can find the source of the difference?
Because Po={1,1,1,1,1,1,1,1,1} should be Po={1,1,1,1}.
Thanks for your help.
I really appreciate it.