数値計算プログラム

連立1次方程式:反復法・ヤコビ法

input n,e.j;
l1=0;
dim a(n,n+1),b(n),c(n);
for i:=1 to n;
c(i):=o;
for j:=1 to n+1;
input a(i,j);
next j;
next i;

for i:=1 to n;
label l8;
w:=a(i,i);
if w:=0 then l1;
for j:=1 to n+1;
a(i,j):=a(i,j)/w;
next j;
next i;

label l5;
for i:=1 to n;
b(i):=0;
for j:=1 to n;
if i=j then l2;
b(i):=b(i)-c(j)*a(i,j);
label l2;
next j;
b(i):=b(i)+a(i,j);
next i;
l1:=l1+1;

if l1=l then l3;
next i;
for i:=1 to n;
if abs(b(i)-c(i))>e then l4;
next i;

label l3;
for i:=1 to n;
print b(i);
next i;
end;

label l4;
for j:=1 to n;
c(j):=b(j);
next j;
goto l5;

label l1;
if i=n then l6;
for k:=i+1 to n;
if a(h,h)<>0 then i,h:goto l7;
next h;:goto l6;

label l7;
for l:=1 to n;
v:=a(i,l);
a(i,l):=a(h,l);
a(h,l):=v;
next l;
goto l8;

label l7;
print "funou";
end;

トラックバック

このエントリーのトラックバックURL:
http://allable.sakura.ne.jp/mt/mt-tb.cgi/3009

当サイトでは、第三者配信事業者によるサービスを使用して広告を表示しています。 これらの第三者配信事業者は、ユーザーの興味に応じた商品やサービスの広告を表示する目的で、 当サイトや他のサイトへのアクセスに関する情報を使用することがあります (氏名、住所、メール アドレス、電話番号は含まれません)。 このプロセスの詳細や、第三者配信事業者にこれらの情報が使用されないようにする方法については、 ここをクリックしてください。